[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-1-en-105":3,"doc-seo-241741-105":53,"doc-detail-241741-en":118},{"code":4,"msg":5,"data":6},0,"success",[7,14,19,24,29,34,39,44,49],{"id":8,"doc_module":9,"doc_module_name":10,"category_name":11,"show_sort_weight":12,"slug":13},11,1,"Template","Presentations",90,"presentations",{"id":15,"doc_module":9,"doc_module_name":10,"category_name":16,"show_sort_weight":17,"slug":18},12,"Resumes",80,"resumes",{"id":20,"doc_module":9,"doc_module_name":10,"category_name":21,"show_sort_weight":22,"slug":23},14,"Invoices",70,"invoices",{"id":25,"doc_module":9,"doc_module_name":10,"category_name":26,"show_sort_weight":27,"slug":28},15,"Posters",60,"posters",{"id":30,"doc_module":9,"doc_module_name":10,"category_name":31,"show_sort_weight":32,"slug":33},16,"Social Media",50,"social-media",{"id":35,"doc_module":9,"doc_module_name":10,"category_name":36,"show_sort_weight":37,"slug":38},17,"Forms",40,"forms",{"id":40,"doc_module":9,"doc_module_name":10,"category_name":41,"show_sort_weight":42,"slug":43},18,"Letters",30,"letters",{"id":45,"doc_module":9,"doc_module_name":10,"category_name":46,"show_sort_weight":47,"slug":48},21,"Paper Templates",5,"papers-templates",{"id":50,"doc_module":9,"doc_module_name":10,"category_name":51,"show_sort_weight":4,"slug":52},158,"General","general-158",{"code":4,"msg":54,"data":55},"ok",{"site_id":56,"language":57,"slug":58,"title":59,"keywords":60,"description":61,"schema_data":62,"social_meta":111,"head_meta":113,"extra_data":115,"updated_unix":117},105,"en","sesug-2024-paper-035-a-sas-automation-example-for-completing-reporting-templates-in-microsoft-excel-using-a-driver-table-to-generate-vba-macros","SESUG 2024 Paper 035 - A SAS Automation Example for Completing Reporting Templates in Microsoft Excel - Using a driver table to generate VBA macros","","Monthly reporting often requires completing a provided Microsoft Excel template in a strict layout, which can increase complexity through customization and hardcoding. This example uses a SAS “driver” table to map each worksheet row to the SAS variable supplying the second-column value, and to generate the complete VBA macro text. The exported Excel output is formatted to match the required template, while the driver table can be extended for quality control to reduce human error.",{"@graph":63,"@context":110},[64,80,101],{"@type":65,"itemListElement":66},"BreadcrumbList",[67,71,74,77],{"item":68,"name":69,"@type":70,"position":9},"https://docshare.wps.com","Home","ListItem",{"item":72,"name":10,"@type":70,"position":73},"https://docshare.wps.com/template/",2,{"item":75,"name":11,"@type":70,"position":76},"https://docshare.wps.com/template/presentations/",3,{"item":78,"name":59,"@type":70,"position":79},"https://docshare.wps.com/template/sesug-2024-paper-035-a-sas-automation-example-for-completing-reporting-templates-in-microsoft-excel-using-a-driver-table-to-generate-vba-macros/241741/",4,{"url":78,"name":59,"@type":81,"image":82,"author":87,"headline":59,"publisher":90,"fileFormat":93,"inLanguage":57,"description":61,"dateModified":94,"datePublished":95,"encodingFormat":93,"isAccessibleForFree":96,"interactionStatistic":97},"DigitalDocument",{"url":83,"@type":84,"width":85,"height":86},"https://docshare.wps.com/thumbnails/sesug-2024-paper-035-a-sas-automation-example-for-completing-reporting-templates-in-microsoft-excel-using-a-driver-table-to-generate-vba-macros/241741.png","ImageObject",442,249,{"name":88,"@type":89},"8796093062539","Person",{"url":68,"name":91,"@type":92},"DocShare","Organization","application/pdf","2026-10-11","2026-09-12",true,{"@type":98,"interactionType":99,"userInteractionCount":73},"InteractionCounter",{"@type":100},"ViewAction",{"@type":102,"mainEntity":103},"FAQPage",[104],{"name":105,"@type":106,"acceptedAnswer":107},"How are VBA macros generated to make the exported Excel match the template?","Question",{"text":108,"@type":109},"The driver table also includes information describing VBA elements such as fonts, font sizes, bolding, and cell shading (RGB). SAS writes the complete VBA text into a text file so the appearance of the exported file matches the template.","Answer","https://schema.org",{"og:url":78,"og:type":112,"og:title":59,"og:site_name":91,"og:description":61},"article",{"robots":114,"canonical":78},"index,follow",{"doc_id":116,"site_id":56},241741,1791734173,{"code":4,"msg":5,"data":119},{"doc_id":116,"user_id":120,"nickname":88,"user_avatar":60,"doc_module":9,"category_id":8,"category_name":11,"doc_title":59,"doc_description":61,"doc_content":121,"file_id":122,"file_url":123,"file_type":124,"file_size":125,"view_count":126,"is_deleted":4,"is_public":9,"is_downloadable":9,"audit_status":9,"page_count":40,"language":127,"language_code":57,"site_id":56,"html_lang":57,"table_of_contents":128,"faqs":129,"seo_title":130,"seo_description":61,"update_tm":131,"read_time":126},8796093062539,"SESUG 2024 Paper 035  \nA SAS® Automation Example for Completing Reporting  \nTemplates in Microsoft® Excel  \nImelda C. Go, PhD, Palmetto GBA, Columbia, SC and Abbas S. Tavakoli, DrPH, MPH, ME, University of South Carolina  \nABSTRACT  \nThis example resulted from the need to report monthly data processing results by completing an Excel template used for reporting to the contracting party. In this case, the contracting party provided an Excel file with several formatted worksheets (e.g., first and second columns have bolding, cell shading, etc.) with the expectation that we would fill out the second-column cells . Instead of filling out the Excel template the customer provided, SAS creates an Excel file, which is made to look like the template. This example uses a“driver” table that maps each worksheet row to the SAS variable that has the value for the second column cell. The “driver” table also contains information that allows SAS to write into a text file the complete VBA in Excel macros, which can change the appearance of the exported file to look just like the required template. The “driver” can be extended to include columns that are useful for quality control when the programmer’s work is checked by another programmer .  \nINTRODUCTION  \nWhenever we are required to use a specific format and file to report, the level complexity of the task could increase due to customization, which in turn can lead to quite a bit of hardcoding. Using the “driver” table will help minimize the hardcoding since the table will contain the information needed to direct SAS to write the code we need. Without the driver table, any change in the reporting template could make it more difficult to revise the hardcoding.  \nThe value of this technique becomes more evident when the number of rows is large. A programmer might be able to manage a smaller number of rows with hardcoding, but as the number of rows increases, challenges will be greater. Also, last minute changes can leave less time for quality control. The automation safeguards us from human error provided the“driver” table itself is reliable since the SAS coding only does what the “driver” table tells it to.  \nREPORTING TEMPLATE  \nTo demonstrate this technique, we use the following contrived example to provide a few examples of the possibilities using a “driver” table, SAS, and VBA in Excel.  \nLet us suppose we are analyzing international wildlife data and are required to report  \nmonthly by completing the two Excel Worksheets below currently title for November 2023. The first Excel worksheet named Sightings has 14 rows:  \nThe second Excel worksheet named Finances has 9 rows:  \n“DRIVER” TABLE  \nWe take the two columns and all rows from the template and include them in the “Driver” Table . We want a generalized format and we note that Cell A1 in both worksheets contain a title with a date that will change each month. We change the value of“November 2023” to ** in the “Driver” table so that we can change ** to the correct month and year using SAS.  \nWe also add several columns, which are necessary to direct SAS to write the code for us . The first few additional columns are for SAS to map the SAS variable values to the corresponding row . The rest of the rows are for writing the VBA text that will transform the output into the template .  \nThe following table describes the columns in this “Driver” table. The VBA elements are described briefly. How to use VBA in Excel will not be discussed in this paper.  \n\n|  | “Driver” Table Column Name | Description |\n| --- | --- | --- |\n|  | ColumnA | This is the value of the first column from each worksheet. As noted earlier, we changed “November 2023” to “**” to generalize the information . We will use SAS to replace ** to the correct month and year. |\n|  | ColumnB | This is the contents of the second column from each worksheet. |\n|  | WSIndex | This is the ordinal number for each worksheet as they appear in the reporting template. It is 1 for the Sightings w","cbCailnTrQkyttTd","https://ap.wps.com/l/cbCailnTrQkyttTd","pdf",1527878,6,"English","# ABSTRACT\n# INTRODUCTION\n# REPORTING TEMPLATE\n# “DRIVER” TABLE\n# USE THE “DRIVER” TABLE TO WRITE THE CODE PROGRAMATICALLY","[{\"question\":\"How are VBA macros generated to make the exported Excel match the template?\",\"answer\":\"The driver table also includes information describing VBA elements such as fonts, font sizes, bolding, and cell shading (RGB). SAS writes the complete VBA text into a text file so the appearance of the exported file matches the template.\"}]","SESUG 2024 Paper 035 - A SAS Automation Example for Completing Reporting Templates in Microsoft Excel - Using a driver table to generate VBA macros | PDF",1789179860]