1
votes

I can't work out why I am unable to call a macro within an rsubmit call.

For example, I have the code:

%let var= year;
%put &var;            /* this works fine and prints "year" to the log  */
    rsubmit;
    proc sql;
        %put &var;    /* this does not work   */

The second instance throws up the warning WARNING: Apparent symbolic reference VAR not resolved. Why can i not reference the macro within the rsubmit code, and how could i adapt to allow for this?

For reference, if i shift the creation of the macro within the rsubmit it works fine - for example:

rsubmit;
proc sql;
   %let var= year;
   %put &var;               /* prints "year" as expected  */

however, I am looking to assigning the macros at the start of my code - and also looking to understand why wouldn't work before.

1
If you simply want to assign the macro variables at the start of your code you can simply start with a rsubmit; <assignments> endrsubmit; block without having to pass them from local to remote. Otherwise if you need to have them available on both systems then go with Adam's answer.DaBigNikoladze

1 Answers

5
votes

It's because you are defining it on the locally rather than on the remote system, they're held in separately. If you want to create/update values on remote when running locally or vice-versa, you can use the %syslput and %sysrput statements respectively. http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a001221974.htm