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 |
Where do you use proc means over proc freq?
what is the use of sas management console? : Sas-di
what are _numeric_ and _character_ and what do they do? : Sas programming
What are the functions used for character handling?
how does sas handle missing values in formats? : Sas programming
Which is Best Institute for learning SAS BASE & SAS BI in Hyderabad? Can anyone suggest me ?
Explain what is data step?
What is highest missing value for numeric?
What is the basic structure of the SAS base program?
Does SAS ‘Translate’ (compile) or does it ‘Interpret’? Explain.
What is the difference between proportion and average?
hi i date is 05sep2005; i want the oupput like 05sep2005:00:00:00 ; how it wil come?