hi,
I am providing a sample data .
1)I need the investor who attained the minor to major on 14/01/2012 ( i .e greater than equal to 18 years)
2)I should pick up the entire address from another database (have2) with the INVNAME?
data have1;
input name$ dob DATE10.;
cards;
SHARMA 10/10/2010
TRISHA A 30/11/1992
TRISHA 30/11/1999
SANGHVI 30/05/2000
SANGHVI 26/03/1991
;
run;
data have2;
input INVNAME $8. STATE$ ACNO$;
cards;
SHARMA UTTAR PRADESH 813120*****
TRISHA GUJARAT 819173*****
TRISHA A GUJARAT 826162*****
SANGHVI GUJARAT 826293*****
SANGHVI GUJARAT 826313*****
;
run;
Formula for Age :
age = floor ((intck('month',birth,somedate) - (day(somedate) < day(birth))) / 12);
proc sql;
create table want as
select invname, state, acno, dob, floor((intck('month', dob, '14Jan2012'd)-(day('14jan2012'd)<day(dob)))/12) as age
from have
join have2
on name=invname
where age>=18;
quit;
attained minor to major on and greater than equal on are two different classifications. Do you want everyone who turned 18 on that date or anyone who was older than 18 as of that date?
You can play around with the where clause to get what you want, and you may also need to modify the join (left/right/full) depending on your data.
1)I need the investor who attained the minor to major on 14/01/2012 ( i .e greater than equal to 18 years)
hi
what's the logic behind the sub code day(somedate) < day(birth)))?
please explain
thanks
ALLU
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.