- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
In EG i can per program choose either Local (windows machine with SAS EG) or SASapp (unix server with SAS running) to run the sas code.
I can use File Copy task to copy a file between the two. But then I need to "hardcode" the same path in TWO programs (one running on SASApp and one running on local).
If the project is shared between users i must make sure all users have access to that folder to transfer a file SASapp <-> local. To get around this i want it to be dynamic. Ideally i would like to copy a dataset between SASapp WORK and Local WORK, (ie %sysfunc(pathname(work,L)) evaluated on respective machine). But then SASApp need to know the path to WORK on the Local machine.
Can i set a macro variable on SASApp and then transfer that value to the local session somehow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If you are copying data sets, look at the Upload SAS Data Sets and Download SAS Data Sets tasks. These can copy SAS data set files from a remote SAS library to a local PC folder, or vice versa.
If these are just general files, I can't think of a clean way of doing what you want (copy macro values from local session to remote). I can think of one very messy way though.
- On Local SAS, run a SAS program that writes out current macro var values of interest to a local file (maybe even as a program, with %LET statements).
- Use Copy Files task to transfer that file to your remote SAS session (SASApp).
- On SASApp, run a program to %include the file you just copied. Now you have these macro variables in your session.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Here's a similar example of saving and restoring macro vars (which wouldn't actually handle long values, but could be adapted for your need): https://support.sas.com/kb/46/300.html
If you do it a lot, you can imagine writing macros %SaveMacroVars(out=/*output dataset name*/,mvars=/*list of macro vars to save*/) and %RestoreMacroVars(data=/*name of dataset previously created by %SaveMacroVars*/).
Next up: SAS Trivia Quiz hosted by SAS on Wednesday May 21.
Register now at https://www.basug.org/events.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I think @invalid was looking to grab just the one value (path to WORK). But if I follow @Quentin down the path of over-engineering, then you could just use the Download Data Set task to "download" SASHELP.VMACRO to a sas7bdat, then use Upload SAS Data Set to copy to any library on your remote server.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks all for the input.
If the code fails i don't want large file to be orphaned in the users personal folder. That is why i want to transfer it to work directly.
It seems the best solution is:
- On local write macrovars with path to Local work to file
- Transfer file to SASapp (make sure it's to somewhere where all users have access, ie a personal folder)
- Read in file with macrovar on SASapp
- Remove file on SASapp to clean up their personal folder
- Transfer large data file from SASapp to Local PC work
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Have you tried SYSRPUT or SYSLPUT?
SYSLPUT looks appropriate in this case:
You can choose which session to pass the macro variable to, if you have multiple open using the REMOTE session ID and REMOTE option.
@invalid wrote:
In EG i can per program choose either Local (windows machine with SAS EG) or SASapp (unix server with SAS running) to run the sas code.
I can use File Copy task to copy a file between the two. But then I need to "hardcode" the same path in TWO programs (one running on SASApp and one running on local).
If the project is shared between users i must make sure all users have access to that folder to transfer a file SASapp <-> local. To get around this i want it to be dynamic. Ideally i would like to copy a dataset between SASapp WORK and Local WORK, (ie %sysfunc(pathname(work,L)) evaluated on respective machine). But then SASApp need to know the path to WORK on the Local machine.
Can i set a macro variable on SASApp and then transfer that value to the local session somehow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
SYSRPUT and SYSLPUT apply to SAS/CONNECT -- when you have two SAS sessions talking directly to each other. That's SAS <--> SAS.
But with your typical EG setup, you don't have SAS/CONNECT in the middle. It's EG connecting to your local SAS, and EG connecting to your remote SAS. EG uses SAS Integration Technologies for this work. SAS Integration Technologies supports [any client]<-->SAS, where [any client] might be EG, SAS Add-In for MS Office, SAS DI Studio, etc.