I'm trying to run the following piece of code:
%let abc_unix = &sd_exports.;
%sysrput abc_unix = &abc_unix.;
LIBNAME abc "&abc_unix.";
I get the error " %SYSRPUT statement is valid only when OPTION DMR is in effect.".
What should I be adding to get this to run successfully?
DMR option is not set, which means it's:
NODMR
disables you from invoking a remote SAS session.
If it's set this way, you can't push your macro variable to the remote session, because you can't connect to it.
http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000279080.htm
@astha8882000 wrote:
I'm trying to run the following piece of code:
%let abc_unix = &sd_exports.;
%sysrput abc_unix = &abc_unix.;
LIBNAME abc "&abc_unix.";
I get the error " %SYSRPUT statement is valid only when OPTION DMR is in effect.".
What should I be adding to get this to run successfully?
Got it, thanks. What can I add to make that work?
I tried doing this:
%let abc_unix = &sd_exports.;
%nrstr(%sysrput abc_unix = &abc_unix.);
LIBNAME abc "&abc_unix.";
that gave me the error: Statement is not valid or it is used out of proper order.
Then I did this:
%let abc_unix = &sd_exports.;
%nrstr(%%)sysrput abc_unix = &abc_unix.;
LIBNAME abc "&abc_unix.";
that gave me this error: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred.
ERROR 180-322: Statement is not valid or it is used out of proper order.
Do you want SYSLPUT instead of RPUT?
RPUT moves macro variables from the Remote server to local.
LPUT moves macro variables from the Local to the server.
@astha8882000 wrote:
I tried doing that too, that didn't help either:
%let abc_unix = &sd_exports. rsubmit; %sysrput abc_unix = &abc_unix.; endrsubmit; LIBNAME abc "&abc_unix.";
I get the following error: ERROR: The text expression &abc_UNIX. contains a recursive reference to the macro variable abc_UNIX. The macro variable will be assigned the null value.
Your first line sets the local macro variable ABC_UNIX to the value of the macro variable SD_EXPORTS. Assuming that you actually ended the %LET statement with a semi-colon.
Your next three lines form a remote submit block that is attempting to recursively define a macro variable ABC_UNIX in the remote session. It has nothing to do with the other lines at all.
So effectively you ran these two lines.
%let abc_unix = &sd_exports. ;
LIBNAME abc "&abc_unix.";
What is it that you actual WANT to do?
Perhaps something like this?
rsignon;
%syslput abc_unix = &sd_exports.;
rsubmit;
LIBNAME abc "&abc_unix.";
endrsubmit;
Or something else?
%sysrput abc_unix = &abc_unix.;--this will start reading from server into the target folder
No, it will create a macro variable with that value on the remote server. Nothing is moved or read, you only create a macro variable.
@astha8882000 wrote:
I'm trying to run the following piece of code:
%let abc_unix = &sd_exports.;
%sysrput abc_unix = &abc_unix.;
LIBNAME abc "&abc_unix.";
I get the error " %SYSRPUT statement is valid only when OPTION DMR is in effect.".
What should I be adding to get this to run successfully?
%SYSRPUT runs on the REMOTE session.
That code would make more sense it you included the first two lines in an RSUBMIT block.
rsubmit;
%let abc_unix = &sd_exports.;
%sysrput abc_unix = &abc_unix.;
endrsubmit;
LIBNAME abc "&abc_unix.";
If you don't have a remote session running you cannot do ANYTHING on the non-existent remote session.
How are you creating the remote session? Normally I would use signon command to start a remote session. I would know the NAME of the remote session. What is the name of the remote session you are trying to reference?
You can create a local libref that points to remote location without creating any macro variables on the remote session.
libname mylib remote "path on remote" server=remotname ;
This code worked fine for me (you may need to add SIGNON options):
signon;
rsubmit;
%let abc_unix = Just Testing;
%sysrput abc_unix = &abc_unix.;
endrsubmit;
%put abc_unix = &abc_unix.;
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.