Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attempting to calculate age in sas

Status
Not open for further replies.

sap1958

Technical User
Oct 22, 2009
138
0
0
US
data table2;
set table1;
Age = Birthdate-TODAY();
format TotalSalary dollar12.2;
run;

When I run this I get a large number for the Age.
ie 209501348

I should only get a 2 digit number
 

Have a go at this

data table2;
set table1;

tday = date();

age = floor((intck('month',Birthdate,tday)- (day(tday) < day(Birthdate))) / 12);

Where Birthdate is the date you want to see there age from.
 
Why cant you do it with just using the INTCK function without all the rules?

ex.
age = intck('year',Birthdate,date());
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top