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
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.