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

Hi,

I have the following code -

%macro wkrpt;
%do i=1 %to 2;
rsubmit;
proc sql inobs=10000;
create table report_2_pt&i as
(
   select location_id as LocationId,

   
       sum( case when week = %eval(&i.) and transaction_type_id = 905 then 1 else 0 end)
                                                                  as StarterKitsSold_&&&wkcnt&i.

from final_trans_Set

group by x

order by x

);

quit ;

endrsubmit;

%end;

%mend wkrpt;

%wkrpt

It is unable resolve &i. I get the following message in the log -

WARNING: Apparent symbolic reference I not resolved.

Also  &&&wkcnt&i. is not getting resolved, because I is not resolved.

When I do put statement, following is the dump from log -

95   %put &wkcnt1;

SYMBOLGEN:  Macro variable WKCNT1 resolves to 01/03/2015

01/03/2015

Can you kindly advice?

1 ACCEPTED SOLUTION

Accepted Solutions
FriedEgg
SAS Employee

use %nrstr around any macro variables you want to reference withing the remote session.

%macro wkrpt;

%do i=1 %to 2;

%syslput i=&i. /remote=remhost;

rsubmit;

proc sql inobs=10000;

create table %nrstr(report_2_pt&i.) as

View solution in original post

5 REPLIES 5
rajat051984
Fluorite | Level 6

Thanks a lot @FriedEgg. Do you have any idea how the syntax would look like ?

I tried putting the %syslput statement after the %do loop, assuming it will put all variables including i at remote host.

But in the log it is still not recognizing I. Do you have any sample code for such looping situation ?

-------------LOG-------------------------

114  %macro wkrpt;

116  %do i=1 %to 2;

117  %syslput _user_/ remote = remhost;

118  rsubmit;

NOTE: Remote submit to REMHOST commencing.

166  proc sql inobs=10000;

167  create table report_2_pt&i as

                             -

                             22

WARNING: Apparent symbolic reference I not resolved.

167  create table report_2_pt&i as

FriedEgg
SAS Employee

use %nrstr around any macro variables you want to reference withing the remote session.

%macro wkrpt;

%do i=1 %to 2;

%syslput i=&i. /remote=remhost;

rsubmit;

proc sql inobs=10000;

create table %nrstr(report_2_pt&i.) as

rajat051984
Fluorite | Level 6

Thanks a lot!!

Haikuo
Onyx | Level 15

Also, &&&wkcnt&i seems not to be your intent, you have one more &, when resolving, when first scan, &&->& ,  &wkcnt and &i will be required to be resolved at the same time. so shouldn't it be &&wkcnt&i?

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 5 replies
  • 4957 views
  • 6 likes
  • 3 in conversation