320 likes | 428 Views
My ODS: Real-World Uses of Modifying Table Templates . Steve James Centers for Disease Control and Prevention Atlanta, Ga. Goals. See useful examples of modifying procedure output Trigger your thoughts of how it could help you Motivate you to pursue your own study of table templates.
E N D
My ODS: Real-World Uses of Modifying Table Templates Steve James Centers for Disease Control and Prevention Atlanta, Ga.
Goals • See useful examples of modifying procedure output • Trigger your thoughts of how it could help you • Motivate you to pursue your own study of table templates
My SAS • Too much output from Proc Contents • Proc Freq frequencies don’t use a comma format. • “The FREQ Procedure” on the output.
My SAS • My Proc Contents • My Proc Freq • My Proc Contents
ODS Basics Output Object SAS® process or procedure creates one or more output objects. Output Object is composed of a data component and for most procedures, a template component. ODS statements route object(s) to destination.
ODS Basics • Some procedures might have only a single output object, whereas others have multiple output objects. • ODS stores a link to each output object in the Results folder, displayed interactively in the Results window. PROC PRINT has one output object. PROC UNIVARIATE has multiple output objects.
ODS Basics An output object is an object that contains both • the results of a Data step or PROC step • information about how to format the results Data Component Output Object + Table Template
My Proc Contents • List of Variables Only • Remove “The Contents Procedure”
My Proc Freq Frequency is formatted with a comma10. format Percent has a percent (%) sign added Column headings are customized
My Proc Freq Table Template Storage It is a type of SAS file called a template store. SAS Institute provides a template store called TMPLMST in the SASHELP directory.
My Proc Freq ODS PATH SASUSER.TEMPLAT (UPDATE) SASHELP.TMPLMST (READ) ;
My Proc Freq ODS PATH SASUSER.MYTEMPLATES (UPDATE) SASHELP.TMPLMST (READ) ;
My Proc Freq proc template ; define Base.Freq.OneWayFreqs ; <complete definition> edit Base.Freq.OneWayFreqs ; <code for items to change>
My Proc Freq SASUSER.MYTEMPLATES SASHELP.TMPLMST Base.Contents.Attributes Base.Contents.Variables Base.Freq.OneWayFreqs Etc. Before Edit
My Proc Freq SASUSER.MYTEMPLATES SASHELP.TMPLMST Base.Contents.Attributes Base.Contents.Variables Base.Freq.OneWayFreqs Etc. Base.Freq.OneWayFreqs After Edit
For Further Study Base.Freq.OneWayList Base.Freq.Frequency Base.Freq.Percent Parent Template Base.Freq.OneWayFreqs Base.Freq.List Child Templates
For Further Study SASHELP.TMPLMST Stat.Discrim.ANOVA contains DF column Common.ANOVA.DF Stat.Discrim.DF Which inherits from grandparent column Which inherits from parent column Stat.GLM.ANOVA contains DF column
My Proc Freq Return to Default Behavior? • proc template ; delete Base.Freq.OneWayFreqs ; • ods path sashelp.tmplmst (read) ;
My Proc Contents One Table of Output with: • Selected Attribute and EngineHost Information • Selected Variable Information
My Proc Contents • Modify existing table template with the changes we want: • Attribute info in the header • Combine type/length and format/informat columns • Engine/Host info in the footer • Use macro variables
My Proc Contents 2. Create a macro that: • Runs Proc Contents, storing output objects as SAS datasets • Reads SAS datasets and store info in macro variables. • Run Proc Contents again using new table template
Conclusion ODS allows you to add much more customization to your output simply and easily.
Acknowledgements Cynthia Zender – SAS Institute
Trademark Citation SAS is a registered trademark or trademark of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.
Contact Information:Steve JamesCenters for Disease Control and PreventionMS E-57Atlanta, Ga.(404) 639-6041sjames@cdc.gov