SIGNOFF Command and Statement

Ends the connection between a client session and a server session.
Valid in: Client session

Syntax

SIGNOFF <options> ;

Optional Arguments

_ALL_
ends all client/server connections sequentially, starting with the first server session that you signed on to.
If a script file was used for sign-on, and if a URL or FTP are not used to access the sign-on script, the sign-on script file will be used to perform the sign-off. For information about the URL and FTP options in the FILENAME statement, see FILENAME Statement and Command .
If the CMACVAR= option was specified in the SIGNON statement, but not in the SIGNOFF _ALL_ statement, the macro variable will be updated during the execution of SIGNOFF _ALL_.
Here are the values for the CMACVAR= option for individual task IDs during sign-off:
0 indicates that the sign-off was successful.
1 indicates that the sign-off failed.
If the CMACVAR= option is specified in the SIGNOFF _ALL_ statement, only that macro variable is updated. Any macro variables that were specified in the SIGNON statement will be ignored. Here are the values for the CMACVAR= option that are specified in SIGNOFF _ALL_:
0 indicates that all sign-offs were successful.
1 indicates that at least one sign-off failed.
CMACVAR=value
specifies the name of the macro variable to associate with the sign-off. Except for this condition, the macro variable is set after the SIGNOFF command is completed.
Note: If the SIGNOFF command fails because of incorrect syntax, the macro variable is not set.
Here are the values for the CMACVAR= option:
0 indicates that the sign-off was successful.
1 indicates that the sign-off failed.
2 indicates that the sign-off was unnecessary.
If the CMACVAR= option is specified in the SIGNOFF _ALL_ statement, only that macro variable is updated.
Here are the values for the CMACVAR= option that are specified in SIGNOFF _ALL_:
0 indicates that all sign-offs were successful.
1 indicates that at least one sign-off failed.
Alias:MACVAR=
CONNECTREMOTE=server-ID
server-ID
specifies the name of the server session that you want to sign off from. If only one session is active, server-ID can be omitted. If multiple server sessions are active, omitting this option signs off the most recently accessed server session. You can find out which server session is current by examining the value assigned to the CONNECTREMOTE= system option.
Alias:CREMOTE=, REMOTE=, PROCESS=
CSCRIPT=fileref| 'filespec'
specifies the script file to be used during sign-off. CSCRIPT can be specified as a fileref or a fully qualified pathname that is enclosed in parenthesis. If multiple CSCRIPT= options are specified, the last specification takes precedence.
fileref
is the name of the reference file that is associated with the script that ends the connection. A previously executed FILENAME statement must define the fileref.
If the fileref that you define for the script is the default fileref RLINK, you can omit this specification from the SIGNOFF command.
You might use the same script to start and end a connection. If you use one script to start and end a connection, assign only one fileref.
'filespec'
is the name of the SAS/CONNECT script that you want to execute. If you have not defined a fileref for the script that you want to execute, use the filespec in the SIGNOFF command. The filespec can be either a fully qualified filename or the name of a file in the current working directory.
Do not specify both a fileref and a filespec.
Alias:SCRIPT=
NOCSCRIPT
specifies that no SAS/CONNECT script should be used for sign-off. NOCSCRIPT is useful if you have defined the RLINK fileref but do not want to use it during sign-off. NOCSCRIPT accelerates sign-off and saves memory resources.
Alias:NOSCRIPT

Details

The SIGNOFF command and the SIGNOFF statement end a connection between a client and a server session, and execute a script if you are using an access method that requires a script file. You can issue the SIGNOFF command from the command line in any client SAS windowing environment window or in a DM statement. You can also issue a SIGNOFF statement from the client session, which is especially useful for interactive line mode sessions or non-interactive jobs.

Examples

Example 1: Setting a Macro Variable at Sign-on Checks for Sign-off Failure

In this example, a macro variable is assigned at sign-on. Therefore, if the sign-off fails, the macro variable will be set for this server session.
   /* Sign-on successful, rhost1 will be  */
   /* set to 0 to indicate success, and       */
   /* macro variable rhost1 is now           */
   /* associated with this server                */
   /* session.                                                     */
signon rhost cmacvar=rhost1;
   /* Sign-off will fail, and rhost2           */
   /* will be set to 1 to indicate this,         */
   /* but because it was unsuccessful,     */
   /* rhost1 is still the default macro      */
   /* variable associated with this           */
   /* server session.                                      */
signoff rhost cmacvar=rhost2
   cscript='noexist.scr';

Example 2: Not Setting a Macro Variable at Sign-on Does Not Check for Sign-off Failure

In this example, a macro variable is not assigned at sign-on. Therefore, if the sign-off fails, the macro variable will not be set for this server session.
   /* No macro variable associated with  */
   /* server session                                          */
signon rhost;
   /* Sign-off will fail, and ABC will          */
   /* be set to 1 to indicate this,                    */
   /* but because it was unsuccessful,        */
   /* the default of no macro variable       */
   /* will go into effect for this                     */
   /* server session.                                         */
signoff rhost cmacvar=abc
   cscript='noexist.scr';
When the SIGNOFF command executes, the usual SAS log messages for the server session appear in the Log window of the client session. After the connection ends, the following message is displayed:
NOTE: Remote signoff to server-ID complete.

Example 3: Simple Sign-off for a Single Session

The following FILENAME statement assigns the fileref RLINK to a SAS/CONNECT script that is named external-file-name:
filename rlink 'external-file-name';
Because the client is connected to only one server session, a short form of the SIGNOFF statement can be used to end the connection:
signoff;

Example 4: Sign-off from a Specific Session

If multiple server sessions are executing, you can specify the server-ID of the server from which to sign off.
signoff ahost;

Example 5: Sign-off from Session Using Specific Script Fileref

The following FILENAME statement assigns another fileref, which is not the default, to the SAS/CONNECT script:
filename endit 'external-file-name';
In this case, you must specify the fileref in the SIGNOFF statement because it is not the default script fileref.
signoff cscript=endit;

Example 6: Sign-off by Using a File Specification When Multiple Sessions Are Running

If you do not assign a fileref to the SAS/CONNECT script, you must specify the filespec in the SIGNOFF command.
signoff  all cscript='external-file-name';

Example 7: Sign-off without a Script

If you do not want to perform any special processing when you sign off, you can omit the script that is used for signing off.
signoff noscript;