Presentation is loading. Please wait.

Presentation is loading. Please wait.

Automation Of An Audit Waterfall Creating An Audit Waterfall For Clients Using Macros And ODS tagset.excelxp By Denise A. Kruse SAS Contractor.

Similar presentations


Presentation on theme: "Automation Of An Audit Waterfall Creating An Audit Waterfall For Clients Using Macros And ODS tagset.excelxp By Denise A. Kruse SAS Contractor."— Presentation transcript:

1 Automation Of An Audit Waterfall Creating An Audit Waterfall For Clients Using Macros And ODS tagset.excelxp By Denise A. Kruse SAS Contractor

2 2 What Is A Waterfall? A “waterfall” is the term used to show how records in a targeted population fall out of the population. Think of it as the business owner’s program log and statistics.

3 3 Why Waterfall? Keeps the programmer and business client in sync with the data Enables the business client to be more independent when questions arise Prevents the programmer from spending unnecessary time on high level questions from the business client

4 4 Why Automate A Waterfall? Time savings! Plus, you may get to learn some new code.

5 5 Example Output

6 6 Design Create two modules that will be include statements for the main program. 1.waterfall_macro.sas This module takes the number of observations from each dataset and saves the number as one row in a table. 2.multi_waterfall.sas This module creates the actual output of a multi-sheet Excel spreadsheet

7 7 %macro ds_vol(lib, dsn); data _null_; if 0 then set &lib..&dsn. nobs=nobs; put nobs=; call symputx('cnt',nobs); stop; run; data wrpt; x=&cnt.; run; %if %sysfunc(exist(wrpt_final))=1 %then %do; proc append base=wrpt_final data=wrpt FORCE; run; %end; %else %do; data wrpt_final; set wrpt; run; %end; %mend ds_vol; Code For waterfall_macro.sas INPUT: library.datasetname Example: %ds_vol(work,mydata); %ds_vol(perm,mydata);

8 8 Inside The Table WRPT_FINAL x 9,630,064 27,525 1,323 332,646 30,454 1,100,984

9 9 Example Code For The Main Program Insert the macro call after datasets are created…. data affil_zip cjv_flag exclude no_mail scrubbed; set dee.match; if affil_zip_flag = 1 then output affil_zip; else if cjv_flag = 1 then output cjv_flag; else if exclude_flag=1 then output exclude; else if dnm_flag=1 then output no_mail; else output scrubbed; run; ****WATERFALL - ROW 2; %ds_vol(work,affil_zip); ****WATERFALL - ROW 3; %ds_vol(work,cjv_flag); ****WATERFALL - ROW 4; %ds_vol(work,exclude); ****WATERFALL - ROW 5; %ds_vol(work,no_mail);

10 10 ***WATERFALL dataset ***; ***** keep this in same order as macro calls above; data wtitles ; FORMAT Y $100.; INPUT Y; cards; Not_in_targeted_CL_List Active_Affiliate_Accounts_(affil_zip_flag) CJV_(cjv_flag) exclude_flag DNM Corporate_Exclusions Duplicates_by_Hierarchy_Number Bad_Address run; Creating The Custom Titles For The Waterfall

11 11 Find Number Of Rows In The Waterfall Report data _null_; if 0 then set wtitles nobs=nobs; put nobs=; call symputx('cnt',(nobs)); stop; run; Y Not_in_targeted_CL_List Active_Affiliate_Accounts_(affil_zip_flag) CJV_(cjv_flag) exclude_flag DNM Corporate_Exclusions Duplicates_by_Hierarchy_Number Bad_Address snippet from multi_waterfall.sas

12 12 Code Inside multi_waterfall.sas data wrpt2; format remain1-remain&cnt. num prev 8. ; length remain1-remain&cnt. num prev 8. ; set wrpt_final; retain remain1-remain&cnt. prev ; if _n_ =1 then do; num=0; *initialize counter and array; array remain (1:&cnt.) 8.; remain(1) = &title1_amt. - x; TOT_REMAIN=remain(1); output; num + 1; end; else do; num + 1; prev=num-1; remain(num)= remain(prev) - x; TOT_REMAIN=remain(num); output; end; run;

13 13 Visual Of multi_waterfall.sas Calculation XTOT_REMAIN 9,630,064TITLE_AMT – X 27,525PREV – X 1,323 PREV – X 332,646PREV – X 30,454PREV – X 1,100,984PREV – X PREV - X

14 14 Code Inside multi_waterfall.sas X 9,630,064 27,525 1,323 332,646 30,454 1,100,984 data skippy; format y $100.; merge wtitles wrpt2; run; Y Not_in_targeted_CL_List Active_Affiliate_Accounts_(affil_zip_flag) CJV_(cjv_flag) exclude_flag DNM Corporate_Exclusions Duplicates_by_Hierarchy_Number Bad_Address

15 15 Coding With ODS ods listing close; run; ods tagsets.ExcelXP file="/MyDir/waterfall/waterfall_&campaign..xls" style=waterfall; *options(doc='help' ); ods tagsets.ExcelXP options(sheet_name='Waterfall' embedded_titles='Yes' embedded_footnotes='Yes');

16 16 Simple PROC Report proc report data=skippy split='*' ls=256 headline nowd style(header)={font_weight=bold just=center}; title1 "Waterfall Report"; title2 "Total Accounts (Universe) " &title1_amt2.; footnote "Total Balance Leads (Eligible Accounts) " &eligible.; column y x TOT_REMAIN; define y / order=data 'Scrub'; define x / order=data style=numeric_data 'Amount'; define TOT_REMAIN / order=data style=numeric_data 'Remaining'; run;

17 17 Close Out The ODS ods tagsets.ExcelXP close; ods listing ; run;

18 18 Adding Tabs To The Worksheet ods tagsets.ExcelXP options(sheet_name='SAMPLE' embedded_titles='No' embedded_footnotes='No'); proc print data = &sample.(obs=&s_cnt.) ; run ;

19 19 Adding Tabs To The Worksheet ods tagsets.ExcelXP options(sheet_name='FREQS' sheet_interval='None' embedded_titles='No' embedded_footnotes='No'); proc freq data = &sample.; table &freq_vars./ missing ; run ;

20 20 Customizing The Format Of The Waterfall ODS PATH work.templat(update) sasuser.templat(read) sashelp.tmplmst(read); proc template; define style styles.waterfall; parent = styles.sansprinter; style numeric_data from data / tagattr='format:#,##0;;' just = right ; end; run;

21 21 Title Amount ****WATERFALL - TOTAL UNIVERSE; data _null_; if 0 then set nobs=nobs; put nobs=; call symputx('title1_amt2',put(nobs,comma11.)); call symputx('title1_amt',nobs); stop; run;

22 22 Footer Amount ***WATERFALL - TOTAL ELIGIBLE FOOTER***; data _null_; if 0 then set nobs=nobs; put nobs=; call symputx('eligible',put(nobs,comma11.)); stop; run;

23 23 Frequency Variables data _null_; freq_vars= 'dnc_flag cl_il_flag campaign_clean_flag bad_debt_flag exclude_flag acct_status_code active_flag ban_decile con_mnths_to_end_qty equip_offer list_id pv_offer'; call symputx('freq_vars',freq_vars); run;

24 24 Sample Tab

25 25 FREQS Tab

26 26 Review Two modules to include: %include '/MyDir/pgm/waterfall_macro.sas'; This module takes the number of observations from each dataset and saves the number as one row in a table. %include '/MyDir/pgm/multi_waterfall.sas‘ This module creates the actual output of a multi-sheet Excel spreadsheet

27 27 Review Call the macro from the main program as many times as necessary: ****WATERFALL - ROW 2; %ds_vol(work,affil_zip); Add code for the header and footer of the waterfall. ****WATERFALL - TOTAL UNIVERSE; data _null_; if 0 then set nobs=nobs; put nobs=; call symputx('title1_amt2',put(nobs,comma11.)); call symputx('title1_amt',nobs); stop; run;

28 28 Review Customize the labels for the waterfall: data wtitles; FORMAT Y $100.; INPUT Y; cards; Not_in_targeted_CL_List Active_Affiliate_Accounts_(affil_zip_flag) CJV_(cjv_flag) exclude_flag DNM Corporate_Exclusions Duplicates_by_Hierarchy_Number Bad_Address run;

29 29 Conclusion –Creating an audit waterfall programmatically fulfills a business need and saves time. Without it a programmer needs to cut and paste, gather files and manually format the spreadsheet. –Today I have presented one way to reach the goal of automation. Be creative and do what works for you but, hopefully, some of the code I shared with you today will be part of your next process.

30 30 Contact Information Denise A. Kruse DeniseAKruse@gmail.com 678-457-3677 Thanks: Bruce Johnson from SAS-L for help with proc template References: http://support.sas.com/rnd/base/ods/odsmarkup/p236- 31.pdfhttp://support.sas.com/rnd/base/ods/odsmarkup/p236- 31.pdf Eric Gebhart from SAS


Download ppt "Automation Of An Audit Waterfall Creating An Audit Waterfall For Clients Using Macros And ODS tagset.excelxp By Denise A. Kruse SAS Contractor."

Similar presentations


Ads by Google