A session saves all global macro variables whose names
begin with SAVE_. For example, the following statements cause the
macro variable
save_mytext
to be available
in subsequent stored processes that share the same session:
%global save_mytext;
%let save_mytext="Text to be saved
for the life of the session";
Data sets and catalogs
can also be saved across program requests using the SAVE library.
Data sets and catalogs that are created in or copied to this library
are available to all future stored processes that execute in the same
session.
Creating a session causes
the automatic variables _THISSESSION and _SESSIONID to be set. Sample
values for these variables are as follows:
%let rc=%sysfunc(stpsrv_session(create));
%put _SESSIONID=&_SESSIONID;
_SESSIONID=7CF645EB-6E23-4853-8042-BBEA7F866B55
%put _THISSESSION=&_THISSESSION;
_THISSESSION=/SASStoredProcess/do?_sessionid=
7CF645EB-6E23-4853-8042-BBEA7F866B55
These variables can
be used to construct URLs or HTML forms that execute another stored
process in the same session. For example:
%let rc=%sysfunc(stpsrv_session(create));
data _null;
file _webout;
put '<HTML>';
put '<BODY>';
put '<H1>Session Test Page</H1>';
/* Link to another stored process in the same session */
put '<A HREF="' "&_THISSESSION"
'&_PROGRAM=/Test/Test2">Test</A>';
put '</BODY>';
put '</HTML>';
run;
Note: The _THISSESSION variable
is not identical to the _THISSESSION variable that is used in
SAS/IntrNet.
If you are converting an existing
SAS/IntrNet program to a stored
process, any references to
symget('_THISSESSION')
should generally be replaced with
"&_THISSESSION"
.
For more information, see Converting SAS/IntrNet Programs to SAS Stored Processes.