Help using Base SAS procedures

do statement for age calculation

Accepted Solution Solved
Reply
Contributor spg
Contributor
Posts: 61
Accepted Solution

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: 17,837

Re: do statement for age calculation

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

View solution in original post


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

Re: do statement for age calculation

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

Contributor spg
Contributor
Posts: 61

Re: do statement for age calculation

Worked like a charm Thank you Reeza!

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 160 views
  • 0 likes
  • 2 in conversation