How to execute a piece of SAS code within a fix time period

Reply
New Contributor
Posts: 4

How to execute a piece of SAS code within a fix time period

I want to fix some time for a particular SAS code, and if its not responding n the fixed time, then the next chunk of code should be executed forcefully

for example

I am trying to ping one URL

if that url is not responding

then my code is getting hung

because it is waiting for some response from the URL

but i want to wait just for 30 sec

and if in that 30 sec it is not responding then the next part of code should triggered

is there any way out?.

Super User
Super User
Posts: 7,695

Re: How to execute a piece of SAS code within a fix time period

Are you running a dos ping command?  If so then check out the documentation for that command, specifically the timeout:

http://www.computerhope.com/pinghlp.htm

This will stop trying to connect after x seconds, and then in turn that would return you to your SAS session and you can pickup the return code to see if it worked or not.

New Contributor
Posts: 4

Re: How to execute a piece of SAS code within a fix time period

Hi thanks for your reply.

I'm posting the part of code here, it will run in unix environment. In this code the very first line is pinging the "url_ping", in case if the url is in hung state then the next part of code is not getting executed, i want, if the url is not responding for 45 seconds then the next chunk of code should get executed forcefully.



filename testsrv url "url_ping";

data test1;

infile testsrv truncover;

input str $1000.;

if max(find(upcase(str),'FUNCTIONING PROPERLY'),0) gt 0 then

do;

%let srv_function1=1;

end;

Ask a Question
Discussion stats
  • 2 replies
  • 188 views
  • 1 like
  • 2 in conversation