BookmarkSubscribeRSS Feed
cmacknair
Calcite | Level 5

Hello everyone,

 

I'm currently trying to automate two SAS programs.

 

1. I want a SAS script to run at 3 seperate times 5 days a week. M-F at 12 pm, 4 pm and 7 pm EST. The only method I've gotten to work is that Windows will run SAS studios and open the SAS script for me, but it won't press 'Run'.

 

2. I want a SAS script to be triggered by a change in the source table that I'm using. A little context, the source table has entries put into it anytime an external script 'fails' and puts all the information about the job into a row based table. I want my SAS script to pull these entries as soon as the table has entries put into it.

 

Thanks for any tips

3 REPLIES 3
rogerjdeangelis
Barite | Level 11
Not a complete answer., but it might help.

You may need to have your programs check the 'trigger' file. I like to use
a Perl script to do the checking and execute the SAS jobs.

/* T004680 SETTING UP CHRON JOBS ON UNIX AND WINDOWS

THIS IS A VERY OLD TIP CIRCA WIN 2000
=====================================

start>Control Panel\System and Security\Administrative Tools\scheduled tasks

put the following in run dialog box
C:\Program Files\SAS\SAS 9.1\sas.exe" -nosplash -sysin c:\sas\pgm.sas -log nul: -print nul:
put the following in start in box
c:\sas

You don't have to have a null log or null list.
I send an email with the log and list when the program fails

IN UNIX
=======

create a file called cronjob.txt with just the line below

0 2 * * 1-5 /groundtruth/programs/program.csh

Details
mm hh dd mon day
0   2  *  *  1-5 /groundtruth/programs/program.csh

run at 2am every monday-friday

here is what program.csh looks like(executes sas myprogram
#!/usr/bin/csh
cd /groundtruth/sas/programs
/groundtruth/local/bin/sas mysasprogram

You can execute crontab if your name appears in the file /usr/lib/cron/cron.allow

crontab -e      Edit your crontab file, or create one if it doesn?t already exist.
crontab -l      Display your crontab file.
crontab -r      Remove your crontab file.
crontab -v      Display the last time you edited your crontab file.



cmacknair
Calcite | Level 5

"

THIS IS A VERY OLD TIP CIRCA WIN 2000
=====================================

start>Control Panel\System and Security\Administrative Tools\scheduled tasks

put the following in run dialog box
C:\Program Files\SAS\SAS 9.1\sas.exe" -nosplash -sysin c:\sas\pgm.sas -log nul: -print nul:
put the following in start in box
c:\sas

You don't have to have a null log or null list.
I send an email with the log and list when the program fails

"

 

So this bit I have used before but whenever I use it this way it literally just opens SAS for me and then opens 'pgm.sas' to work on but does nothing else. Doesn't run the job as I would obviously want it to do.

 

As for the UNIX solution I unfortunately don't have access to run shell scripts in the system I'm working on. 

SASKiwi
PROC Star

As far as I'm aware you can't currently schedule programs via SAS Studio. How are you using SAS Studio? With a remote SAS server, SAS UE or some other method? If you are using a remote server, that will usually have scheduling tools available to you.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2312 views
  • 0 likes
  • 3 in conversation