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


Please Help Members By Posting Answers For Below Questions

What is data _null_?

701


hi all, I need the SAS DI DUMP(A00 260) for attending the certification. if any one have, pls provide it.Please Email to vrpotluri@hotmail.com. Thanks - Ramana

4916


Did you used proc test? when?

1577


what is factor analysis? : Sas-administrator

617


Describe a time when you were really stuck on a problem and how you solved it?

2086






how can you put a "trace" in your program? : Sas programming

580


What is the difference between input and infile statement?

688


In sas, what are the areas that you are most interested in? : sas-grid-administration

644


how can you import .csv file in to sas? : Sas programming

642


Can you execute macro within another macro? : sas-macro

532


What are the difference between sas functions and procedures?

644


What is program data vector (pdv) and what are its functions?

631


Which command is used to perform sorting in sas program?

599


Name types of category in which SAS Informats are placed?

738


how to do user inputs and command line arguments in sas?

2432