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 / 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 |
how to import XTP files into SAS datasets?
1 Answers Barclays, Institute For Plasma Research,
how can you import .csv file in to sas? : Sas programming
What is the order of application for output data set options, input data set options and SAS statements?
If a variable contains letters or special characters, can it be numeric data type?
Mention how to limit decimal places for the variable using proc means?
i want to upload titles and footnotes to excel file?how it is possible?
Explain the purpose of retain statement.
name few built in sas transformation in DI studio ?
How to get top scorer student from a class-table having different sections A,B, C & D? Each section having same number of students.
How will you generate test data with no input data?
Which command is used to perform sorting in sas program?
Do you use PROC REPORT or PROC TABULATE? Which do you prefer? Explain.