Where is the _sessionid?

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 11
Accepted Solution

Where is the _sessionid?

Where Can I found the _sessionid?

Who does use the session? How?

Thanks


Accepted Solutions
Solution
‎06-12-2015 04:30 AM
Esteemed Advisor
Posts: 6,721

Re: Where is the _sessionid?

In the context of SAS, "session" may refer to:

- a single batch job run.

- starting SAS in Display Manager mode, doing some work, and closing it.

- starting Enterprise Guide, doing something, closing it (session in the metadata conext)

- within Enterprise Guide, start a Workspace server, working with it, terminating the connection

- what you do between logging on to Web Report Studio and logging off

- calling a single stored process

- calling several stored processes connected by a STP session (that is where _sessionid is used)

- anything that anyone declares a session with a custom built webapp

I guess others could supply additional meanings of session within the "SAS world"

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers

View solution in original post


All Replies
Esteemed Advisor
Posts: 6,721

Re: Where is the _sessionid?

_SESSIONID is a global macro variable available to a stored process when a session has been defined. It is only available for STPs that run on the Stored Process Server.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 11

Re: Where is the _sessionid?

Thank you.

But I need to know some information in particulary:

What is a session?

Who does use a session? And why?

Esteemed Advisor
Posts: 6,721

Re: Where is the _sessionid?

Since HTTP is a stateless protocol, some mechanism must be used to identify a group of HTTP requests as related. Some methods use cookies, others use parameters in the URL. This then combines several requests into a session.

SAS STP use the latter method.

So, a session is "used" by a user on the web to make several requests to a web resource that relate to each other, and where the web server needs to "remember" data from request to request.

IE your presence here is also a "session", where the session is kept track of by cookies.

The SAS Stored Process Developer's Guide (http://support.sas.com/documentation/cdl/en/stpug/67499/PDF/default/stpug.pdf) has a nice example of a simple webapp that uses the session device.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 11

Re: Where is the _sessionid?

thank you very much.

But in this paper and as you tell me, you mean that "Sas session" is only for Web?

Beacause I mean Sas session in general, not for Web

Esteemed Advisor
Posts: 6,721

Re: Where is the _sessionid?

Well, you were specifically asking about _sessionid, which is used only to designate sessions in stored processes.

"SAS session" is a phrase used in many different contexts, so you need to be more precise here.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 11

Re: Where is the _sessionid?

Of course, but so _sesionid is used only for processes with Web? Or stored processes are used also without Web?

I need to know what is a sas session in each possible context.

thanks

Solution
‎06-12-2015 04:30 AM
Esteemed Advisor
Posts: 6,721

Re: Where is the _sessionid?

In the context of SAS, "session" may refer to:

- a single batch job run.

- starting SAS in Display Manager mode, doing some work, and closing it.

- starting Enterprise Guide, doing something, closing it (session in the metadata conext)

- within Enterprise Guide, start a Workspace server, working with it, terminating the connection

- what you do between logging on to Web Report Studio and logging off

- calling a single stored process

- calling several stored processes connected by a STP session (that is where _sessionid is used)

- anything that anyone declares a session with a custom built webapp

I guess others could supply additional meanings of session within the "SAS world"

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 11

Re: Where is the _sessionid?

thank you very much.

I agree with you.

I'm fouding some way to allow to have in a new session, a few passed sessions but without launching a saved programme.

So I can use CFG options and files, or I can also use stored processes?

Esteemed Advisor
Posts: 6,721

Re: Where is the _sessionid?

"I'm fouding some way to allow to have in a new session, a few passed sessions but without launching a saved programme."

Does not compute. Please rephrase.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 11

Re: Where is the _sessionid?

I know, it may seem strange.

I need a way to allow the previous sessions remain "saved" in a new session. For example when I open the program SAS, there are already contents in it from previous sessions, without having to launch a code saved.

Esteemed Advisor
Posts: 6,721

Re: Where is the _sessionid?

For a normal (non-STP) session, this is very hard to do, and not solved with a standard option or tool.

You would need to save your current state to a permanent file or dataset, and have your autoexec.sas use that to recreate the current state.

By definition, the contents of the WORK library will always be lost.

It is better to design a standard environment and create that by modifying/expanding the autoexec.sas.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 11

Re: Where is the _sessionid?

thank you very much. I have imagined this problem.

But in a STP session is possible and easier than a normal session?

Permanent file and dataset you mean sas code. Or dataset in a folder, right?

_SESSIONID is a macro variable, then it is saved in the SASMACR library, right?


☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 12 replies
  • 1286 views
  • 0 likes
  • 2 in conversation