I've got a macro that I've created on my local machine in a .sas file. I've also got a local dataset that have been using to test the macro. This dataset has the same descriptors as a remote dataset, but just less observations. Now, I'm trying to run my local macro against the 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 this generates an error (error follows):
%include "C:\my_sas_macro.sas";
rsubmit;
%my_sas_macro(my_data=remotelib.remotedata)
endrsubmit;
The log with error:
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'm pretty sure I need to somehow transfer the %macro/%mend block over to the server, but I can't figure out how. I've seen the %SYSLPUT
but that is for macro variables and not full macros.
Is there anyway that I can run my macro on the server without having to just SSH over the code and %include
it there?
Thanks!
[Edit] Implemented Solution
So based on @CarolinaJay65 's answer I came up with the following macro which is working pretty well for me so far.
%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;
This allows me to just call %include_on_server(file="C:\my_file.sas")
and then it's now included in my remote session.