session

endSession

Description

Ends the current session. This action terminates the connection to the CAS server, releasing all resources associated with the session.

session.endSession <result=results> <status=rc>;
Data Preparation View data prep sheet
Session Initialization

Establish a CAS session to be subsequently terminated.

Copied!
1cas mySession sessopts=(caslib=casuser);

Examples

Ends the currently active CAS session.

SAS® / CAS Code Code awaiting community validation
Copied!
1PROC CAS;
2 SESSION.endSession;
3RUN;
Result :
The current CAS session is terminated.

Retrieves the current session ID to confirm identity before terminating the session.

SAS® / CAS Code Code awaiting community validation
Copied!
1PROC CAS;
2 SESSION.sessionId RESULT=r;
3 PRINT "Ending Session ID: " || r.uuid;
4 SESSION.endSession;
5RUN;
Result :
The session UUID is printed to the log, followed by the termination of the session.

FAQ

What is the purpose of the endSession action?
Which action set does the endSession action belong to?
What is the CASL syntax for the endSession action?
Does the endSession action require any parameters?

Associated Scenarios

Use Case
Standard Cleanup After Nightly Batch Processing

A marketing department runs an automated nightly batch to score customer leads. Once the scoring is complete and results are exported, the system must explicitly terminate the C...

Use Case
Performance: Resource Release After High-Memory Operations

In a Fraud Detection scenario, huge transaction history tables are loaded into memory for real-time model training. The test ensures that invoking endSession immediately followi...

Use Case
Edge Case: Syntax Validation with Optional Parameters

An IT Admin acts as an orchestrator for multiple analytical jobs. They need to develop a robust wrapper script that terminates sessions but also captures the operation's status ...