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!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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