BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jorquec
Quartz | Level 8

Hi ,

I am working on sas  management  and created a job for a routine process .Now i need to schedule the job in timeline basis, which dependency is not a timeschedule but a file update.

 

.

 

I have attached my code , which basically make some checks on date and if is the time to run the process it will update a sas table called triggerpayg.sas7bdat

 

Until this step is fine , than I deployed the job on DI Studio , and now I am struggling to schedule on SAS management. Does someone knows which is the meaning on Schedule  Flow for  Event File "Arrives" I couldn't find in any documentation.

 

 

Can anyone kindly help on this ?

 

 

Thanks in advance.

%include '/SASCommon/jorquec/credentials.sas'; 

libname sasmf '//SASCommon/ModelFactory/Trigger' ;  
libname nuv teradata user= &teradata_user. password = &teradata_pwd. server = 'edwprod' database = 'nuc_pl_user_view';
libname irm teradata user= &teradata_user. password = &teradata_pwd. server = 'edwprod' database = 'INSIGHTS_RM';

/*-----------------MACROS DE DATA ------------------*/

%let today=%sysfunc(today());
%let currdt=%sysfunc(datetime());

data _null_;

date2=intnx("month",&today.,-1,'end');
call symputx('date2',date2);
/*%put &=date2.;
%put DATE2 = %sysfunc(putn(&date2.,date9.));*/



month_id = intck('month','01jan1990'd,today());
put month_id=;
call symputx('month_id',month_id);
%put month_id=&month_id.;

run;

/*STEP 1 */
proc sql;
 drop table IRM.TESTPAYG;
quit;

Proc SQL;
connect to teradata 
(user=&teradata_user. password=&teradata_pwd. server = 'edwprod' database = 'nuc_pl_user_view');  
Create  table IRM.TESTPAYG as select * from connection to teradata(

 select a.ID,  a.maxmargin_dt, b.maxmodelmart_d from 
(  
  select  
			1 as ID,
 			max(month_end_dt) as maxmargin_dt
from nuc_pl_user_view.pg_margin_stack) as A
left join (
select  
			1 as ID,
			max(month_id) as maxmodelmart_d
 from  Insights_rm.Consumer_Model_Mart
where internal_CA_model_id in (101,107,110,116,117,119,120)) as B
on a.ID = b.ID

 );
disconnect from teradata ;
QUIT;

/* STEP 2 */

proc sql;
 drop table IRM.TESTPAYG2;
quit;

DATA IRM.TESTPAYG2;
SET IRM.TESTPAYG;
IF  (maxmargin_dt >=(&date2.)) and (maxmodelmart_d ^= (&month_id.)) then export_flag='Y'; 

else export_flag='N';

call symputx('export_flag', export_flag);


run;
 
*check value of macro variable;
%PUT Export_Flag = &export_flag;


/* STEP 3 - PROC EXPORT -*/
proc sql;
delete from  sasmf.TRIGGERPAYG;
 quit;

 %macro test;
%if &export_flag = Y %then %do;
proc sql;
 insert into 
 sasmf.TRIGGERPAYG  (ID,maxmargin_dt,maxmodelmart_d,export_flag)  ( select ID,maxmargin_dt,maxmodelmart_d,export_flag from 
 irm.TESTPAYM2) ;
quit;

%end;
 %mend;
 %test;







1 ACCEPTED SOLUTION

Accepted Solutions
LinusH
Tourmaline | Level 20

Actually you need to know a little of the technical stuff, or ask someone that knows.

In SMC Schedule Manager, you are prompted to chose a Scheduling Server, which one have you chosen for your flow?

 

If you have a file event, it will triger the flow once, for everyinstance. So if you schedule a flow to run every day, it will check your file event every day.

Data never sleeps

View solution in original post

4 REPLIES 4
SASKiwi
PROC Star

What scheduler are you choosing when you schedule in SAS Management Console? Not all schedulers allow file events. Platform Process Manager aka LSF does. Operating System Services doesn't. The new SAS-developed scheduler available in SAS 9.4M6 doesn't either. 

jorquec
Quartz | Level 8

Well I don't know this technical part, but I have 100% of sure that is possible because I have used the option Files Exist and it is fine I just would like to know about the option File Arrives mean.

I guess it means it will run the job just once , just the first time that files appear ?? Or it will run the job every time that the file changed the date, I mean every time that the file as refreshed?  I didn't find this information in any document.

 

Many thanks in advance if someone could help.

LinusH
Tourmaline | Level 20

Actually you need to know a little of the technical stuff, or ask someone that knows.

In SMC Schedule Manager, you are prompted to chose a Scheduling Server, which one have you chosen for your flow?

 

If you have a file event, it will triger the flow once, for everyinstance. So if you schedule a flow to run every day, it will check your file event every day.

Data never sleeps
SASKiwi
PROC Star

@jorquec - If you wish to schedule SAS jobs then you will need to become familiar with setting them up in SMC. As @LinusH says, one of the choices is which scheduler you use. If you don't know about this stuff then do you have a SAS administrator or other knowledgeable SAS user to help you out? It is just a matter of making the right point-and-click selections.

 

Choosing a scheduler that provides file event triggering means you don't have to code for the event in SAS, so it is a whole lot easier for you. You know the file is there because the SAS job started, so then your code just needs to do what happens after the file exist.

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

Get Started with SAS Information Catalog in SAS Viya

SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1605 views
  • 3 likes
  • 3 in conversation