Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatically run a SAS script from a timer

Status
Not open for further replies.

karlomutschler

Programmer
Jun 5, 2001
75
DE
good day,
I need to run my Main SAS script, in which I have INCLUDEed
the tasks that need to accomplished after a certain
condition has been met.

Basically it should operate as follows:
My SAS script would test, say from 05h00 onward, whether a
specific datevariable meets the condition or not.
If not then go to sleep for 5min
if yes then run the scipt.

Any advice, tips and tricks in this regards are most welcome.

Kindest regards
Karlo
 
We use a bit of software called AdTempus for scheduling SAS scripts. There are a lot of options for setting up criteria etc...
 
thank you Nick,
for your valued response.

Our script is located on a SAS-Client (Windows OS) and it is run remotely on a SAS-Server.

We want to automate the SAS login procedure and then the start of the abovementioned script.

We have installed the Schedule Wizard from
Vince Sorensen
Author Direct Shareware
directsales@authord.com

and are able to start SAS and call the SAS-script.
Obviously, the operation fails, because the login has not been performed.

Would you be able to inform me how you are handling the login portion and how you start the script (instead of pressing the F8 key)

Kindest regards
Karlo
 
There is an easy way to do what you're trying to do, but I don't advise this. You could use a windows scheduler to launch your sas program. The scheduler will 'run' as a user (you will supply the login creds at creation time)

This has worked for us for over 5 years.

The reason I advise against this type of script is as follows. You are using SAS to test for a condition. In other words, you are relying on SAS to do something (report etc) as a production (real-time) execution. I can't tell you how many times I've found memory leaks in a SAS process. When the SAS program starts to 'hog' the system resources, and 'peg' the CPU and memory at 100%, you realize that SAS was never meant to deliver real-time data-related actions on an ongoing basis. Its meant for reports on gathered (note the past tense) stats. You also have to take into account that SAS 'locks' data access in most data procs. Yes, using the SAS\Share engine helps, but it doesn't eliminate that elusive 'data-lock'.

This stated, as I mentioned earlier, we do use this setup, but we have modified the SAS responsabilities of the program/script. We take into account that SAS will explode memorywise and use SAS in one time programs. We don't allow SAS to sleep between executions. We rather launch, test for a condition, execute and close. You could do this via a windows scheduler and have it run every 5 mins after a start time each day.

Hope this helps you.
Klaz
 
thank you Klaz
for your valued response to my question.

As detailed before,
we have installed the SW Schedule Wizard and are able to
call sas.exe as well as the correct scipt.

However,
as far as I can see there are 2 problems to be solved.
1. the automatic login to SAS
2. the starting of the script

The SAS-Script is located on my SAS-Client and the scripts
are run remotely on a UNIX-Server.

Any guidance, tips and tricks are most welcome.

kindest regards
Karlo
 
I use schedule wizard and it works fine. I installed schedule wizard on a dedicated machine that is always logged on and it runs my scheduled jobs from that dedicated machine. Therefore I dont have the logon issue. As I establish additional programs that I want to run routinely I add and subtract to the schedule wizard list of programs.

dje
 
I'm also interested in figuring out the login part. I did some digging around, and while I don't have the complete answer, I hope I found a good staring point. This link, seems to have a good sample code at the bottom.
Looks like a SAS file could be run to login in the remote server. Maybe start with something like this below?

options comamid=tcp;
signon <options>;

Let us know if you figure it out.
 
Karlo,

I assume you are able to open the SAS application. You can create a small file(can be a SAS dataset) which would contain the userid and password. Your SAS script will get those details by reading the file.

If you have your SAS script on your server, then I don't think you need to log in as your file is already sitting at the server. At this point, you won't be using rsubmit and so on.

You can use shell script to schedule SAS jobs on the server. Do a google search.

Hope this help.




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top