- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug
"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings
SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Is this code we need be written in SAS program ? or Unix Shell scripts like crontab -e options?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, I have the same problem in my company when scheduling a cron job
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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?