The OLAPOPERATE procedure was introduced in SAS 9.2 as a way to interact with the SAS® OLAP Server in a batch or code-based environment. The procedure enables users to list active sessions or queries and to determine which sessions have data that is actively being displayed. The procedure also enables an administrative user to terminate a session based on an session's ID value.
Often, you need to terminate all sessions that are querying a particular OLAP cube in your environment. To do this, you would need to determine the IDs of the sessions using the LIST SESSION CUBE=<cube name>;
statement. This statement writes the IDs to the SAS log. You would then need to use CLOSE SESSION ID=<id value>;
to terminate each session.
The macro code included on the Full Code tab in this sample demonstrates how to accomplish this task in a batch environment by using the PRINTTO procedure and some DATA step code.
An example of calling this macro is:
%CLOSE_SESSIONS(logfile=c:\mysaslog.log, host=localhost, port=5451,
userid=sasadm@saspw, password=sasadm1, cube=OrionStar);
|
The macro takes six parameters, which are explained in the following table.
Parameter name | Description | Default value |
---|---|---|
logfile | The location in which to write the SAS log referenced in the PRINTTO procedure. | out.log |
host | The machine name or IP address on which your SAS OLAP Server is running. | localhost |
port | The port number on which your SAS OLAP Server is running. | 5451 |
userid | An account that has the Administer permission on the application server, and ReadMetadata permission on the repository. | sasadm@saspw |
password | The password for the administrative account. | sasadm1 |
cube | The cube name for which to stop the SAS OLAP Server sessions. Use _ALL_ to close any active sessions on the server. | _ALL_ |
For more information, see The OLAPOPERATE Procedure in the SAS 9.2 OLAP Server: User's Guide.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
%MACRO CLOSE_SESSIONS(logfile=out.log, host=localhost, port=5451, userid=sasadm@saspw, password=sasadm1, cube=_ALL_);
FILENAME outlog "&logfile";
PROC PRINTTO LOG="&logfile" NEW;
RUN;
PROC OLAPOPERATE;
CONNECT HOST="&host" PORT=&port USERID="&userid" PASSWORD="&password";
%if &CUBE = _ALL_ %then %do;
LIST SESSIONS;
%end;
%else %do;
LIST SESSIONS CUBE="&cube";
%end;
RUN;
PROC PRINTTO LOG=log;
RUN;
DATA SESSIONS (KEEP=ID);
INFILE outlog TRUNCOVER;
LENGTH text $256 ID $71;
RETAIN count 0;
CALL SYMPUT('n',count);
INPUT text $ &;
IF SUBSTR(text,1,10) = "Session ID" THEN DO;
id = SCAN(text,3,' ');
count + 1;
CALL SYMPUT('n',count);
OUTPUT;
END;
RUN;
%DO i = 1 %TO &n;
DATA _NULL_;
SET SESSIONS (FIRSTOBS=&i OBS=&i);
CALL SYMPUT('id',id);
RUN;
PROC OLAPOPERATE;
CONNECT HOST="&host" PORT=&port USERID="&userid" PASSWORD="&password";
CLOSE SESSION "&id";
RUN;
%END;
DATA _NULL_;
sessioncount = strip("&n");
PUT "NOTE: " sessioncount " SAS OLAP Server sessions were closed.";
RUN;
%MEND;
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
Type: | Sample |
Topic: | Data Management ==> Data Sources ==> Cubes System Administration ==> Servers ==> OLAP SAS Reference ==> Macro |
Date Modified: | 2010-02-17 14:09:32 |
Date Created: | 2010-02-05 09:51:07 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | SAS OLAP Server | Solaris for x64 | 9.2 TS2M0 | |
OpenVMS on HP Integrity | 9.2 TS2M0 | |||
Linux | 9.2 TS2M0 | |||
HP-UX IPF | 9.2 TS2M0 | |||
64-bit Enabled Solaris | 9.2 TS2M0 | |||
64-bit Enabled HP-UX | 9.2 TS2M0 | |||
64-bit Enabled AIX | 9.2 TS2M0 | |||
Windows Vista | 9.2 TS2M0 | |||
Microsoft Windows XP Professional | 9.2 TS2M0 | |||
Microsoft Windows Server 2003 Standard Edition | 9.2 TS2M0 | |||
Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS2M0 | |||
Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS2M0 | |||
Microsoft® Windows® for x64 | 9.2 TS2M0 | |||
Microsoft Windows XP 64-bit Edition | 9.2 TS2M0 | |||
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS2M0 | |||
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS2M0 | |||
Linux for x64 | 9.2 TS2M0 | |||
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS2M0 | |||
z/OS | 9.2 TS2M0 |