SAS Functions and CALL Routines under Windows |
Category: | Special |
Windows specifics: | all |
See: | SLEEP Function in SAS Language Reference: Dictionary |
Syntax | |
Details | |
Example | |
See Also |
Syntax |
SLEEP(n<,unit>) |
specifies the number of seconds that you want to suspend execution of a DATA step. The n argument is a numeric constant that must be greater than or equal to 0. Negative or missing values for n are invalid.
specifies the unit of seconds, as a power of 10, which is applied to n. For example, 1 corresponds to a second, and .001 to a millisecond. The default value is 1.
Details |
The SLEEP function suspends execution of a DATA step for a specified number of seconds. When the SLEEP function uses the default unit value, a pop-up window appears that indicates how long SAS is going to sleep.
The return value of the n argument is the number of seconds slept. The maximum sleep period for the SLEEP function is 46 days.
When you submit a program that calls the SLEEP function, the SLEEP window appears telling you when SAS is going to wake up. You can inhibit the SLEEP window by starting SAS with the NOSLEEPWINDOW system option. Your SAS session remains inactive until the sleep period is over. To cancel the call to the SLEEP function, use the CTRL+BREAK attention sequence.
You should use a null DATA step to call the SLEEP function; follow this DATA step with the rest of the SAS program. Using the SLEEP function in this manner enables you to use the CTRL+BREAK attention sequence to interrupt the SLEEP function and to continue with the execution of the rest of your SAS program.
Example |
The following example tells SAS to delay the execution of the program for 12 hours and 15 minutes:
data _null_; /* argument to sleep must be expressed in seconds */ slept= sleep((60*60*12)+(60*15)); run; data monthly; /*... more data lines */ run;
See Also |
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.