Help using Base SAS procedures

Sleep Question

Accepted Solution Solved
Reply
Regular Contributor
Posts: 173
Accepted Solution

Sleep Question

Hello Everyone,

I would like to delay the start of the execution of a sas program by 10 minutes.   I added this data _null_ step at the beginning of my sas code.  But the program starts right away.  How do I delay the execution of a program by a specified amont of time?

data _null_;

     sletp = sleep(60*10);

run;

data aaa;

......... rest of the sas program.

I appreciate any input you may have!

Smiley Happy


Accepted Solutions
Solution
‎02-07-2013 06:27 PM
Super User
Posts: 10,460

Re: Sleep Question

Look for the CALL SLEEP function instead of trying to guess how long a loop takes.

Data _null_;

     call sleep (600,1); /* 600 seconds*/

run;

View solution in original post


All Replies
Super Contributor
Posts: 578

Re: Sleep Question

If you're on a unix server, the default unit is millisecond, not second.

Regular Contributor
Posts: 173

Re: Sleep Question

Thank you DBailey.

I changed the code to sleep(60*60*10) and it started right away too.  Isn't that 10 minutes?

Thanks.

Solution
‎02-07-2013 06:27 PM
Super User
Posts: 10,460

Re: Sleep Question

Look for the CALL SLEEP function instead of trying to guess how long a loop takes.

Data _null_;

     call sleep (600,1); /* 600 seconds*/

run;

Trusted Advisor
Posts: 1,300

Re: Sleep Question

To repeat DBailey,

The default unit for enviornments other than windows is millisecond ( .001 ), so your server is most likely not a windows machine:

for 1 minute

rc=sleep(60,1)

SLEEP Function

http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a001418809.htm

or

call sleep(60,1)

CALL SLEEP Routine: UNIX

http://support.sas.com/documentation/cdl/en/hostunx/61879/HTML/default/viewer.htm#a001462167.htm

Super Contributor
Posts: 578

Re: Sleep Question

Not if you're on a unix machine...

10 minutes * 60 seconds / minute * 1000 miliseconds / second = 600000

Regular Contributor
Posts: 173

Re: Sleep Question

Thank you everyone for the helpful information!

I decided to use the Call Sleep function and it worked beautifully.

Thank you again for all your input Smiley Happy


☑ This topic is SOLVED.

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

Discussion stats
  • 6 replies
  • 792 views
  • 0 likes
  • 4 in conversation