1
votes

I have understood, and seen in other programs, that the following syntax is true.

%let variable = 'something';

statement name "&variable\othertext";        // something\othertext

However, in the code I have written I get this error message: Apparent symbolic reference not resolved. for the line LIBNAME REMOTE

%let month  =   'JUN';      
%let year   =   '18';       

%let    zos =   ***********
signon  zos     ********************;

libname name    "*********************************";

rsubmit;
libname remote  "AAAA.BBBB.&month&year.SASLIB"  access = readonly;

proc download inlib=remote outlib=name;
run;

libname remote clear;
endrsubmit;

signoff;

What am I missing?

2
After combining the answers from Chris J. and Tom, the script is working!unequalsine

2 Answers

2
votes

The MONTH and YEAR macro variables are being defined in your local session, yet you're trying to resolve them in a remote session.

Use %SYSRPUT and %SYSLPUT to assign macro variables between sessions.

/* Local to remote */
%LET MONTH = 12 ;
%LET YEAR  = 2018 ;
%SYSLPUT MONTH = &MONTH ;
%SYSLPUT YEAR  = &YEAR ;

rsubmit ;
  %PUT &MONTH &YEAR ;
  /* resolves 12 and 2018 respectively */

  /* remote to local */
  %SYSRPUT FOO = BAR ;
endrsubmit ;

%PUT &FOO ; /* resolves to BAR */
2
votes

More context would help, but most likely you are not understanding the role that period plays in resolving macro variable (symbol) references. To allow you to place letters and digits next to macro variable references SAS needs a way to tell where the name of the macro ends and the plain text starts. Period is used for that.

So if you wanted to generate this string

"AAAA.BBBB.JAN18.SASLIB"

from month and year values. First make sure to set the macro variables to the text you actually want. Quotes are just text to the macro processor.

%let month=JAN ;
%let year= 18;

Then in when you replace the values with macro variable references you will need an extra period after &YEAR so that one actually is generated. You should probably just get in the habit of always adding the period when referencing a macro variable.

"AAAA.BBBB.&month.&year..SASLIB"