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 2025: Call for Content

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!

Submit your idea!

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
  • 807 views
  • 4 likes
  • 2 in conversation