BookmarkSubscribeRSS Feed
allurai0412
Fluorite | Level 6


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;

2 REPLIES 2
Reeza
Super User

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)

allurai0412
Fluorite | Level 6

hi

what's the logic behind the sub code day(somedate) < day(birth)))?

please explain

thanks

ALLU

sas-innovate-2024.png

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.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 657 views
  • 4 likes
  • 2 in conversation