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
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: