200 likes | 378 Views
Report Management Using the ODS DOCUMENT Destination and Report Metadata. Brit Harvey February 2010. Software. SAS 9.2 Base Access to PC File Formats Spreadsheet: Excel 2007 Operating System: Windows XP. User Requirements. Two hundred reports One program per report
E N D
Report Management Using the ODS DOCUMENT Destination and Report Metadata Brit Harvey February 2010
Software • SAS 9.2 Base Access to PC File Formats • Spreadsheet: Excel 2007 • Operating System: Windows XP
User Requirements • Two hundred reports • One program per report • Final product: Combined, ordered reports in multiple PDF/RTF files with report title bookmarks in PDFs. • Support frequent changes in report combinations, ordering, and bookmarks.
Previous Approach • Write reports to RTF. • Combine to PDF using Acrobat. • Assign bookmark text using a PDF software package and manual entry for figures. • Update combined reports manually using Acrobat PDF page deletion and insertion. Manually update bookmarks. • Many manual tasks, high error potential.
Report Management System • Maintain report metadata in Excel 2007. • Write report content to an ODS DOCUMENT destination item store. During development write individual reports to either PDF or RTF for review. • Render reports to multiple bookmarked PDFs and RTFs using PROC DOCUMENT. • Report content generation and rendering are decoupled.
Benefits • Bookmarked PDF output is generated programmatically by SAS. • Manual work is eliminated. • No PDF software other than SAS is required. • Shorter run times • Rendering requires minimal computer resources • Flexibility • Many changes to report specifications are relatively easy to implement by updating report metadata.
ODS Document Sample Code ods document name = mds.doc (update) dir = ( path = \t_02_01 (write) label=“Demographic Characteristics" ) ;
PROC DOCUMENT Sample Code ods tagsets.rtf file="..\rpt\rtf\tables.rtf" style=tlib.tmpl.t_01 ; ods pdf file="..\rpt\pdf\tables.pdf" style=tlib.tmpl.t_01 pdftoc=1; proc document name = mds.doc ; replay t_02_01.#1 / activetitle activefootn ; run ; quit ; ods _all_ close ;
Macros: %rptmeta • Reads report metadata • Assigns titles/footnotes • Executed in report programs prior to report generation statements, such as PROC REPORT.
Macros: %render • Reads report metadata • Assign titles/footnotes (again) • Controls output files to write • Renders reports to RTF and PDF output files. Assigns PDF bookmarks.
Development Program Outline summarization (PROC MEANS, etc.) %rptmeta (assign titles/footnotes) ODS document (write to item store) PROC REPORT ODS document close ODS PDF PROC DOCUMENT (render from item store) ODS PDF close
Document Item Store Contents Obs 1 Path \t_02_01#1 Type Dir Size in Bytes Created 06OCT2009:14:43:29 Modified 06OCT2009:14:43:41 Symbolic Link Template Label Demographic Characteristics
Update Procedure Suppose an analysis data set is updated. • Rerun only affected report programs. • Execute %render to render combined reports. Suppose report combination requirements are updated. • Update report metadata • Execute %render to render reports.
PROC DOCUMENT ISSUES • Reports written with PROC REPORT using a CALL DEFINE statement cause a fatal SAS error when rendered using PROC DOCUMENT in a program other than the one that wrote to the item store. This defect is recognized by SAS and is scheduled to be corrected in the 9.2 M3 maintenance release, which is expected in the second quarter of this year.
PROC DOCUMENT ISSUES • Title/footnote inline style and justification options (justify, height, etc.) written to the item store are ignored when rendered by PROC DOCUMENT. SAS Problem Note 38108 states a workaround involving reassigning titles/footnotes and options in the render program. This is relatively easy to implement when report metadata is used. SAS plans a fix in version 9.3.
Conclusion • Users managing many reports, multiple output formats, and PDF bookmarks may want to consider a system using the ODS DOCUMENT destination and report metadata. • This approach builds on existing report metadata and is not difficult to implement. • PROC REPORT users will probably need to wait for the SAS 9.2 M3 maintenance release.
Contact Information basas@britharvey.com