DATA Step, Macro, Functions and more

Macro resolution on remote server

Reply
Super Contributor
Posts: 673

Macro resolution on remote server

Hi,
I upload data from PC session to Mainframe.The dataset name changes everymonth based on the datevalue that is created in the preceeding steps.
Say for instance for current month the dataset to be uploaded is TMP1012.
Next month it becomes TMP1101.I use a macro variable TMP&value.But it doesnt seem to resolve.I know %sysrput will do the work.But i dont know how to use it.
Super User
Posts: 3,252

Re: Macro resolution on remote server

It's not clear from your explanation if you are defining a macro variable on your PC and want it to resolve on the mainframe or vice versa. If it is the first case then you need to use %SYSRPUT on your PC (having already signed on to your mainframe SAS session):

%let local_var = example;

%SYSRPUT remote_var = &local_var / remote = sessionid;

The macro variable remote_var should then resolve in your mainframe session.
SAS Employee
Posts: 58

Re: Macro resolution on remote server

Here's an excerpt from the doc. Hope this helps.

The %SYSRPUT statement is submitted with SAS/CONNECT to a remote host to retrieve the value of a macro variable stored on the remote host. %SYSRPUT assigns that value to a macro variable on the local host. %SYSRPUT is similar to the %LET macro statement because it assigns a value to a macro variable. However, %SYSRPUT assigns a value to a variable on the local host, not on the remote host where the statement is processed. The %SYSRPUT statement places the macro variable into the global symbol table in the client session.
Ask a Question
Discussion stats
  • 2 replies
  • 131 views
  • 0 likes
  • 3 in conversation