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.
Answer Posted / 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 View All Answers
explain about data integrator metadata reports? : Sas-di
Differentiate between sas functions and sas procedures.
What does P-value signify about the statistical data?
what is the basic structure sas administrator? : Sas-administrator
what is sas application server, database server, sas olap server and sas metadata server? : Sas-di
how we can create a FLAG datasets? Ex:-ID age_group no_persons 1 to 10 10 to 20 3 11 to 20 21 to 30 7 21 to 3o 31 to 40 5
How to create a permanent sas data set?
Differentiate between ceil and floor functions.
What are types of transport files?
How do you use the do loop if you don’t know how many times you should execute the do loop?
explain what is factor analysis? : Sas-administrator
what is hierarchy flattening? : Sas-di
If money were no object, what would you like to do?
What makes sas stand out to be the best over other data analytics tools?
what is the difference between calculating the 'mean' using the mean function and proc means? : Sas programming