Solved
Contributor
Posts: 61

do statement for age calculation

Hi all,

This is a new twist to a question I’d asked in this forum some time back.

Can someone please see why this macro is not working? I’m calculating ages of different family members over different years (this also helps me to account for newcoming members and those that expire).

I’m trying to calculate age of each person in the family at the end of the year. I don’t see the ages increasing each year. Any inputs?

(A=year, b=weeks)

%macro calc(a,b);

data set&a&b;

set set&a&b;

array person {9} person1-person9;

array age {9} age1-age9;

array age_person {9} age_person1-age_person9;

do i=1 to 9;

age=floor( (intck('month', PERSON, '31dec20&a'd) -(day('31dec20&a'd) < day(PERSON)))/12);

end;

run;

%mend;

%calc (12,52);

%calc (11,52);

Thanks,

Accepted Solutions
Solution
‎05-03-2013 04:21 PM
Super User
Posts: 23,776

Re: do statement for age calculation

Try changing your single quotes to double quotes and ending your macro var with a period.

All Replies
Solution
‎05-03-2013 04:21 PM
Super User
Posts: 23,776

Re: do statement for age calculation

Try changing your single quotes to double quotes and ending your macro var with a period.

Contributor
Posts: 61

Re: do statement for age calculation

Worked like a charm Thank you Reeza!

🔒 This topic is solved and locked.