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

What would the following datastep do? Data _null_; Set Dist end=eof; Call Symput("xx"!!left(put(_n_,2.)),&dimension); If EOF then Call Symput('numrows',left(put(_n_,2.))); Run; dimension is a macro variable that is being passed here

2 Answers  


Code the MEANS to produce output to be used later.

2 Answers  


explain what is data set in sas? : Sas-administrator

0 Answers  


What is the SAS data set?

0 Answers  


how we can call macros with in data step?

17 Answers   Allianz, ManPower,


How to do user inputs and command line arguments in SAS? D&B

2 Answers   BoA, Quintiles,


Differentiate between ceil and floor functions.

0 Answers  


What is data _null_?

0 Answers  


What are the limitations for memory allocation for SAS variables

0 Answers   Signetsoft,


what is the Population you used in your project, is it ITT or PP?

0 Answers   Accenture, Quintiles,


"What is the difference between proc sort nodup and proc sort nodupkey?"

2 Answers  


What areas of SAS are you most interested in?

0 Answers   Quintiles,


Categories