Presentation is loading. Please wait.

Presentation is loading. Please wait.

Managing Your SAS Output with the Document Procedure PhilaSUG Meeting March 15, 2011.

Similar presentations


Presentation on theme: "Managing Your SAS Output with the Document Procedure PhilaSUG Meeting March 15, 2011."— Presentation transcript:

1 Managing Your SAS Output with the Document Procedure PhilaSUG Meeting March 15, 2011

2 Outline Review of Output Delivery System What is the ODS Document and what can it do for you? Quick-Start course Listing and Replaying Documents Additional Capabilities – quick overview only How to find out more Q&A

3 Scenario – Which one is my analysis for TODAY's meeting?

4 3/15/114 What can be stored in a Document? SAS/Graph Graphics ODS Statistical GraphicsSAS Data Sets (small) Text Notes “As you can see from the previous output, the clustering is quite strong” SAS Procedural Output

5 Using The Document Procedure is EASY Save Output Now: ODS DOCUMENT NAME=philasug.mystuff; ODS DOCUMENT CLOSE; Replay Output Later proc document name=philasug.mystuff; replay; run; quit;

6 3/15/11 Two Approaches to Learning PROC Document “Google Approach” Use no folders, and use the WHERE statement to create searches to specify which output is replayed Good for beginners, so you can focus on ODS rather than file management Approach used in this presentation “Yahoo Approach” Use lots of folders, set them up before you even start adding output to the document Direct output to the propre folder with the ODS Document command Combination Most people will use a combination of these!

7 3/15/117 What sort of Output does the Document Store? To replay output, you need all three. The Document saves the first two, and some formats. Template Information ODS Table or Graph Formats Titles & Footnotes Object Notes Context

8 3/15/118 How the Output Delivery System Works Without The ODS Document

9 3/15/119 With the ODS Document

10 3/15/1110 Organization of the ODS Document Like a directory Output from Each SAS Procedure has its own Each folder Named for its procedure Can have more than one folder with PROC REG output, for instance Each output object and directory has a path-name, derived from ODS naming conventions

11 3/15/1111 Talking to the Output Delivery System Every output has an ODS pathname ods trace on; proc univariate data=sashelp.class; by sex; var height age; run; ods trace off;

12 3/15/1112 Ods Stores data in the document based on the ODS Pathname Output Added: (you can find this message in the Sas LOG) Name: Moments Label: Moments Template: base.univariate.Moments Path: Univariate.ByGroup1.Height.Moments Terminology of the ODS part II All four of these terms, Name, Label, Template, and Path can be used to search the document,hence worth learning Example ODS Trace output: Use it to teach you ODS names of output you commonly use.

13 3/15/1113 The ODS Document Statement, Building a Document ods document name= PROC …. DATA Steps with ODS output ODS Document Close; ODS Document exclude/exclude statements; ODS Include PARAMETERESTIMATES; Proc reg;...

14 3/15/11 Access Modes READ (read-only) access WRITE – not what it sounds! - ERASES the ENTIRE document, then inserts the new data. Should be called Over-write mode. Update – The default Will continually append new output after old output

15 3/15/11 Quick Aside – deleting a Document proc datasets lib=nesug mtype=itemstor; delete firstdoc; quit ; /* can also rename */ SAS ODS Documents are of type ITEMSTORE, which when abbreviated to eight letters is ITEMSTOR. The only place you need to know this fact is for this delete. For most document management tasks, use PROC DOCUMENT, NOT PROC DATASETS.

16 3/15/1116 List contents of document (LIST) commad Replay documents (REPLAY) command Create Labels for each output object Create, Manage, and Delete Folders Create Shortcuts to subfolders, Notes, Titles all without re-running the original analysis Make changes to graphs (SAS 9.3) Jobs of the Document Procedure

17 3/15/1117 Invoking The Document Procedure PROC DOCUMENT Name= ;

18 3/15/1118 LIST Command PROC DOCUMENT Name= ; LIST paths / options ; Run ; Quit ; Levels= n | ALL Details BYGroups Most Useful Options MUST HAVE!

19 3/15/1119 Output from LIST; with no options One directory (pathname) for each PROC called Levels=1 is the default Automatically generated Sequence Numbers ensure all objects have unique names Name of base directory (default is root directory)

20 3/15/1120 LIST / DETAILS LEVELS=ALL;

21 3/15/1121 What Happens when you Replay? To replay output, you need both. The power of PROC Document comes from the ability to change information in the Pink Square to modify appearance while leaving blue square alone. Style! Fonts Highlighting Fill Colors Actual Template Stored in Document Document Says: “I need Base.Sas.Reg to complete my work. ODS Says “I have that on file!”

22 3/15/1122 REPLAYING Output Proc document name=; Replay; Run; Quit;

23 3/15/11 Replaying The Document ods html body= style=BarrettsBlue; /*for SH */ ods rtf body= style=Printer; ods listing; /* needed for EG, since not turned on by default */ proc document name=nesug.firstdoc (read); list / order=alpha; replay / dest=(listing rtf html); run; quit; ods _all_ close; 2 1 3

24 3/15/1124 Restricting Output HIDE Command HIDE PATH; prevents the path and all its subfolders from being replayed HIDE REG#1; UNHIDE Command Opposite of Mr. Jekkyl

25 3/15/1125 The WHERE statement New as in 9.2 Can condition replay based on Dates of creation or modification Name of object (and this is why ODS Trace is so helpful) Label of object Pathname of Object By-Groups variables(if original code used BY groups) Can also be used on file management commands, so we can conditionally LIST.

26 3/15/1126 WHERE Statement Variables _CDATE_Creation Date _CDATETIME_Creation Date/Time _CTIME_Creation Time _LABELPATH_Path Name, in Label format _MDATE_,_MDATETIME_, _MTIME_ Similar to Cdate* variables, but cover modification time. _NAME_Name of current entry. The name is the rightmost entry of the path name. _PATH_Pathname of current entry _SEQNO_Sequence number of current entry _TYPE_Type of object: TABLE or DIRECTORY Variable nameThe variable name used as a by group. This is valid only when BY group analysis is used to create the output.

27 3/15/1127 WHERE Statement Examples Example 4. 1 Searching By Path list ^(where=(_path_ ? "Height")) / levels=all; run; /* quit */ Example 4. 2 Tables Only list ^(where=(_type_ = "Table")) / levels=all; Example 4. 3 Tables with BY Groups list ^ (where=(_type_ eq 'Table')) / levels=all bygroups; ^ represents the current directory. Usually can be dropped, but the WHERE statement needs a token before it.

28 3/15/1128 WHERE Statement Examples Example 4 By Group Example:Female Only list ^ (where=(_type_ = "Table") & (sex="F"))/ levels=all bygroups; Example 5 Univariate Output, Created Before September 6, list Univariate#1(where=(_cdate < '06Sep2010'd)); Example 4. 6 Using ODS Name objects. list reg#2(where=(_NAME_in ('FitStatistics','ParameterEstimates'));

29 3/15/1129 Make your own directories Create copies and links for faster reporting Modify Titles, formats, headers, columns, styles without altering output or rerunning original analysis Combining several reports into one for easy comparison Enhance output with traffic lighting, but without modifying the original data or defining new formats.s Intermediate Topics

30 3/15/1130 Finding out More Andrew Karp - “A Peek at the Document Procedure” - SGF 2007 #224 SAS Support ODS Document Tip Sheet tips.pdfhttp://support.sas.com/rnd/base/ods/scratch/document- tips.pdfNew from SAS Press: PROC Document using SAS – Available for Pre-order at NESUG 2011


Download ppt "Managing Your SAS Output with the Document Procedure PhilaSUG Meeting March 15, 2011."

Similar presentations


Ads by Google