Presentation is loading. Please wait.

Presentation is loading. Please wait.

Customize SAS Output Using ODS Joan Dong. The Output Delivery System (ODS) gives you greater flexibility in generating, storing, and reproducing SAS procedure.

Similar presentations


Presentation on theme: "Customize SAS Output Using ODS Joan Dong. The Output Delivery System (ODS) gives you greater flexibility in generating, storing, and reproducing SAS procedure."— Presentation transcript:

1 Customize SAS Output Using ODS Joan Dong

2 The Output Delivery System (ODS) gives you greater flexibility in generating, storing, and reproducing SAS procedure and DATA step output. stores your output in its component parts (data and table definition) so that numerical data retains its full precision. offers many options for formatting SAS output. Default templates can be replaced with custom templates. Output from entire SAS jobs can be modified with style-definitions and single output objects can be formatted with user created table-definitions.

3 List of ODS Destinations and Options ODS destinations are designations that produce specific types of output. ODS supports a number of destinations, including the following: ODS LISTING is the SAS classic output ODS HTML creates HTML files, You can browse these files with Internet Explorer, Netscape, etc. ODS OUTPUT creates SAS data sets ODS PS or PDF creates output in PostScript format or PDF file ODS RTF produces output that is formatted for use with Microsoft Word

4 The UNIVARIATE Procedure (classic sas output) Variable: Days Moments N 40 Sum Weights 40 Mean 250.625 Sum Observations 10025 Std Deviation 51.3078629 Variance 2632.49679 Skewness 0.37222034 Kurtosis 0.13693119 Uncorrected SS 2615183 Corrected SS 102667.375 Coeff Variation 20.4719652 Std Error Mean 8.11248543 Basic Statistical Measures Location Variability Mean 250.6250 Std Deviation 51.30786 Median 254.0000 Variance 2632 Mode 256.0000 Range 222.00000 Interquartile Range 48.50000 Tests for Location: Mu0=3.5 Test -Statistic- -----p Value------ Student's t t 30.4623 Pr > |t| <.0001 Sign M 20 Pr >= |M| <.0001 Signed Rank S 410 Pr >= |S| <.0001 Quantiles (Definition 5) Quantile Estimate 100% Max 378.0 99% 378.0 95% 340.0 90% 324.0 75% Q3 269.0 50% Median 254.0 25% Q1 220.5 10% 179.5 5% 164.0 1% 156.0 0% Min 156.0 Extreme Observations ----Lowest---- ----Highest--- Value Obs Value Obs 156 23 323 24 157 31 325 12 171 10 325 14 179 1 355 4 180 35 378 2

5 Example of  HTML output  PDF output  RTF output

6 Ways for you to customize the output Selection and Exclusion Lists Selection and exclusion lists determine which output objects are sent to open destinations Requested output objects must be on the overall selection list and the selection list for each desired destination Selection lists can be viewed with ODS destination SHOW.

7 ODS TRACE statement The ODS TRACE statement displays information about each of the output objects generated by SAS procedures in the LOG window. This information is necessary for identifying objects on SELECT, EXCLUDE, and ODS OUTPUT statements. The trace record has the following components: Name is the name of the output object. Label is the label that briefly describes the contents of the output object. Template is the name of the table definition that ODS used to format the output object. Path shows the location of the output object.

8 ods trace on; 41 42 proc univariate data=exposed mu0=3.5; 43 var days; 44 run; Output Added: ------------- Name: Moments Label: Moments Template: base.univariate.Moments Path: Univariate.Days.Moments ------------- Output Added: ------------- Name: BasicMeasures Label: Basic Measures of Location and Variability Template: base.univariate.Measures Path: Univariate.Days.BasicMeasures ------------- Output Added: ------------- Name: TestsForLocation Label: Tests For Location Template: base.univariate.Location Path: Univariate.Days.TestsForLocation ------------- Output Added: ------------- Name: Quantiles Label: Quantiles Template: base.univariate.Quantiles Path: Univariate.Days.Quantiles ------------- Output Added: ------------- Name: ExtremeObs Label: Extreme Observations Template: base.univariate.ExtObs Path: Univariate.Days.ExtremeObs ------------- 46 ods trace off;

9 Select desired output objects to create new output. ODS select ODS exlude

10 ods select BasicMeasures TestsForLocation; proc univariate data=exposed; var days; run; The UNIVARIATE Procedure Variable: Days Basic Statistical Measures Location Variability Mean 250.6250 Std Deviation 51.30786 Median 254.0000 Variance 2632 Mode 256.0000 Range 222.00000 Interquartile Range 48.50000 Tests for Location: Mu0=0 Test -Statistic- -----p Value------ Student's t t 30.89374 Pr > |t| <.0001 Sign M 20 Pr >= |M| <.0001 Signed Rank S 410 Pr >= |S| <.0001

11 ods exclude BasicMeasures TestsForLocation Quantile ExtremeObs ; proc univariate data=exposed; var days; run; The UNIVARIATE Procedure Variable: Days Moments N 40 Sum Weights 40 Mean 250.625 Sum Observations 10025 Std Deviation 51.3078629 Variance 2632.49679 Skewness 0.37222034 Kurtosis 0.13693119 Uncorrected SS 2615183 Corrected SS 102667.375 Coeff Variation 20.4719652 Std Error Mean 8.11248543 Quantiles (Definition 5) Quantile Estimate 100% Max 378.0 99% 378.0 95% 340.0 90% 324.0 75% Q3 269.0 50% Median 254.0 25% Q1 220.5 10% 179.5 5% 164.0 1% 156.0 0% Min 156.0

12 Output Datasets ods output Quantiles=qtl; proc univariate data=exposed; var days; run; Var Obs Name Quantile Estimate 1 Days 100% Max 378.0 2 Days 99% 378.0 3 Days 95% 340.0 4 Days 90% 324.0 5 Days 75% Q3 269.0 6 Days 50% Median 254.0 7 Days 25% Q1 220.5 8 Days 10% 179.5 9 Days 5% 164.0 10 Days 1% 156.0 11 Days 0% Min 156.0

13 Change the output using template To create your own ODS schemes, you need to create what is called a template. To create and modify templates you need to use the procedure proc template. Two parts to ODS output: an overall style, and individual table definitions. The overall style consists of general formats like: colors for backgrounds, default fonts,etc. Individual table definitions are things like: the order of columns in a table, SAS format to use for column headings, etc.

14 Templates are stored like other SAS files, but can have multiple level names. The main “unit” of a template “group” is a template store. Within the template store may be many templates, where styles, table elements, etc. are stored. It’s basically like a directory for templates. There are a lot of options using this procedure, it appears that you can have a lot of control over how things are formatted.

15 libname in ‘D:/newtemplates’; Proc template; define style newstyle.testout store=in.newstore; style celldatasimple / font_face=arial background=very light vivid blue foreground=white; run;

16

17 REFERENCES SAS Institute Inc. SAS help and documentation Version 9.1.3, Cary, NC: SAS Institute Inc. ODS documentation is contained in the SAS Procedures Guide; Concepts; Fundamental Concepts for Using Base SAS Procedures; Language Concepts. SUGI papers related to ODS

18 Thank You !

19


Download ppt "Customize SAS Output Using ODS Joan Dong. The Output Delivery System (ODS) gives you greater flexibility in generating, storing, and reproducing SAS procedure."

Similar presentations


Ads by Google