BookmarkSubscribeRSS Feed
anlynch
Calcite | Level 5

hi, so i have been struggling with this for a little while.

i have a sas file that has a bunch of macros in it, which i would like to execute on a remote server. portions of those need to execute on my local pc sas (mainly proc exports).

so for example:

%include 'some file';

%macro1(var1,var2,var3);

what i need is to include var1 within a macro that is executed both remotely and locally. i have been trying to get %syslput and %sysrput to work for me, but its just not happening.

any help would be greatly appreciated.

6 REPLIES 6
art297
Opal | Level 21

I'm not suggesting that this paper has your answer, but it might: http://www2.sas.com/proceedings/sugi30/224-30.pdf

Regardless, it is worth the short time it will take to read it.

RichardinOz
Quartz | Level 8

Have you tried running SAS Connect in "reverse"?  That is where the server becomes the client for a remote session on what you currently regard as your local machine.  You would then have 2 sessions on your PC and could control the exports by nesting rsubmits:

Local1 => rsubmit to server running main extract and analysis => rsubmit and upload to Local2 for export

Just a thought

Richard in Oz

TimArm
Obsidian | Level 7

I've struggled with this too.

Going from my Windows client to my AIX server a simple:

  %syslput msg1=&msg1.;

   rsubmit;

   ...

   endrsubmit;

works to define the variable msg1 in the remote session.

However, coming back the other way I find it does not work unless I do this:

    rsubmit;

    %nrstr(%sysrput rmtuser=&sysuserid);

    endrsubmit;

I don't know why that %nrstr makes a difference, but it seems to!

anlynch
Calcite | Level 5

Ok, so I think that I at least understand the premise of what is going on... a follow up question though.

in my 'macro' file, i have sever proc exports... i would like to execute everything on the server with the exception of the proc export itself, so this would need to be executed locally.

so basically the file would like something like

%macro test(variables);

some sas code;

proc export;

some more sas code;

%mend test;

i tried to do this:

%macro test(variables);

some sas code;

endrsubmit;

proc export;

rsubmit remote=server;

some more sas code;

%mend test;

but that does't seem to be working

Tom
Super User Tom
Super User

Why not run the macro on the LOCAL machine?  Then your macro definition becomes:

%macro test(variables);

rsubmit;

   some sas code;

    Perhaps a PROC DOWNLOAD.

endrsubmit;

proc export;

...

rsubmit;

    Perhaps a PROC UPLOAD.

   some more sas code;

endrsubmit;

%mend test;

anlynch
Calcite | Level 5

That's essentially what I am doing... however, the macro is located in another file.

so i %include the macro(s) file and then call the macros from the other program.

so my macro (in the external file) would look something like this:

%macro test;

rsubmit server="server";

data make_ds;

set ds2;

run;

endrsubmit;

%mend test;

this then throws an error:

connection to "server" does not exist. you must establish  a connection by issuing the signon with the server=option or setting the global autosignon option.

remote submit to "server" canceled.

and then sas hangs with "remote processing in progress"

so i tried to add the signon="sever" option to the macro, which presented me with a window to fill out some credentials, and eventually told me that the SAS/CONNECT Server name should be a quoted string.

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
  • 6 replies
  • 2261 views
  • 3 likes
  • 5 in conversation