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
Answer Posted / 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 |
Post New Answer View All Answers
What is factor analysis?
what is snowflake schema? : Sas-di
Explain what Proc glm does?
explain the function of substr in sas? : Sas-administrator
What is the SAS data set?
What are the automatic variables for macro? : sas-macro
how does sas handle missing values in functions? : Sas programming
explain the use of % includes a statement in sas? : Sas-administrator
what is the difference between infile and input? : Sas-administrator
What is the purpose of _character_ and _numeric_?
How to specify variables to be processed by the freq procedure?
Explain the main difference between the sas procedures and functions? : Sas-administrator
What is Linear Regression?
What is interleaving in SAS?
What would be the result of the following SAS function (given that 31 Dec, 2000 is Sunday)?