My ODS - GASUG

Download Report

Transcript My ODS - GASUG

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

SAS ® process or

Output Object

procedure creates Output Object is one or composed of a data more component and for output most procedures, a objects. 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 stepinformation about how to format the results

Data Component + Output Object Table Template

My Proc Contents

My Proc Contents

List of Variables Only

Remove “The Contents Procedure”

My Proc Freq

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 ; edit Base.Freq.OneWayFreqs ;

My Proc Freq SASUSER.MYTEMPLATES

SASHELP.TMPLMST

Base.Contents.Attributes

Base.Contents.Variables

Base.Freq.OneWayFreqs

Etc. Before Edit

My Proc Freq SASUSER.MYTEMPLATES

Base.Freq.OneWayFreqs

SASHELP.TMPLMST

Base.Contents.Attributes

Base.Contents.Variables

Base.Freq.OneWayFreqs

Etc. After Edit

Base.Freq.Frequency

Base.Freq.Percent

For Further Study Base.Freq.OneWayList

Parent Template Base.Freq.OneWayFreqs

Child Templates Base.Freq.List

For Further Study SASHELP.TMPLMST

Stat.Discrim.ANOVA

contains DF column Common.ANOVA.DF

Which inherits from grandparent column Stat.Discrim.DF

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

My Proc Contents One Table of Output with:

Selected Attribute and EngineHost

Information

Selected Variable Information

My Proc Contents 1.

Modify existing table template with the changes we want:

Attribute info in the headerCombine type/length and

format/informat columns

Engine/Host info in the footerUse 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 James Centers for Disease Control and Prevention MS E-57 Atlanta, Ga.

(404) 639-6041 [email protected]