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 is the formula to measure Baseline

3 Answers   Sristek,


How would you generate 1000 observations from a normal distribution with a mean of 50 and standard deviation of 20. How would you use PROC CHART to look at the distribution? Describe the shape of the distribution.

1 Answers  


how to delete the duplicates by using proc sql?

3 Answers   Genpact,


Is the physical structure of the data set in the same orientation as the report? Do you need to reshape the data sets? What method should you use to reshape the data–DATA steps,PROC TRANSPOSE,output data set from a procedure?

0 Answers  


how do u validate sas program

3 Answers   Accenture,






SAS using companies in chennai

1 Answers  


How would you create multiple observations from a single observation?

1 Answers   Quintiles,


what is factor analysis? : Sas-administrator

0 Answers  


How do you add a number to a macro variable? : sas-macro

0 Answers  


what are _numeric_ and _character_ and what do they do? : Sas programming

0 Answers  


how do you want missing values handled? : Sas programming

0 Answers  


Hi I have list of products in a dataset, which are classified by other name for eg:- there is a product A> Malambo Shiraz Malbec 750ML(0388) which is a Red wine.Now i need to generate a report where it shows if this product appears then it should b displayed as red wine,similarly for other products and other classification. I dont wan use proc format.

4 Answers   Symphony,


Categories