BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.

Hi All,

I've started playing with sessions, ie. stpsrv_session(create) and have a few basic questions:

1.  When I create a session, am I really keeping that SAS session alive and occupied for the entire time of the session (so that I can "reconnect" to it)?  Or am I just creating an index (&_sessionid) which will allow me to save some datasets/macro vars so that they can be re-used?

Put differently, suppose we have a stored process server which has 5 pooled sessions available to users.  So when a user runs a normal stored process, the job runs, and I assume at the end the SAS session is (in effect) cleaned up, so that it can be used by the next user.  If I have a stored process that creates a 10 minute session, will it truly hold onto one of those 5 sessions for 10 minutes?   Or does does the stored process which creates the session run as usual, but it creates the SAVE library (and directory).  So if the stored process runs in 1 second it will only use of one of the 5 sessions for 1 second.  Then after 9 minutes if a user clicks a drill-down link they could get any of the 5 SAS sessions, and any of them could access the SAVE library because the directory/files are still there at the OS file structure.

2. Why can't I easily save everything?

If the answer to #1 is that I'm truly holding onto the same SAS session for 10 minutes, then I would think it would be easy to just let me save EVERYTHING about a session (all work datasets, format catalogs, macro vars, macro definitions, etc.).  Since I can only save datasets and macro variables, and have to put datasets in a separate SAVE library, I'm assuming the answer to #1 is that when I get a &_sessionID I'm really just getting an index which is useful for looking up datasets / macro vars.

3.  Where are &SAVE_ macro variables stored?

If the answer to #1 is that I'm truly holding onto the same SAS session for 10 minutes, then they could be stored in the usual global symbol table (wherever that is). But if the answer is that I'm really just creating an index which will allow me to re-use some macro variables, I would expect the &save_ variables might be written somewhere I could see them in the OS file structure.  Or perhaps for the stored process server there is just one monstrous symbol table which is available to all SAS sessions, and the symbol table itself is indexed by session ID.

Thx,

--Q.

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
1 ACCEPTED SOLUTION

Accepted Solutions
DonH
Lapis Lazuli | Level 10

Quentin, let me take a shot at your questions.

For question 1, the current SAS executive (or session as you refer to it) is NOT left open. As you surmised, SAS is basically saving information from your request so it can be restored in your next one. So, yes, the sessionid is used to provide the pointer so SAS knows what information to restore.

WRT question 2, see question 1.

And finally for question 3, that information is saved in a SAS data library (creating a session creates the SAVE data library even if you don't use it directly). And SAS keeps that around for the timeout period so that if you don't reconnect to the session before the timeout period, the library (i.e., the OS directory) is deleted.

Please check out my blog entries for February. 2010 for an overview of sessions.

And you can also try out my examples on sessions for my SAS/IntrNet book. Just select the Chapter 10 link:

Samples - Building Web Applications with SAS/IntrNet©: A Guide to the Application Dispatcher

while this is the SAS/IntrNet Application Dispatcher, the BI Stored Process Server works pretty much the same way.

View solution in original post

2 REPLIES 2
DonH
Lapis Lazuli | Level 10

Quentin, let me take a shot at your questions.

For question 1, the current SAS executive (or session as you refer to it) is NOT left open. As you surmised, SAS is basically saving information from your request so it can be restored in your next one. So, yes, the sessionid is used to provide the pointer so SAS knows what information to restore.

WRT question 2, see question 1.

And finally for question 3, that information is saved in a SAS data library (creating a session creates the SAVE data library even if you don't use it directly). And SAS keeps that around for the timeout period so that if you don't reconnect to the session before the timeout period, the library (i.e., the OS directory) is deleted.

Please check out my blog entries for February. 2010 for an overview of sessions.

And you can also try out my examples on sessions for my SAS/IntrNet book. Just select the Chapter 10 link:

Samples - Building Web Applications with SAS/IntrNet©: A Guide to the Application Dispatcher

while this is the SAS/IntrNet Application Dispatcher, the BI Stored Process Server works pretty much the same way.

Quentin
Super User

Thanks Much Don,

Helpful information as always.  I'll have to look again in the directory created for the SAVE library to see if I can find a file holding saved macro vars.  Your book was VERY helpful as I took this first dive into sessions, not only for the explanation but also the macro utilities!

-Q.

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.

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
  • 2 replies
  • 1869 views
  • 0 likes
  • 2 in conversation