I need help in merging two different datasets. I am merging
by date and I want to propagate observations from one
dataset to the corresponding dates. One dataset has a
unique date for each day of the month, while the other
dataset has same date for different patient visits. For
example I want to spread an observation on the 31DEC2008
from one dataset to several observations with the same date
on a second dataset for all the patients who visited on
that date. I have tried to merge the two and the result is
not what I wanted. Instead I get a dataset whereby all the
dates have missing values where observations from the first
datset should have spread.



I need help in merging two different datasets. I am merging by date and I want to propagate observ..

Answer / kumaraswamy maduri

data new;
date1="31Dec2008"d;
run;

data new1;
input date1 date9. subj;
cards;
31dec2008 1
30dec2008 1
30dec2008 2
31dec2008 2
;
run;

proc sort;by date1;run;

data comp;
merge new(in=x) new1;
by date1;
if x;
run;

I have used the above code. I got perfect results.

Please correct me if I misunderstood your question.

Is This Answer Correct ?    6 Yes 0 No

Post New Answer

More SAS Interview Questions

How to convert .xls file into CSV format?

6 Answers   Quintiles,


Which is Best Institute for learning SAS BASE & SAS BI in Hyderabad? Can anyone suggest me ?

5 Answers   ACC,


How do you download a flat file from Mainframe to your local PC using SAS?

3 Answers  


what is the different between functions and procs that calculate the same simple descriptive statistics? : Sas programming

0 Answers  


What are the features of base sas system?

0 Answers  






what is enterprise guide? What is the use of it? : Sas programming

0 Answers  


Which of the following is not created during compilation phase?

2 Answers   SAS,


What is the one statement to set the criteria of data that can be coded in any step?

4 Answers   Accenture,


For what purpose would you use the RETAIN statement?

0 Answers   Quintiles,


how does sas handle missing values in sort order? : Sas programming

0 Answers  


explain the concepts and capabilities of business object? : Sas-bi

0 Answers  


wt is a-z and a--z?

3 Answers   Accenture,


Categories