DATA Step, Macro, Functions and more

Wakeup Function

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 5
Accepted Solution

Wakeup Function

Hello,

 

The Wakeup function seems unrecognized. The wakeup function allows you to specify the date and time to delay the execution.

 

Indeed in my Windows machine it works but not working on my Linux Machine with SAS 9.4.

 

DATA _null_;

rc=wakeup(DHMS(TODAY(),3,7,30));

RUN;

 

ERROR 68-185: The function WAKEUP is unknown, or cannot be accessed.

 

Any ideas?

 

Thanks


Accepted Solutions
Solution
‎07-11-2017 03:39 AM
Super User
Posts: 6,951

Re: Wakeup Function

@Quentin you are right, of course. The proper way to use the sleep function is this:

%let sleep_until='10jul2017:14:30:00'dt;

data _null_;
sleeptime = &sleep_until - time();
slept = sleep(sleeptime,1);
run;

as this forces sleep() to use seconds as the unit across all platforms.

Or

%let sleep_until='10jul2017:14:30:00'dt;

data _null_;
sleeptime = &sleep_until - time();
call sleep(sleeptime,1);
run;
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers

View solution in original post


All Replies
Super User
Posts: 6,951

Re: Wakeup Function

[ Edited ]

WAKEUP is a Windows-only feature of SAS.

You won't find it in the generic SAS documentation of functions and call routines.

 

To achieve something similar on any other platform, do this:

%let sleep_until='10jul2017:14:30:00'dt;

data _null_;
sleeptime = &sleep_until - time();
slept = sleep(sleeptime);
run;

 

 

 

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
PROC Star
Posts: 1,233

Re: Wakeup Function

On Linux the default unit for sleep is miliseconds rather than seconds. So could adjust @KurtBremser's calculation to be:
sleeptime = (&sleep_until - time()) *1000 ;
Solution
‎07-11-2017 03:39 AM
Super User
Posts: 6,951

Re: Wakeup Function

@Quentin you are right, of course. The proper way to use the sleep function is this:

%let sleep_until='10jul2017:14:30:00'dt;

data _null_;
sleeptime = &sleep_until - time();
slept = sleep(sleeptime,1);
run;

as this forces sleep() to use seconds as the unit across all platforms.

Or

%let sleep_until='10jul2017:14:30:00'dt;

data _null_;
sleeptime = &sleep_until - time();
call sleep(sleeptime,1);
run;
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 182 views
  • 4 likes
  • 3 in conversation