BookmarkSubscribeRSS Feed
astha8882000
Obsidian | Level 7

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?

16 REPLIES 16
Reeza
Super User

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?


 

 

 

astha8882000
Obsidian | Level 7

Got it, thanks. What can I add to make that work?

 

astha8882000
Obsidian | Level 7

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.

astha8882000
Obsidian | Level 7
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.
Reeza
Super User

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
Obsidian | Level 7
It's definitely rput because I need to read a dataset from that remote server.
Tom
Super User Tom
Super User

@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?

astha8882000
Obsidian | Level 7
So this was my original code and mentioned with the code lines is what my aim was:

%let abc_unix = &sd_exports.; //this is the target folder

%sysrput abc_unix = &abc_unix.;--this will start reading from server into the target folder

LIBNAME abc "&abc_unix."; this will create a libref to that target folder
Reeza
Super User

%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. 

 

 

Tom
Super User Tom
Super User

@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.";
astha8882000
Obsidian | Level 7
I tried that, it gave me the following error:

ERROR: Invalid or unspecified remote session ID. Set OPTIONS REMOTE=session_id.
NOTE: Subsequent lines will be ignored until ENDRSUBMIT.
ERROR: Remote submit to UNKNOWN canceled.
Tom
Super User Tom
Super User

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 ;
SASKiwi
PROC Star

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.; 
astha8882000
Obsidian | Level 7
I tried this and got the error:

ERROR: Invalid or unspecified remote session ID. Set OPTIONS REMOTE=session_id.
ERROR: Remote signon to UNKNOWN canceled.
25
26 rsubmit;
ERROR: Invalid or unspecified remote session ID. Set OPTIONS REMOTE=session_id.
NOTE: Subsequent lines will be ignored until ENDRSUBMIT.
ERROR: Remote submit to UNKNOWN canceled.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 16 replies
  • 1456 views
  • 0 likes
  • 5 in conversation