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
How is character variable converted into numeric variable and vice versa?
What is run-group processing?
how could you generate test data with no input data? : Sas programming
How we can create SAS USER DEFINED CODE?
How would you invoke a macro? : sas-macro
what is transformation in sas data integration? : Sas-di
what has been your most common programming mistake? : Sas programming
Differentiate between format and informat? : sas-grid-administration
How might you use MOD and INT on numeric to mimic SUBSTR on character Strings?
How do dates work in SAS data?
How would you code a macro statement to produce information on the sas log? This statement can be coded anywhere? : sas-macro
what is the effect of the options statement errors=1? : Sas programming
What is the maximum length of the macro variable? : sas-macro
Difference between sum function and using “+” operator?
explain about various caches available in data integrator? : Sas-di