I have a macro that I created on my local machine in a .sas file. I also have a local dataset that was used to validate the macro. This dataset has the same descriptors as the remote dataset, but only fewer observations. Now I am trying to run a local macro with a remote dataset. Here is basically what I have:
This works as expected:
%include "C:\my_sas_macro.sas";
%my_sas_macro(my_data=work.localdata)
but then generates an error (error follows):
%include "C:\my_sas_macro.sas";
rsubmit;
%my_sas_macro(my_data=remotelib.remotedata)
endrsubmit;
Error log:
125 %include "C:\my_sas_macro.sas";
136
137 rsubmit;
NOTE: Remote submit to REMOTEID.__7551 commencing.
WARNING: Apparent invocation of macro MY_SAS_MACRO not resolved.
83 %my_sas_macro(my_data=remotelib.remotedata)
-
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
84 endrsubmit;
NOTE: Remote submit to REMOTEID.__7551 complete.
I am sure that I need to somehow transfer the% macro /% mend block to the server, but I cannot figure out how to do this. I saw %SYSLPUT, but for macro variables and not for full macros.
, SSH %include ?
!
[]
, @CarolinaJay65, , .
%macro include_on_server(file=);
%let server_file = ~/temp.sas;
%SYSLPUT macro_file=&file;
%SYSLPUT server_file = &server_file;
rsubmit;
proc upload
infile= "¯o_file."
outfile= "&server_file."
; run;
%include "&server_file.";
endrsubmit;
%mend include_on_server;
%include_on_server(file="C:\my_file.sas"), .