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


Please Help Members By Posting Answers For Below Questions

How do dates work in SAS data?

680


What do you understand by the term Normal Distribution?

568


what is data access? : Sas-di

599


What is maximum storage capability of SAS?

904


Can you explain the process of calendar?

636






explain what is factor analysis? : Sas-administrator

598


What is the difference between order and group variable in proc report?

831


data data1; input dt account; format dt date9.; cards; 1745 1230 1756 1120 1788 1130 1767 1240 ; data data2; input startdt enddt total; format startdt date9. enddt date9.; cards; 1657 1834 12300 1557 1758 16800 1789 1789 12300 1788 1345 12383 1899 1899 13250 ; proc sql; create table data3 as select * from data1 as x left join data2 as y on x.dt>=y.startdt and x.dt<=y.enddt; quit; Here, we are getting cartision product. But,I want left join report consisting of this program. It should not get duplicate values. you can modify the program also.

1791


if you were told to create many records from one record, show how you would do this using array and with proc transpose? : Sas programming

538


what is broad cast agent? : Sas-bi

593


what is slowly changing dimension? : Sas-di

618


Explain bmdp procedure?

608


What is the difference between one to one merge and match merge? Give an example.

565


How are numeric and character missing values represented internally?

1132


What are symget and symput? : sas-macro

722