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 |
You need to perform an analysis on a massive dataset by groups, but are unable to sort the data due to memory constraint. How would you accomplish the task?
Can you excute a macro within a macro? Describe.
What are the different operating system platforms in which we can use sas? : sas-grid-administration
Describe the types of SAS programming tasks that you performed like Tables? Listings? Graphics? Ad hoc reports? Other?
What is a pdv and what are its functions?
Name and describe three SAS functions that you have used, if any?
How to create list output for cross-tabulations in proc freq?
Name any two sas spawners? : sas-grid-administration
What do the PUT and INPUT functions do?
Which statement does not perform automatic conversions in comparisons?
If reading a variable length file with fixed input, how would you prevent SAS from reading the next record if the last variable didn’t have a value?
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.