Hi
I would like to schedule my SAS program on unix CRONTAB. i have scheduled for run my SAS program on 9pm. schedule to run only on specific days 18-30 and run on only Week days. here is i have setup of crontab
0 21 18-30 * 1-5 /workspace/lob5/alm/u021592/cron/ksh_file_name.ksh
but the problem is the program is running but its running on on Weekend as well (Sat and Sunday). But i dont want to run this on SAT and SUN. i have listed 1-5 for some reason both day of month and day of week together not working?
Appreciate your help on this or any other approach?
For start you can add something like this:
%put &=sysday.;
%macro stopSAS()/minoperator;
%if &sysday. in (Saturday Sunday) %then
%do;
endsas;
%end;
%mend;
%stopSAS()
at the beginning of your SAS code.
Bart
Thanks Is this code we need be written in SAS program ? or Unix Shell scripts like crontab -e options?
You can configure crontab to only run on certain days of the week: https://stackoverflow.com/questions/18919151/crontab-day-of-the-week-syntax
This is a lot better than handling this in your SAS program. If you google "crontab days of the week" you should find out the right syntax.
Thanks, I have the same problem in my company when scheduling a cron job
Probably a question you should ask on a different forum.
Perhaps cron is not smart enough to filter by both specific days of the month and specific days of the week?
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.