1 SAS ® ODS Technology for Today’s Decision Makers Sunil Gupta Quintiles.

Slides:



Advertisements
Similar presentations
Table, List, Blocks, Inline Style
Advertisements

Change font face Change font size Align left.
Using ODS Regions to Create Custom Reports Kate Morrow, M.S. Statistician Vermont Oxford Network, Burlington, VT.
Cascading Style Sheets (CSS). Cascading Style Sheets With the explosive growth of the World Wide Web, designers and programmers quickly explored and reached.
Html: getting started HTML is hyper text markup language. It is what web browsers look at on the Internet. HTML documents should be created in a simple.
INTRODUCTION TO HYPERTEXT MARKUP LANGUAGE 1. Outline  Introduction  Markup Languages  Editing HTML  Common Tags  Headers  Text Styling  Linking.
Visual Basic for Applications. What it does Extends the features and built in functions of Excel – Create and run VB procedures – Some may be easy to.
กระบวนวิชา CSS. What is CSS? CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles were added to HTML 4.0 to.
Outline Proc Report Tricks Kelley Weston. Outline Examples 1.Text that spans columnsText that spans columns 2.Patient-level detail in the titlesPatient-level.
HRP Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and.
How to Create a Custom Style Sonia Extremera / Antonio Nieto / Javier Gómez PhUSE Annual Conference, 9th-12th Oct 2011, Brighton UK.
SAS coding used in creating a routine report February 23, 2009 February is Heart Month.
TEA/TUG + ALDOT(Mobile) = H(O+I) The TEA/TUG being hosted by ALDOT in Mobile causes Hurricanes to come to Alabama. The TEA/TUG being hosted by ALDOT in.
Quick Data Summaries in SAS Start by bringing in data –Use permanent data set for these examples Proc Tabulate –Produces summaries very quickly and easily.
Introduction to SQL Session 1 Retrieving Data From a Single Table.
HTML: PART ONE. Creating an HTML Document  It is a good idea to plan out a web page before you start coding  Draw a planning sketch or create a sample.
Customize your SAS® Output with the Template Procedure: A Beginning Tutorial Carol Gosselin North Carolina State University, Raleigh, NC Joy Munk Smith.
Accessible Word Document Training Microsoft Word 2010.
How to Build Tabular Dashboards Using Proc Report
Welcome to SAS…Session..!. What is SAS..! A Complete programming language with report formatting with statistical and mathematical capabilities.
Copyright © 2006, SAS Institute Inc. All rights reserved. Randy Poindexter & Scott Huntley Output Delivery and Reporting An Introduction to ODS.
Week 3 Topic - Descriptive Procedures Program 3 in course notes Cody & Smith (Chapter 2)
Copyright © 2010, Meta-Xceed, Inc. All rights reserved. BI Flash and all other Meta-Xceed Inc. product or service names are registered trademarks or trademarks.
MORE HTML REMEMBER TO SEARCH W3 SCHOOLS FOR MORE INFO.
SAS PROC REPORT PROC TABULATE
HTML basics exercises.
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS ESSENTIALS -- Elliott & Woodward1.
Introduction to SAS BIO 226 – Spring Outline Windows and common rules Getting the data –The PRINT and CONTENT Procedures Manipulating the data.
1 Experimental Statistics - week 4 Chapter 8: 1-factor ANOVA models Using SAS.
More Basic HTML. Add spacing (single & double space) Save Refresh Add horizontal rule Add comments Add styles Add headings Add features Add alignments.
15.2 More Basic HTML. More Basic HTML Add spacing (single & double space) Save Refresh Add horizontal rule Add comments Add styles Add headings Add features.
LESSON 4 Formatting a Worksheet. Borders are often used to separate different groups of data. 1. True 2. False
XML Publisher Business Applications Government Forms.
Report Management Using the ODS DOCUMENT Destination and Report Metadata Brit Harvey February 2010.
PROC TEMPLATE: The Basics Lauren Haworth Genentech, Inc. South San Francisco, CA.
Essential ODS PDF Patrick Thornton.
PowerBuilder Online Courses - by Prasad Bodepudi
01/20151 EPI 5344: Survival Analysis in Epidemiology SAS code and output February 24, 2015 Dr. N. Birkett, School of Epidemiology, Public Health & Preventive.
M AKE E ASY S TYLE T EMPLATES U SING SAS M ACRO Barbara Harlan.
SAS Software Version 8 The Output Delivery System.
Using the new Version 8 Template Procedure for Complete Control of SAS Output Style and Format David Ghan Technical Training Specialist SAS, Canada.
SAS ODS (Output Delivery System) Donald Miller 812 Oswald Tower ;
Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.
Chapter 5 Reading and Manipulating SAS ® Data Sets and Creating Detailed Reports Xiaogang Su Department of Statistics University of Central Florida.
Lecture 3 Topic - Descriptive Procedures Programs 3-4 LSB 4:1-4.4; 4:9:4:11; 8:1-8:5; 5:1-5.2.
Chapter 4 concerns various SAS procedures (PROCs). Every PROC operates on: –the most recently created dataset –all the observations –all the appropriate.
Lesson 8 - Topics Creating SAS datasets from procedures Using ODS and data steps to make reports Using PROC RANK Programs in course notes LSB 4:11;5:3.
©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.
Computing with SAS Software A SAS program consists of SAS statements. 1. The DATA step consists of SAS statements that define your data and create a SAS.
FORMAT statements can be used to change the look of your output –if FORMAT is in the DATA step, then the formats are permanent and stored with the dataset.
Customize SAS Output Using ODS Joan Dong. The Output Delivery System (ODS) gives you greater flexibility in generating, storing, and reproducing SAS procedure.
Accessible Word Document Creation Using Microsoft Word 2010.
ODS TAGSETS - a Powerful Reporting Method Derek. 2 Agenda Understanding the tagset How to use tagsets Conclusion.
Based on Learning SAS by Example: A Programmer’s Guide Chapters 1 & 2
1 R3 R1 R5 R4 R6 R2 B B A A Looking at the Code Under the View menu Select Source.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 14 & 19 By Tasha Chapman, Oregon Health Authority.
TheGreatEscape(char) Prepared by Louise Hadden Lead Programmer Analyst April 2010 Abt Associates Inc.
Reporting The Facts: The ODSmemo macro suite for making reproducible RTF memos within SAS® Rocio Lopez Cleveland Clinic.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 16 & 17 By Tasha Chapman, Oregon Health Authority.
A MORE COMPLETE ODS REPORT. What we’re going to talk about…  Creating a title page  Creating an introduction page  Creating long-form text descriptions.
Chapter 5: Enhancing Your Output with ODS
Using ODS Excel Migrating from DDE to ODS
What is HTML? Structure of HTML Document HTML TAG HEAD TAG TITLE TAG
Loops BIS1523 – Lecture 10.
What is HTML? Structure of HTML Document HTML TAG HEAD TAG TITLE TAG
Instructor: Raul Cruz-Cano
Lesson 8 - Topics Creating SAS datasets from procedures
What is HTML? Structure of HTML Document HTML TAG HEAD TAG TITLE TAG
Presentation transcript:

1 SAS ® ODS Technology for Today’s Decision Makers Sunil Gupta Quintiles

2 SAS Users Manager: Excel file, HTML drill down files Programmer: HTML, PDF, RTF Statistician: p-values, plots

3 Agenda  What’s Unique about ODS?  Creating Excel Files  Efficient Data Analysis with ODS  Custom Formats in RTF files  Applying Style Syntax in Proc Tabulate and Proc Print

4 What’s Unique about ODS?  Destinations (Remember to turn off ODS) (Defines the output file type: HTML, RTF, PDF, LISTING, OUTPUT )  Creating Output Objects (Reference to Output Object Names)  Creating Output Files with Style (Reference to ‘SAS-Supplied’ Styles) Part of SAS/Base

5 Defining Output Destinations ODS HTML, Excel RTF Printer: PS, PDF PCL Standard: SAS List Output: SAS Dataset

6 Create Demog Data Set Patient, Sex, Height, Weight, Age, Race, Drug (n=25 records)

7 Creating Output Files: Report Files ODS File = ’ ’; SAS Procedure(s); ODS CLOSE; Where File Type = HTML, RTF, Listing, PDF,.. Keep consistent filename types:.html, rtf, lst, pdf,.. Results of one or more SAS Procedures

8 Example 1a. Create Excel File – demog.xls PROC UNIVARIATE DATA=DEMOG; VAR WEIGHT; RUN;

9 Example 1a. Create Excel File ODS HTML FILE = 'c:\how\gupta\demog.xls’ STYLE = minimal; PROC UNIVARIATE DATA=DEMOG; VAR WEIGHT; RUN; ODS HTML CLOSE; Try this in the office - Undocumented Feature. See SAS paper on Excel and ODS. (HTML,.xls) Excel

10 Example 1a. Create Excel File: demog.xls Each result item is in it’s own cell!

11 Example 1b. Create Demog_Style HTML File with Style PROC UNIVARIATE DATA=DEMOG; VAR WEIGHT; RUN;

12 Example 1b. Create HTML File with Style ODS HTML FILE = 'c:\how\gupta\demog_style.html' STYLE = barrettsblue; PROC UNIVARIATE DATA=DEMOG; VAR WEIGHT; RUN; ODS HTML CLOSE;

13 Example 1b. Create HTML File with Style (BARRETTSBLUE)

14 Creating Output Files with Style “SAS Supplied” Styles (partial list) NAME DESCRIPTION BarrettsBlue Blue header background, light table background Beige Beige header text, white text in table Brick Brick color header text, white text in table Brown Brown title, black header, light table background … (see Quick Results with the Output Delivery System book) Proc Template; list styles; run;

15 Efficient Data Analysis with ODS  Selecting Objects  Creating Output Data sets  Creating Multiple Data sets with the MATCH_ALL option  Using Traffic Lighting conditions to identify significance  Creating Plots and Tables as RTF file

16 Example 2a. Create Output Data Set Measure from Basic Measures Info ODS OUTPUT = ; PROC UNIVARIATE DATA=DEMOG; VAR WEIGHT; RUN; ODS OUTPUT CLOSE;

17 Creating Output Objects OUTPUTOBJECTSOUTPUTOBJECTS Results of PROC UNIVARIATE MomentsBasicMeasuresTestsForLocationQuantilesExtremeObs

18 Identifying Output Objects: List File Output Added: ODS TRACE ON / LABEL LISTING; (One of Several Output Objects Created) Name: BasicMeasures Label: Basic Measures of Location and Variability Template: base.univariate.Measures* Path: Univariate.weight.BasicMeasures Label Path: 'The Univariate Procedure'.'weight'.'Basic Measures of Location and Variability' * Except for: Proc Print, Proc Tabulate and Proc Report.

19 Example 2a. Create Output Data Set Measure from Basic Measures Info ODS TRACE ON / LABEL LISTING; *ODS OUTPUT = ; PROC UNIVARIATE DATA=DEMOG; VAR WEIGHT; RUN; ODS OUTPUT CLOSE;

20 Example 2a. Create Output Data Set Measure from Basic Measures Info ODS OUTPUT BASICMEASURES = MEASURE; PROC UNIVARIATE DATA=DEMOG; VAR WEIGHT; RUN; ODS OUTPUT CLOSE; Proc print; run; Note: OUTPUT OUT = statement in procedures are still valid! (Data set Name)(Object Name)

21 Example 2a. Create Output Data Set Measure * Proc print of MEASURE Output Data Set; Measure as SAS Data set Var Loc Obs Name Measure LocValue VarMeasure VarValue 1 weight Mean Std Deviation weight Median Variance weight Mode. Range weight _ Interquartile Range Get comfortable with the output data set.

22 Creating Output Data Sets  Works with any SAS Procedure  All results are available in the data set  Options are available for creating multiple data sets Note: Requires having information about the object. Can use the ODS TRACE statement to get this information.

23 Example 2b. Create Multiple Data Sets with the MATCH_ALL option ODS OUTPUT BASICMEASURES /* object name */ (MATCH_ALL = MEASURE_DSN /* macro name */ PERSIST = PROC) /* maintain selection list */ = MEASURE; /* data set names - measure, measure1, measure2 */ PROC UNIVARIATE DATA=DEMOG; VAR WEIGHT HEIGHT; RUN; PROC UNIVARIATE DATA=DEMOG; VAR AGE; RUN; ODS OUTPUT CLOSE; %PUT Macro variable = &MEASURE_DSN;

24 Example 2b. Create Multiple Data Sets with the MATCH_ALL option data allmeans; set &measure_dsn; /* set measure measure1 measure2; */ where locmeasure = 'Mean'; keep varname locmeasure locvalue; run; Var Loc Obs Name Measure LocValue 1 weight Mean height Mean age Mean

25 Example 3. Using Traffic Lighting low = green, high = orange proc format; value traffic low - 99 = ‘ ’ high = ‘ ’ ; quit; ods html file = ‘c:\how\gupta\print_results.htm’; proc report data=allmeans nowd; columns varname locvalue; define varname/ ‘Variable’; define locvalue / ‘Mean’ style = {background = }; run; ods html close;

26 Example 3. Using Traffic Lighting low = green, high = orange proc format; value traffic low - 99 = ‘green’ /* cx */ high = ‘orange’ /* cxFF9900 */ ; quit; ods html file = ‘c:\how\gupta\print_results.htm’; proc report data=allmeans nowd; columns varname locvalue; define varname/ ‘Variable’; define locvalue / ‘Mean’ style = {background = traffic.}; run; ods html close;

27 Using Traffic Lighting Conditions to identify significance Make results visually informative. Greater Than 100

28 Example 4. Create Plots and Tables as Plots.rtf File ; proc univariate data = demog ; var weight; ; run; ods rtf close;

29 Example 4. Create Plots and Tables as Plots.rtf File ods rtf file = ’c:\how\gupta\plots.rtf’; proc univariate data = demog plots; var weight; histogram / cfill=cyan; run; ods rtf close; Plots.rtf You can have it all - tables and plots in one file!

30 Example 4. Creating Plots and Tables as RTF File

31 Customize RTF File: RTF Control Words Effect Control Word Italics \i underline \ul  bullet \bullet bold \b subscript \sub superscript \super strike \strike ( -us/dnrtfspec/html/rtfspec.asp)

32 Customize RTF File: RTF Control Words 1. Carrot ‘^’ symbol is best as the escapechar symbol since the RTF syntax uses the \ symbol. 2. Use the following formula and conditions: “text” || ‘^R”\rtf-control-word text \rtf-control-word0 “’ a. Double quotes (“ ”) around “text” strings. b. Concatenate all strings with || operator. c. Use single quote (to set ‘^R) and then double quote to start rtf-control-word string (“\rtf-control-word). d. The text to be affected. e. Repeat and close each rtf-control-word string with 0, double quote (“) then single quote (‘), (\rtf-control-word0 “’).

33 Example 5. Custom RTF File: RTF Control Words - Title and Data Step ods escapechar = '^'; title1 '^R/RTF"\ul " Title contains underlined text'; data rtfcontrol; a = "The text uses RTF control words " || '^R"\i italic text \i0 "' || ' regular text ' || '^R"\ul underlined text \ul0 "'|| '^R"\strike strike text \strike0 "' ; run; ods rtf file = ’c:\how\gupta\rtf_control.rtf'; proc print data=rtfcontrol; run; ods rtf close; Be careful to match all quotes

34 Example 5. Custom RTF File: RTF Control Words - Title and Data Step Look what SAS can do - it really works! RTF

35 Example 6. Summary Table Using In- line Formatting Text in RTF files OPTIONS ORIENTATION=PORTRAIT nodate center; ODS ESCAPECHAR = ‘^’; /* required */ /* signals start of non SAS code - tags ex. {super a}*/ ODS RTF FILE = 'C:\how\gupta\table1.rtf' STYLE = MINIMAL /* Basic MS Word table, no color */ BODYTITLE; SAS Procedure(s) ODS RTF CLOSE; Be very careful of ODS BODYTITLE option!

36 Customize RTF File: Header/Footer Sections - Titles  Place font attributes before the text to apply  Syntax is different from footnote and SAS Procedures: PRINT, REPORT, and TABULATE  In version 8.2, Page X of Y feature requires print review/print to take affect. The following syntax is required: "{Page} {\field{\*\fldinst{ PAGE }}} \~{of}\~{\field{\*\fldinst { NUMPAGES }}}"

37 Example 6. Customize RTF File: Header/Footer Sections - Titles Title font=arial bold "Table 1. Baseline Table: Sex, Race^{super a} Page ^{pageof} "; Font: font= ; Height: height=8pt; Justify: j= ; Superscript: ^{super &text}; Subscript: ^{sub &text}; Page X of Y: ^{pageof}; (V 9.0) Face Weight Style

38 Customize RTF File: Header/Footer Sections - Footnotes  Place font attributes before the text to apply  Syntax is same as SAS Procedures: PRINT, REPORT, and TABULATE  Remember to turn off style just like like turning off ODS

39 Example 6. Customize RTF File: Header/Footer Sections - Footnotes Footnote1 ”^S={font_face=arial font_style=italic} ^{super a}Race: Non-White consists of Black, Hispanic, and Native American^S={} ”; Footnote2 ”^S={font_face=arial font_style=italic}Program: /stat/druga/program1.sas ^S={} ” ; Font: “^S={font_face=arial}&text ^S={}”; “^S={font_weight=bold}&text ^S={}”; “^S={font_style=italic}&text ^S={}”; Face Weight Style

40 Applying Style Syntax in Proc Tabulate PROC TABULATE style=[]; /* Style for all data cells */ class /style=[]; /* Style for column and row header */ var / style=[]; /* Style for analysis variable heading */ table style=[] /* Style for entire table */ / box=[style=[]] ; /* Style for box label */ run;

41 Example 6. Customize RTF File: Using PROC TABULATE %let mystyle =%str(font_face="arial" font_weight=bold); (PROC FORMAT; value gender, race, pctpct; quit;) PROC TABULATE data=demog missing formchar=' ' style=[font_face=" courier"]; class gender race drug/style=[&mystyle]; format gender gender. race race.; table (gender race), drug=' '* (n='N'*f=7. pctn =' %' *f=pctpct. ) / box=[label='Baseline ' style=[&mystyle] ] rts=43; run;

42 Example 6. Summary Table : Output Using PROC TABULATE Arial, Bold Courier RTF

43 Example 7. Customize RTF File: Using PROC TABULATE OPTIONS ORIENTATION=LANDSCAPE nodate center; %let mystyle =%str(font_face="arial" font_weight=bold); PROC TABULATE data=demog missing formchar=' ' style=[font_face=" courier"]; class gender race drug/style=[&mystyle]; classlev gender race drug/style=[&mystyle]; format gender gender. race race.; keyword n pctn/style=[&mystyle]; table (gender race), drug=' '* (n='N'*f=7. pctn =' %' *f=pctpct. ) / box=[label='Baseline ' style=[&mystyle] ] rts=43; run;

44 Example 7. Summary Table : Output Using PROC TABULATE w/ CLASSLEV and KEYWORD Arial, Bold RTF

45 Customize RTF File: Using PROC PRINT PROC PRINT style() = [] (header, data, obs, obshead, table) /* all headers, data, obs column, obs column header, data table */ var / style() = []; (data, header) /* separate var statements */ id / style() = []; (data, header) sum / style() = []; (data, header, total) run;

46 Example 8a. Customize RTF File: Using PROC PRINT ODS RTF FILE = 'C:\how\gupta\table3.rtf' STYLE = MINIMAL BODYTITLE; PROC PRINT data=demog (obs=5) noobs style(header) = [font_face="arial" font_weight=bold] style(data)= [font_face="arial"]; var patient drug gender race age height weight; fomat gender gender. race race.; run; ODS RTF Close;

47 Example 8a. Customize RTF File: Using PROC PRINT Arial, Bold Arial RTF

48 Example 8b. Table with 2 Columns ODS RTF FILE = 'C:\how\gupta\table3.rtf' STYLE = MINIMAL COLUMNS=2; PROC PRINT data=demog style(header) = [font_face="arial" font_weight=bold] style(data)= [font_face="arial"]; var patient drug gender race age height weight; fomat gender gender. race race.; run; ODS RTF Close;

49 Example 8b. Table with 2 Columns RTF

50 Summary: Where to Go From Here  Programmer, Statistician, Manager  Power & Flexibility  Customizing Output  Creating Excel Files  RTF-control words  Applying Style Syntax in Proc Tabulate and Proc Print

51 SAS® ODS Technology for Today’s Decision Makers ODS RESOURCES  The Complete Guide to the SAS Output Delivery System Version 8   Quick Results with the Output Delivery System  Output Delivery System: The Basics  Chevell Parker, Generating Custom Excel Spreadsheets Using ODS

52 SAS® ODS Technology for Today’s Decision Makers Quintiles

53 SAS ® ODS Technology for Today’s Decision Makers Sunil Gupta Quintiles