Hi All,
I need to schedule a sas program in batch and at the max program should be run twice in a day. I need a control table for sure but how to get the logic is something i am not getting.
Contro table structure is something like
program_name | Time_When_run | Date | Count | Flag |
abc | 9AM | 7-Nov-13 | 1 | 1 |
abc | 12AM | 7-Nov-13 | 2 | 1 |
So my flag is set to 0 at beginning of the day say at 00:00 and it gets set to 1 when program is run successfully.
How do I get it done? Thanks in advance
Can you describe what problem you are facing? Is the scheduling part, or updating the control table?
Usually I use macro calls for this, when the jobs starts, create row, when job ends, update with end status or whatever information you need.
Hi Linus ,
I have problems in scheduling and confusion in updating control table. Confusion is what should flag be by end of day and how to get information for next day. SAY today job run twice successfully and its flagged as 1. So how do I set flag as 0 tomorrow.
Scheduling: what scheduling tool will you use? What kind of SAS product are available for you (intelligence platform...?) What platform are you on?
Logging: use the start datetime for the job as a key. Each execution of the job will have it's own row. It will be easy to see when a job has not started at all. Who will look into this log table?
We have LSF. However my client is curious to know if we execute this manually in DI job. There certainly is user written code in that and say two different users run this code in shift times. Morning guy in morning n evening guy in evening.
My question still remains same. How should I get flags correct. Some sample code would be extremely helpful. Log table is also under our control its structure is also not defined so we can manipulate the way we want to
Running manually in DIS is not really scheduling... 😉
%macro adrec(job);
proc sql;
insert into control.joblog (program_name, time_when_run, date_when_run, flag)
(&Job, "&SysTime"t, "&SysDate9"dt, 0)
;
quit;
%mend adrec;
%macro change_flag(job, time = &SysTime, date = &SysDate);
proc sql;
update control.joblog
set flag = 1
where job_name = "&Job" and time_when_run="&Time"t and date_when_run="&Date"d
;
quit;
%mend change_flag;
Untested... see as an idea.
Can't figure out what you want to store count, could easily be created when querying the log table.
Hi forumsguy,
Of course. to state the obvious, running the job directly from within DIS has the same effect as running the job from a scheduler, just not scheduled.
Scheduling a job to run twice a day is straight forward using SMC Schedule Manager (when it is fronting a Platform LSF scheduler instance). Do you need help doing that?
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.