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 are the data types that sas contain?
what are 5 ways to perform a table lookup in sas? : Sas-administrator
what are the types of interactive display types? : Sas-bi
for what purpose would you use the retain statement? : Sas programming
what can you learn from the sas log when debugging? : Sas programming
which date function advances a date, time or datetime value by a given interval? : Sas programming
Explain what is SAS informats?
i want for interview question & answer plz it need immediate send t my mail raviprakashmot@gmal.cm
Approximately what date is represented by the SAS date value of 730?
describe about metadata object? : Sas-di
For a user to have access to a standard workspace server, is internal authentication alone is sufficient? : sas-grid-administration
What will calendar procedure do?
how does sas handle missing values in formats? : Sas programming
where to use sas business intelligence? : Sas-bi
what is sas business intelligence? : Sas-bi