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 operational data and operational system? : Sas-di
What are the special input delimiters used in SAS?
explain the use of % includes a statement in sas? : Sas-administrator
what is study design in while working with SAS? what are screening variables in SAS?
Which command is used to perform sorting in sas program?
How do you specify the number of iterations and specific condition within a single do loop?
how are numeric and character missing values represented internally? : Sas programming
What is the order of application for output data set options, input data set options and SAS statements?
What is run-group processing?
do you prefer proc report or proc tabulate? Why? : Sas programming
What is the use of divide function?
explain the function of substr in sas? : Sas-administrator
explain the concepts and capabilities of business object? : Sas-bi
Of all your work, where have you been the most successful?
describe how to adjust the performance of data integrator? : Sas-di