CALL SLEEP Routine
For a specified period of time, suspends the execution of a program that invokes this CALL routine.
| Categories: | Special |
| CAS | |
| Note: | Argument types for arguments that are updated must match in CALL routines. All argument types must be CHAR, VARCHAR, or NUMERIC. If the argument types do not match, a warning is issued to the log. |
Syntax
Required Argument
n
is a numeric constant, variable, or expression that specifies the number of seconds for which you want to suspend execution of a program.
| Range | n ≥ 0 |
| Tips | If you do not use the unit argument, the value of n is the next integer value that is less than n. |
If you use a fraction for the n argument,
the unit argument is required
if you want to suspend execution for a fraction of a second. For example, CALL
SLEEP(.25); does not suspend execution. CALL
SLEEP(1.25); suspends execution for 1 second. CALL
SLEEP(1.25, 1); suspends execution for 1.25 seconds.
|
Optional Argument
unit
specifies the unit of time in seconds, which is applied to n. For example, 1 corresponds to 1 second, .001 corresponds to 1 millisecond, and 5 corresponds to 5 seconds.
| Default | .001 |
Details
Examples
Example 1: Suspending Execution for a Specified Period of Time
data payroll;
call sleep(7000, .01);
...more SAS statements...
run;Example 2: Suspending Execution Based on a Calculation of Sleep Time
data budget;
sleeptime='01mar2013:03:00'dt-datetime();
call sleep(sleeptime, 1);
...more SAS statements...;
run;Example 3: Using an Expression to Specify a Specific Period of Time
data _null_; call sleep(.5+.8,1); run;
NOTE: DATA statement used (Total process time):
real time 1.30 seconds
cpu time 0.00 seconds