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
What does proc print, and proc contents are used for?
Describe what are the different levels of administrative users in sas? : sas-grid-administration
How do you convert basic cube to transaction cube and transaction cube to basic cube?
How does proc sql work?
what is a method for assigning first.var and last.var to the by groupvariable on unsorted data? : Sas programming
Mention common programming errors committed in sas ?
Give some examples where proc report’s defaults are different than proc print’s defaults?
Explain what Proc glm does?
What do the PUT and INPUT functions do?
how can you put a "trace" in your program? : Sas programming
what are the categories that sas informats are used to the place the data? : Sas-administrator
sas implementing companies in pune implementing clinical projects if anyone knows plz send ans immediately
Differences between where and if statement?
What are the ways to do a “table lookup” in sas?
AE datasets names? how many types?