Hi all,
I recently noticed that, if I want to write a do loop or do a %let statement while on server, it does not work, and it seems that SAS simply ignores the line.
* sign on WRDS server;
rsubmit;
%do i = 1980 %to 2000;
data a_&i;
set ...;
run;
%end;
endrsubmit;
log does not produce any line for that issue, it simply returns an error becasue a_i& is not resolved. The same thing happens if I want to use %let on the server. Is there a way that I can run such macro statements on the server? Or is there anything run with the code?
I am familiar with %syslput but somehow cannot figure how to use it with the %do loop.
Thanks a lot,
On top of what @Reeza wrote you need also to be quite carefule how you implement your macro code if combined with rsubmit in regards of timing. If you get it wrong then the macro compiler will resolve your macro stuff before the rsubmit gets executed resulting in the macro stuff being executed on your local machine even though you have it within the rsubmit block in your code.
http://support.sas.com/kb/23/986.html
Macro code needs to generally be embedded in a macro. The code you posted will not work on a desktop either, you need working code in general first. Basically, your errors have nothing to do with being run on a server.
%macro print_loop_useless();
%do i=1 %to 100;
proc print data=sashelp.cars(obs=&i);
run;
%end;
%mend;
%print_loop_useless();
On top of what @Reeza wrote you need also to be quite carefule how you implement your macro code if combined with rsubmit in regards of timing. If you get it wrong then the macro compiler will resolve your macro stuff before the rsubmit gets executed resulting in the macro stuff being executed on your local machine even though you have it within the rsubmit block in your code.
http://support.sas.com/kb/23/986.html
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.