We want to merge file A and B. File A has variable age,
file B provide birthdate. How to merge the data according
to age in file B
Answers were Sorted based on User's Feedback
Answer / ramesh
First calculate age in B datase
data age;
set b;
age=int(intck('day',bday,today())/365.25);
run;
sort both datasets by the age key variable and Use the
merge statement to combine the both datasets
| Is This Answer Correct ? | 10 Yes | 1 No |
Answer / vishal
Calculate age in dataset B by using the following code:
data ages;
set b;
retain current;
if _n_=1 then current=today();
format bday current worddate20.;
age=int(intck('month',bday,current)/12);
if month(bday)=month(current) then
age=age-(day(bday)>day(current));
run;
Source: http://support.sas.com/kb/24/567.html
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / alok karan
First calculate age in BB dataset:
data bbb;
set bb;
age=round(yrdif(birthdate,today(),'Actual'),1);
run;
proc sort data=bbb;
by age;
drop birthdate;
run;
Now merge both dataset by age variable:
data abc;
merge aa bbb;
by age;
run;
| Is This Answer Correct ? | 0 Yes | 0 No |
wat has been most common programming mistake?
What are the automatic variables for macro? : sas-macro
how to delete the duplicates by using proc sql?
hi tell be about pfizer? how to compare the work with other companies ? please tell me how to login and work also?
How do you add a number to a macro variable? : sas-macro
What are the data types that sas contain?
Can we replace a dataset into view?
What was the last computer book you purchased? Why?
What's the difference between VAR A1 - A4 and VAR A1 - A4?
Do you need to compute new variables? If so,should you do this before you execute the report-writing procedure?
what are the differences between proc report and proc tabulate?
i have a null dataset with 20 variables. i want to upload the variables which contain name like a or k or anything in another dataset.how can we create the dataset?