SAS backfeed macro
来源:互联网 发布:linux mv 多个文件 编辑:程序博客网 时间:2024/06/15 04:07
%include 'G:\MADATA\contexts\emea_apj\stored_process\error_handling.sas';%macro back_feed(channel, audience);%let sourcedb = smb_qa_ec;%let targetdb = smb_preprod_stage;%let server = hqdellnz06;%let authdomain = hqdellnz06;LIBNAME dblib NETEZZA DATABASE=&targetdb SERVER=&server AUTHDOMAIN="&authdomain" DBCONINIT='SET SERIALIZABLE = FALSE;';/* ------------------------- STEP # -1 ------------------------- */PROC SQL ERRORSTOP;%global actual_time actual_time_n actual_time_s campcode;%let actual_time = %sysfunc(datetime());%let actual_time_n = %sysfunc(compress(%sysfunc(tranwrd(%sysfunc(putn(&actual_time,E8601DZ20.)),T, )),Z));%let actual_time_s = %sysfunc(putn(&actual_time,datetime25.));%put campcode=&campcode;%put actual_time_n=&actual_time_n;CONNECT TO NETEZZA (AUTHDOMAIN="&authdomain" DB=&targetdb SERVER=&server DBCONINIT='SET SERIALIZABLE = FALSE;');EXECUTE (call sp_bf_checks (%str(%')&campcode%str(%'),%str(%')&actual_time_n%str(%'))) BY NETEZZA;DISCONNECT FROM NETEZZA;QUIT;%put RC=&RC;%chkerr(Step #-1);%put RC=&RC;%if (%eval(not(&RC = 0))) %then %do; %goto eof_code_logic;%end;/* ------------------------- STEP #0 ------------------------- */PROC SQL ERRORSTOP;CONNECT TO NETEZZA (AUTHDOMAIN="&authdomain" DB=&targetdb SERVER=&server DBCONINIT='SET SERIALIZABLE = FALSE;');EXECUTE( call sp_bf_checks_notification(%str(%')&campcode%str(%'),%str(%')&actual_time_n%str(%'))) BY NETEZZA;DISCONNECT FROM NETEZZA;QUIT;%put RC=&RC;%chkerr(Step #0);%put RC=&RC;%if (%eval(not(&RC = 0))) %then %do; %goto eof_code_logic;%end;/* ------------------------- STEP #1 ------------------------- */PROC SQL ERRORSTOP;%global actual_time actual_time_n actual_time_s campcode;%let actual_time = %sysfunc(datetime());%let actual_time_n = %sysfunc(compress(%sysfunc(tranwrd(%sysfunc(putn(&actual_time,E8601DZ20.)),T, )),Z));%let actual_time_s = %sysfunc(putn(&actual_time,datetime25.));CONNECT TO NETEZZA (AUTHDOMAIN="&authdomain" DB=&targetdb SERVER=&server DBCONINIT='SET SERIALIZABLE = FALSE;');EXECUTE (/*way to proof counts*//* modified to cause error call sp_insert_raw_promo_history */%put campcode=&campcode;%put actual_time_n=&actual_time_n;call sp_insert_raw_promo_history(%str(%')&campcode%str(%'), %str(%')&actual_time_n%str(%'))) BY NETEZZA;DISCONNECT FROM NETEZZA;QUIT;%put RC=&RC;%chkerr(Step #1);%put RC=&RC;%if (%eval(not(&RC = 0))) %then %do; %goto eof_code_logic;%end;/* ------------------------- STEP #2 ------------------------- */PROC SQL ERRORSTOP;%global camp_type coupon_flg; select distinct camp_type, campaign_coupon_flg into :camp_type, :coupon_flg from dblib.Raw_Promo_History where camp_cd = "&campcode" and run_dttm = "&actual_time_s"dt ;%let camp_type = &camp_type;%let coupon_flg = &coupon_flg;QUIT;%put RC=&RC;%chkerr(Step #2);%put RC=&RC;%if (%eval(not(&RC = 0))) %then %do; %goto eof_code_logic;%end;/* ------------------------- STEP #3 ------------------------- */PROC SQL ERRORSTOP;CONNECT TO NETEZZA (AUTHDOMAIN="&authdomain" DB=&targetdb SERVER=&server DBCONINIT='SET SERIALIZABLE = FALSE;');EXECUTE (call sp_bf_raw_to_wave_execution_processing(%str(%')&campcode%str(%'),%str(%')&actual_time_n%str(%'),%str(%')&camp_type%str(%'), %str(%')&coupon_flg%str(%'), %str(%')&channel%str(%'), %str(%')&audience%str(%') ) ) BY NETEZZA;DISCONNECT FROM NETEZZA;QUIT;%put RC=&RC;%chkerr(Step #3);%put RC=&RC;%if (%eval(not(&RC = 0))) %then %do; %goto eof_code_logic;%end;/* ------------------------- STEP #4 ------------------------- */PROC SQL ERRORSTOP;CONNECT TO NETEZZA (AUTHDOMAIN="&authdomain" DB=&sourcedb SERVER=&server DBCONINIT='SET SERIALIZABLE = FALSE;');EXECUTE (call sp_bf_from_raw_to_stg_phist_processing_dynamic /* Version 2 */(%str(%')&campcode%str(%'), %str(%')&actual_time_n%str(%'),%str(%')&camp_type%str(%'),%str(%')&coupon_flg%str(%'), %str(%')&channel%str(%'), %str(%')&audience%str(%'))) BY NETEZZA;DISCONNECT FROM NETEZZA;QUIT;%put RC=&RC;%chkerr(Step #4);%put RC=&RC;%if (%eval(not(&RC = 0))) %then %do; %goto eof_code_logic;%end;/* ------------------------- STEP #5 ------------------------- */PROC SQL ERRORSTOP;CONNECT TO NETEZZA (AUTHDOMAIN="&authdomain" DB=&targetdb SERVER=&server DBCONINIT='SET SERIALIZABLE = FALSE;');EXECUTE (call sp_update_status_of_wave_execution_history(%str(%')&campcode%str(%'), %str(%')&actual_time_n%str(%'),%str(%')&camp_type%str(%'))) BY NETEZZA;DISCONNECT FROM NETEZZA;QUIT;%put RC=&RC;%chkerr(Step #5);%put RC=&RC;%if (%eval(not(&RC = 0))) %then %do; %goto eof_code_logic;%end;/* ------------------------- STEP #6 ------------------------- */DATA &outTable;set &inTable; run;/* If we fail on a %chkerr(); call we will GOTO here */%eof_code_logic:%mend back_feed;
0 0
- SAS Macro - Campaign Backfeed
- SAS backfeed macro
- SAS Backfeed Process
- SAS Macro
- SAS Macro STPBEGIN
- SAS Macro - Check Error
- SAS Macro 日期格式转换
- SAS Macro Programming Made Easy, Second Edition
- SAS Macro IN 操作: MINOPERATOR System Option
- macro
- macro
- macro
- SAS 汇总SQL查询宏变量的值(Sum Values Stored in Macro Variables )
- sas
- sas
- sAS
- sas
- SAS
- SAS Backfeed Process
- mathtype6.0部分符号显示为框的解决方法
- 计算器Pro应用项目源码
- android中获取ip地址和mac地址
- 你=客户,服务员=客户经理+产品经理,大厨=码农
- SAS backfeed macro
- MFC+GDI控件自绘(2):控件类
- 在Unity3D中基于订阅者模式实现事件机制
- 梯度、梯度下降,随机梯度下降
- 携程App的网络性能优化实践
- Android自定义ViewGroup之子控件的自动换行和添加删除
- UISwitch控件修改大小。设置颜色
- VB.net 播放 WAV音乐
- 为Android频繁的网络请求设置本地缓存