Desktop productivity for business analysts and programmers

Macro variable within a macro variable

Accepted Solution Solved
Reply
Contributor
Posts: 27
Accepted Solution

Macro variable within a macro variable

Hi all,

I have the following macro variables:

 

day_1_start = 'something'

day_2_start = 'somethingelse'

I am now trying to call them in a loop, and so (within a macro loop) have

%do i = 1 %to 5;

     var = var * &day_&i._start ;

%end;

but it's not working. The log says 'WARNING: Apparent symbolic reference DAY_ not resolved.'

Any advice?

Thanks,

Marco


Accepted Solutions
Solution
‎06-13-2014 09:56 AM
PROC Star
Posts: 1,146

Re: Macro variable within a macro variable

Put an extra & in from of &day:

var = var * &&day_&i._start ;

That causes the first pass to resolve to &day_1_start, and the second pass resolves to something.

Tom (I hate macros) Kari

View solution in original post


All Replies
Solution
‎06-13-2014 09:56 AM
PROC Star
Posts: 1,146

Re: Macro variable within a macro variable

Put an extra & in from of &day:

var = var * &&day_&i._start ;

That causes the first pass to resolve to &day_1_start, and the second pass resolves to something.

Tom (I hate macros) Kari

🔒 This topic is solved and locked.

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

Discussion stats
  • 1 reply
  • 213 views
  • 0 likes
  • 2 in conversation