BookmarkSubscribeRSS Feed
sambasiva_ravuri_tcs_com
Calcite | Level 5

Dear All,

Am having the date of Births as Input and i would like to write using DATE Functions, the no.of days between Birth Date and Today's Date in output dataset ?

11/12/87

12/04/56

03/06/79

04/05/94

03/07/99

03/07/99

Kindly help me.

Regards,

S Ravuri.

2 REPLIES 2
Haikuo
Onyx | Level 15

Officially, Intck().But in your case, '-' will be sufficient.

data have;

input bday mmddyy8.;

format bday mmddyy8.;

cards;

11/12/87

12/04/56

03/06/79

04/05/94

03/07/99

03/07/99

;

data want;

set have;

ageindays=intck('day',bday,today());

ageindays_=date()-bday;

run;

proc print;run;

I choose to use month/day/year to inteprete your data, although it can be intepreted in other ways as well.

Regards,

Haikuo

Hima
Obsidian | Level 7

data have;
input  bday mmddyy8.;
format bday mmddyy8.;
cards;
11/12/87
12/04/56
03/06/79
04/05/94
03/07/99
03/07/99
;
run;

data want;
set have;
age_days = today() - bday;
run;

proc print; run;

Output:

                                 Obs        bday    age_days

                                   1     11/12/87       8890
                                   2     12/04/56      20190
                                   3     03/06/79      12063
                                   4     04/05/94       6554
                                   5     03/07/99       4757
                                   6     03/07/99       4757

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 751 views
  • 0 likes
  • 3 in conversation