Attempting to calculate age in sas
Attempting to calculate age in sas
(OP)
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
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
RE: Attempting to calculate age in sas
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.
RE: Attempting to calculate age in sas
ex.
age = intck('year',Birthdate,date());