DATA Step, Macro, Functions and more

Macro Variable Resolution

Accepted Solution Solved
Reply
Regular Contributor
Posts: 212
Accepted Solution

Macro Variable Resolution

 

Hi. I have this reference to &ZIP5 that isn't resolving. It's inside of my Macro named Loopy, does this keep it from resolving?  Or maybe something to do with the statements being in quotes?

 

Any help would be appreciated.

 

MPRINT(LOOPY):   * Create unique index (if not exist), to meet the criteria that only one record (imb) per ;
MPRINT(LOOPY):   * rule is kept and counted in the data ;
MPRINT(LOOPY):   data _null_;
MPRINT(LOOPY):   set sashelp.vmember (where=(Libname='WORK' and memname='FINALDATA&ZIP5'));
MPRINT(LOOPY):   if upcase(index)='NO' then call execute('proc datasets; modify finaldata&ZIP5; index create imb_code /unique;
run; quit;');
MPRINT(LOOPY):   run;

NOTE: There were 0 observations read from the data set SASHELP.VMEMBER.
      WHERE (Libname='WORK') and (memname='FINALDATA&ZIP5');
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds


Accepted Solutions
Solution
‎06-29-2016 04:21 PM
Contributor
Posts: 39

Re: Macro Variable Resolution

Try double quotes instead of single quotes

View solution in original post


All Replies
Super Contributor
Posts: 408

Re: Macro Variable Resolution

Hi,

 

No way to know for sure until we get to see the full code. But a common oversight is to determine the scope of a variable. If it is not defined as global inside a macro the variable reference may not get resolved.

 

%GLOBAL zip5;

 But to get the full picture we need the code.

 

Regards,

- Jan

Solution
‎06-29-2016 04:21 PM
Contributor
Posts: 39

Re: Macro Variable Resolution

Try double quotes instead of single quotes
Super Contributor
Posts: 408

Re: Macro Variable Resolution

Ah yes. Doh!
☑ This topic is SOLVED.

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

Discussion stats
  • 3 replies
  • 234 views
  • 2 likes
  • 3 in conversation