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.



I need help in merging two different datasets. I am merging by date and I want to propagate observ..

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

Post New Answer

More SAS Interview Questions

What are the efficacy variables in your study?

2 Answers   Accenture, Quintiles,


What is the role of administrative users? : sas-grid-administration

0 Answers  


For what purpose(s) would use the RETURN statement?

1 Answers  


proc means? proc sort? proc append? proc freq? proc print? proc content?

4 Answers   Oracle,


Mention what is PROC in SAS?

0 Answers  






what is the function of catx syntax? : Sas-administrator

0 Answers  


How we can create SAS USER DEFINED CODE?

0 Answers  


Write a SAS macro to calculate number of numbers in an email address

2 Answers  


What do the PUT and INPUT functions do?

0 Answers  


how can you sort the dataset having millions of OBS(instead of sort procedure?

4 Answers   EXL,


What are some problems you might encounter in processing missing values? In Data steps? Arithmetic? Comparisons? Functions? Classifying data?

1 Answers   Quintiles,


Name and describe three SAS functions that you have used, if any?

2 Answers  


Categories