Hi all
Using SAS EG with SAS9.3 under Windows Server is there any way to run a stored process out of EG which defines a library (a libname statement) and then have this libref available in the EG session?
In real life:
I want to implement a process for SAS Forecast Studio users where I need to give the users an option to re-direct a library (libref) to another folder. This will allow the users to create forecasts on versions of the same tables with different data for "what-if" analysis (scenario planning).
In my understanding both SAS Forecast Studio and EG spawn their sessions via object spawner so I would assume if there is a solution in EG I can use the same approach for Forecast Studio. In Forecast Studio the only way to execute user written SAS code is via a stored process.
I have some ideas how I could solve the problem differently (like defining the libref in the autoexec based on some table entry or existence of a token file) so I'm not after alternative solutions.
Is it possible to somehow "connect" the 2 sessions? Any ideas greatly appreciated. - Or you just confirm my "fear" that this can't be done and I must be looking for another approach.
Thanks
Patrick
This just to share the approach I'm now taking:
- There will be a stored process in Forecast Studio which allows to create "simulation" data sets stored in user specific locations (folders will be created by the stored process).
- There will be some logic in the autoexec which scans the user specific locations and assigns libraries if simulation data sets have been created.
- These user specific libraries will be available both in SAS EG and SAS Forecast Studio (after re-connecting to the server and so re-executing the autoexec).
...and sorry to mark my own post as the correct answer. I just want to indicate that this thread doesn't need any further contributions as I found a way of how to solve the problem.
I don't have code any for this, but you could specify a libref by reading the path from a text file (that has your libref path). Since you can read in the file from EG and from the server, you should be able to create your libref in both places.
If you need more than that, I can look at getting you a code sample.
Hi Ben
The challenge I'm facing is that I need to define the libref as part of a stored process but that I then need this new libref available in the session used to submit this stored process.
For example using EG assume I'm having a stored process with the following code:
libname test (sashelp);
What I would like to do is to execute this stored process via EG and then have the libref "test" available in my EG session.
Thanks
Patrick
I believe this approach will work (this is for Unix but should work similarly for Windows).
Hopefully this helps.
Hi Ben
Sorry but I believe you're missing the point here. A SAS Stored Process runs in it's own session so whatever I'm doing there doesn't alter the parent session from where I kick off the stored process - but that's what I'm after: A way to define a libref in a stored process which then is available within the parent session (so an EG session for example). I can't run any additional code in the parent session as Forecast Studio only allows me to run custom code as stored process (except for start-up/shut-down code - but that's not in the place in the process where I need the libname executed).
So what I'm after is to give Forecast Studio users a possibility to point a libref to another folder (within Forecast Studio a prompt where they can choose the folder and then executing a libname using this path).
Thanks
Patrick
This just to share the approach I'm now taking:
- There will be a stored process in Forecast Studio which allows to create "simulation" data sets stored in user specific locations (folders will be created by the stored process).
- There will be some logic in the autoexec which scans the user specific locations and assigns libraries if simulation data sets have been created.
- These user specific libraries will be available both in SAS EG and SAS Forecast Studio (after re-connecting to the server and so re-executing the autoexec).
...and sorry to mark my own post as the correct answer. I just want to indicate that this thread doesn't need any further contributions as I found a way of how to solve the problem.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.