BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
spg
Obsidian | Level 7 spg
Obsidian | Level 7

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,

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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

View solution in original post

2 REPLIES 2
Reeza
Super User

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

spg
Obsidian | Level 7 spg
Obsidian | Level 7

Worked like a charm Thank you Reeza!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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