Previous Page | Next Page

SAS Functions and CALL Routines under Windows

WAKEUP Function: Windows



Specifies the time a SAS DATA step continues execution.
Category: Special
Windows specifics: all

Syntax
Details
Examples
Example 1: Delaying Program Execution until a Specified Date or Time
Example 2: Delaying Program Execution until a Specified Time Period after Midnight
Example 3: Using a Variable as an Argument to the WAKEUP Function
See Also

Syntax

WAKEUP(until-when)

until-when

specifies the time when the WAKEUP function allow execution to continue.


Details

Use the WAKEUP function to specify the time a DATA step continues to execute. The return value is the number of seconds slept.

The until-when argument can be a SAS datetime value, a SAS time value, or a numeric constant, as explained in the following list:

Negative values for the until-when argument are allowed, but missing values are not. The maximum sleep period for the WAKEUP function is approximately 46 days.

When you submit a program that calls the WAKEUP 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 waiting period is over. If you want to cancel the call to the WAKEUP function, use the CTRL + BREAK attention sequence.

You should use a null DATA step to call the WAKEUP function; follow this DATA step with the rest of the SAS program. Using the WAKEUP function in this manner enables you to use the CTRL+BREAK attention sequence to interrupt the waiting period and continue with the execution of the rest of your SAS program.


Examples


Example 1: Delaying Program Execution until a Specified Date or Time

The code in this example tells SAS to delay execution of the program until 1:00 p.m. on January 1, 2004:

data _null_;
   slept=wakeup('01JAN2004:13:00:00'dt);
run;
data compare;
   /* ...more data lines */
run;

The following example tells SAS to delay execution of the program until 10:00 p.m.:

data _null_;
   slept=wakeup("22:00:00"t);
run;
data compare;
   /* ...more data lines */
run;


Example 2: Delaying Program Execution until a Specified Time Period after Midnight

The following example tells SAS to delay execution of the program until 35 seconds after the next occurring midnight:

data _null_;
   slept=wakeup(35);
run;
data compare;
   /* ...more data lines */
run;


Example 3: Using a Variable as an Argument to the WAKEUP Function

This example illustrates using a variable as the argument of the WAKEUP function:

data _null_;
   input x;
   slept=wakeup(x);
   datalines;
1000
;
data compare;
   input article1 $ article2 $ rating;
   /* ...more data lines */
run;

Because the instream data indicate that the value of X is 1000, the WAKEUP function sleeps for 1,000 seconds past midnight.


See Also

Previous Page | Next Page | Top of Page