BookmarkSubscribeRSS Feed
forumsguy
Fluorite | Level 6

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_nameTime_When_runDateCountFlag
abc9AM7-Nov-1311
abc12AM7-Nov-1321

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

6 REPLIES 6
LinusH
Tourmaline | Level 20

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.

Data never sleeps
forumsguy
Fluorite | Level 6

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.

LinusH
Tourmaline | Level 20

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?

Data never sleeps
forumsguy
Fluorite | Level 6

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

LinusH
Tourmaline | Level 20

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.

Data never sleeps
RobertWoodruff
SAS Employee

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?

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

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
  • 6 replies
  • 1501 views
  • 0 likes
  • 3 in conversation