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
Tell me more about the parameters in macro? : sas-macro
How do you use the do loop if you don’t know how many times you should execute the do loop?
Mention the category in which sas informats are placed?
Name validation tools used in SAS
Explain what is data step?
explain the difference between proc means and proc summary?
Assuming {et} is randomly drawn from N(0,1) and e0 = 0, generate 200 observations of xt = et − 0.5e(t−1) and draw a line graph of xt.
Describe a time when you were really stuck on a problem and how you solved it?
how the sas basic syntax style described? : Sas-administrator
In proc transpose and data step with arrays which one you pick?
Name types of category in which SAS Informats are placed?
what is the difference between calculating the 'mean' using the mean function and proc means? : Sas programming
What are the five ways to do a table lookup in sas? : sas-grid-administration
What do the PUT and INPUT functions do?
what do the sas log messages "numeric values have been converted to character" mean? What are the implications? : Sas programming