Functions and CALL Routines |
For a specified period of time, suspends the execution of a program
that invokes this function.
Category: |
Special
|
See: |
SLEEP Function
under Windows
|
-
n
-
is a numeric constant, variable, or expression
that specifies the number of units of time for which you want to suspend execution
of a program.
Range: |
n
0 |
-
unit
-
is a numeric constant, variable, or expression
that specifies the unit of time, as a power of 10, which is applied to n. For example, 1 corresponds to a second, and .001 to a millisecond.
Default: |
1 in a Windows PC environment,
.001 in other environments |
The SLEEP function suspends the execution
of a program that invokes this function for a period of time that you specify.
The program can be a DATA step, macro, IML, SCL, or anything that can invoke
a function. The maximum sleep period for the SLEEP function is 46 days.
The following example tells SAS to delay the execution
of the DATA step PAYROLL for 20 seconds:
data payroll;
time_slept=sleep(20,1);
...more SAS statements...
run;
The following example tells SAS to suspend the execution
of the DATA step BUDGET until March 1, 2006, at 3:00 AM. SAS calculates the
length of the suspension based on the target date and the date and time that
the DATA step begins to execute.
data budget;
sleeptime='01mar2006:03:00'dt-datetime();
time_calc=sleep(sleeptime,1);
...more SAS statements...;
run;
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.