©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004...

29
©Dofasco Inc., 2004 ©Dofasco Inc., 2004 All rights reserved All rights reserved 1 Using the Output Using the Output Delivery System Delivery System October 22, 2004 October 22, 2004 Presentation to: Presentation to: The Toronto Area SAS The Toronto Area SAS Society Society

Transcript of ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004...

Page 1: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

©Dofasco Inc., 2004©Dofasco Inc., 2004All rights reservedAll rights reserved

11

Using the Output Using the Output Delivery SystemDelivery System

October 22, 2004October 22, 2004

Presentation to: Presentation to:

The Toronto Area SAS SocietyThe Toronto Area SAS Society

Page 2: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 22

AgendaAgenda

IntroductionIntroduction Book ReviewBook Review CD Book ReviewCD Book Review Some examples using ODSSome examples using ODS SummarySummary

Page 3: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 33

IntroductionIntroduction Book Review:Book Review:

Quick Results with the Output Delivery System, Sunil Quick Results with the Output Delivery System, Sunil Gupta, Gupta, © 2003, SAS Institute Inc.© 2003, SAS Institute Inc.

CD Book Review:CD Book Review:Instant ODS, Bernadette Johnson,Instant ODS, Bernadette Johnson,© 2003, SAS Institute Inc.© 2003, SAS Institute Inc.

Examples:Examples:Using ODS in some practical situations.Using ODS in some practical situations.

Page 4: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 44

Quick Results with the Output Quick Results with the Output Delivery SystemDelivery System

Beginner LevelBeginner Level About 100 pages (just the right length)About 100 pages (just the right length) Well writtenWell written Clear ExamplesClear Examples Logical ProgressionLogical Progression

Page 5: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 55

Basic ODS SyntaxBasic ODS SyntaxODS TRACEODS TRACE on / on / <options><options> ; ;

ODSODS destination destination <FILE=filename> <FILE=filename> ;;

ODS OUTPUTODS OUTPUT output-object-SAS-Data-Set-nameoutput-object-SAS-Data-Set-name ; ;

ODSODS <destination><destination> SELECTSELECT listlist ; ;

----- your program ----------- your program ------

ODSODS <destination><destination> CLOSECLOSE ; ;

ODS TRACEODS TRACE off; off;

Page 6: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 66

DestinationsDestinations

What format do you want your report in?What format do you want your report in? HTML – web pagesHTML – web pages PDF – acrobat readerPDF – acrobat reader RTF- document formatRTF- document format Printer formats- PRINTER, PS, PCLPrinter formats- PRINTER, PS, PCL LISTING- traditional SAS outputLISTING- traditional SAS output MAIL- email MAIL- email * not in book * not in book

ODSODS destination destination <FILE=filename> <FILE=filename> ;;(Remember to match the extension to the destination)

Page 7: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 77

ObjectsObjects Blocks of output created by SAS procedures.Blocks of output created by SAS procedures.

Univariate:Univariate: MomentsMoments BasicMeasuresBasicMeasures TestsForLocationTestsForLocation QuantilesQuantiles ExtremeObsExtremeObs

ODSODS <destination><destination> SELECTSELECT/EXCLUDE/EXCLUDE listlist ; ;

Page 8: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 88

Inserting Graphs Inserting Graphs filename odsout 'h:\Sas';filename odsout 'h:\Sas'; filename grafout 'h:\Sas';filename grafout 'h:\Sas'; goptions reset=all device=html;goptions reset=all device=html; ODS HTML path=odsout gpath=grafout body="Test.htm";ODS HTML path=odsout gpath=grafout body="Test.htm"; options ps=55 ls=80 nodate nonumber;options ps=55 ls=80 nodate nonumber;

title 'Steel Export Levels';title 'Steel Export Levels'; axis1 label=(a=-90 'Millions of Tons Exported');axis1 label=(a=-90 'Millions of Tons Exported'); symbol1 v=none i=join l=1 w=3;symbol1 v=none i=join l=1 w=3;

proc gchart data=sashelp.steel;proc gchart data=sashelp.steel; vbar date/discrete freq=steel raxis=axis1;vbar date/discrete freq=steel raxis=axis1; run;run;

proc gplot data=sashelp.steel;proc gplot data=sashelp.steel; plot steel*date/ vaxis=axis1;plot steel*date/ vaxis=axis1; run;run;

ODS HTML Close;ODS HTML Close; run;run;

Note: We are using a SAS Sample Data Set found in SASHELP

Page 9: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 99

Inserting GraphsInserting Graphs

BASE HTML FILE

INDEX FILE VARIOUS GRAPHS

Page 10: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 1010

Viewing HTML OutputViewing HTML Output

Page 11: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 1111

Instant ODS- Using StylesInstant ODS- Using Styles 50 pre-packaged styles in HTML, PDF and 50 pre-packaged styles in HTML, PDF and

RTF format. RTF format.

Step 1: Check the system requirementsStep 1: Check the system requirements Step 2: Save the ODS library to a hard diskStep 2: Save the ODS library to a hard disk Step 3: Select a styleStep 3: Select a style Step 4: Insert your code into the basic ODS Step 4: Insert your code into the basic ODS

code providedcode provided Step 5: Run program and enjoy results.Step 5: Run program and enjoy results.

Page 12: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 1212

Instant ODS- Using StylesInstant ODS- Using Styles

Some notes:Some notes: Match the code to the style carefullyMatch the code to the style carefully When you use the code provided open in When you use the code provided open in

Notepad first (code_files folder on CD) and Notepad first (code_files folder on CD) and copy and paste into the editorcopy and paste into the editor

Print the welcome.pdf filePrint the welcome.pdf file The time savings is great for the price!The time savings is great for the price!

Page 13: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 1313

An Instant ODS ExampleAn Instant ODS Example Program:Program:

ODS PATHODS PATH (PREPEND) demo.ODS(READ); (PREPEND) demo.ODS(READ);

GOPTIONSGOPTIONS HSIZE= HSIZE=77 IN VSIZE= IN VSIZE=55IN; *size graphs 2.5in by 3.5in;IN; *size graphs 2.5in by 3.5in;

ODS MARKUPODS MARKUP TAGSETTAGSET=web_graph_1 =web_graph_1 FRAMEFRAME='h:\sas\demo\html-frame-tassdemo2.htm' ='h:\sas\demo\html-frame-tassdemo2.htm' BODYBODY='h:\sas\demo\html-body-tassdemo2.htm' ='h:\sas\demo\html-body-tassdemo2.htm' CONTENTSCONTENTS='h:\sas\demo\html-table-contents-tassdemo2.htm'='h:\sas\demo\html-table-contents-tassdemo2.htm' GPATHGPATH='h:\sas\demo' (URL=NONE) ='h:\sas\demo' (URL=NONE) ; ;

goptionsgoptions cback=cream; cback=cream; titletitle f=zapfb h= f=zapfb h=1.751.75 'Steel Exports in Millions of Tons'; 'Steel Exports in Millions of Tons'; symbol1symbol1 i=join l= i=join l=11 w= w=44 v=none c=white; v=none c=white; axis1axis1 label=(a= label=(a=9090 f=zapfb h= f=zapfb h=1.51.5 'Millions of Tons'); 'Millions of Tons'); axis2axis2 label=(f=zapfb h= label=(f=zapfb h=1.51.5 'Year' ); 'Year' ); proc gplotproc gplot data=sashelp.steel; data=sashelp.steel; plotplot steel*date/haxis=axis2 vaxis=axis1 cframe=cream; steel*date/haxis=axis2 vaxis=axis1 cframe=cream; runrun;;

ODS MARKUP CLOSEODS MARKUP CLOSE; ; RunRun;;

Page 14: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 1414

ODS OutputODS Output

Page 15: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 1515

Do-it-yourself ExampleDo-it-yourself Example Step 1: Set up a new style templateStep 1: Set up a new style template Program (Sets up a place to keep the style):Program (Sets up a place to keep the style):

libname demo 'h:\sas\demo';libname demo 'h:\sas\demo'; ods path demo.mytemp(update) sashelp.tmplmst(read);ods path demo.mytemp(update) sashelp.tmplmst(read); ODS PATH SHOW ;ODS PATH SHOW ; procproc templatetemplate; ;

edit styles.default as styles.sc;edit styles.default as styles.sc; style data from cell /background=vligb;style data from cell /background=vligb; style header from headersandfooters background=vligb;style header from headersandfooters background=vligb;

Page 16: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 1616

Do-it-yourself ExampleDo-it-yourself Example Program cont’d (General Colors and Styles):Program cont’d (General Colors and Styles):

style table from output /style table from output / background=black borderwidth=background=black borderwidth=1 1 tagattr='align="left"';tagattr='align="left"'; style color_list / 'bgA' = ligb 'fgA2' = blackstyle color_list / 'bgA' = ligb 'fgA2' = black 'fgA1'= black 'fga'= black;'fgA1'= black 'fga'= black; style colors /style colors / 'contitlefg'=color_list('fgA2')'contitlefg'=color_list('fgA2') 'confolderfg'=color_list('fgA2');'confolderfg'=color_list('fgA2'); style fonts /style fonts / 'headingFont' = ("Arial, Helvetica, Helv", 'headingFont' = ("Arial, Helvetica, Helv", 11, ,

demi_bold)demi_bold) 'docFont' = ("Arial, Helvetica, Helv",'docFont' = ("Arial, Helvetica, Helv",11,demi_bold),demi_bold) 'titlefont' = ("Arial, Helvetica, Helv",'titlefont' = ("Arial, Helvetica, Helv",11,bold);,bold);

Page 17: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 1717

Do-it-yourself ExampleDo-it-yourself Example

Program cont’d (Table of Contents):Program cont’d (Table of Contents): style contenttitle from indextitle /font=(arial,style contenttitle from indextitle /font=(arial,33,bold);,bold);

(Content Title)(Content Title) style contentproclabel from contentprocname style contentproclabel from contentprocname

/font=(arial,/font=(arial,22);); (Label replacing the procedure)(Label replacing the procedure)

style contentprocname from indexprocname /font=(arial,style contentprocname from indexprocname /font=(arial,22);); (The Procedure Name)(The Procedure Name)

style Bycontentfolder from Bycontentfolder /font=(arial,style Bycontentfolder from Bycontentfolder /font=(arial,22);); (The by-variable info)(The by-variable info)

style contentitem from indexitem /font=(arial,style contentitem from indexitem /font=(arial,22);); (The item is the list)(The item is the list)

Page 18: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 1818

Do-it-yourself ExampleDo-it-yourself Example Program cont’d (Table of Contents cont’d…):Program cont’d (Table of Contents cont’d…):

style contentProcname from Indexprocname /bullet=none;style contentProcname from Indexprocname /bullet=none; style ByContentFolder from ContentFolder /Bullet = NONEstyle ByContentFolder from ContentFolder /Bullet = NONE ListEntryAnchor = yesListEntryAnchor = yes PreHtml = _undef_PreHtml = _undef_ PostHtml = _undef_;PostHtml = _undef_;

Style ContentItem from IndexItem /Bullet = NONEStyle ContentItem from IndexItem /Bullet = NONE ListEntryAnchor = yesListEntryAnchor = yes PreHtml = _undef_PreHtml = _undef_ PostHtml = _undef_PostHtml = _undef_ pretext="<div style='text-decoration:none'>"pretext="<div style='text-decoration:none'>" posttext="</div>"; posttext="</div>";

Page 19: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 1919

Do-it-yourself ExampleDo-it-yourself Example

Program cont’d (Table of Contents cont’d…):Program cont’d (Table of Contents cont’d…): Style ContentTitle from IndexTitle /Style ContentTitle from IndexTitle / PRETEXT='MECHANICAL PROPERTIES BREAKDOWN PRETEXT='MECHANICAL PROPERTIES BREAKDOWN

FOR 2003- ALL TESTS';FOR 2003- ALL TESTS'; style contents from documents /style contents from documents / background=vligb;background=vligb; style table from output /style table from output / outputwidth=outputwidth=1010%;%; end; end;

runrun; ;

Page 20: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 2020

Do-it-yourself ExampleDo-it-yourself Example

The Log:The Log:

Page 21: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 2121

Do-it-yourself ExampleDo-it-yourself Example

Using the style:Using the style: The program:The program:

libname sasdata 'h:\sas\demo';libname sasdata 'h:\sas\demo'; procproc templatetemplate;; define style new;define style new; parent=styles.sc;parent=styles.sc; *Changing Title name of the table of contents;*Changing Title name of the table of contents; replace ContentTitle from IndexTitle /replace ContentTitle from IndexTitle / PRETEXT='2003 Summary-By Grade Group'PRETEXT='2003 Summary-By Grade Group' font=(arial,font=(arial,33,bold);,bold); END;END; RUNRUN;;

Page 22: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 2222

Do-it-yourself ExampleDo-it-yourself Example The Program cont’d:The Program cont’d: options nocenter;options nocenter; filename odsout 'h:\sas\demo\'; filename odsout 'h:\sas\demo\'; ods listing close;ods listing close; ods html path=odsout ods html path=odsout contents="TassDemo_Contents.htmlcontents="TassDemo_Contents.html frame="TassDemo_Frame.html"frame="TassDemo_Frame.html" body="TassDemo_Body.html“ newfile=output style=new;body="TassDemo_Body.html“ newfile=output style=new;

ODS PROCLABEL 'BY GRADE GROUP';ODS PROCLABEL 'BY GRADE GROUP'; options pageno=options pageno=11 device=win; device=win; title1 'MECHANICAL PROPERTIES 2003 - Jan to Dec' ;title1 'MECHANICAL PROPERTIES 2003 - Jan to Dec' ; TITLE2 ;TITLE2 ; FOOTNOTE1 'Note: Includes all test results';FOOTNOTE1 'Note: Includes all test results';

Page 23: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 2323

Do-it-yourself ExampleDo-it-yourself Example The Program cont’d:The Program cont’d: procproc tabulatetabulate data=demo.test2 contents=''; data=demo.test2 contents=''; class GradeGrp GradeNo StdCode DirectCd class GradeGrp GradeNo StdCode DirectCd DispCd TempNo TemperCd ThickRange;DispCd TempNo TemperCd ThickRange; var Yield TensileA ElongB Mech1020 ;var Yield TensileA ElongB Mech1020 ; keylabel mean='Avg';keylabel mean='Avg'; label DispCd= 'Dispo';label DispCd= 'Dispo'; table GradeGrp=“", all GradeNo='GRADE'* ThickRange='THICKNESS'*table GradeGrp=“", all GradeNo='GRADE'* ThickRange='THICKNESS'* TempNo='TEMP'* TemperCD='CW'* DirectCd='DIR'* TempNo='TEMP'* TemperCD='CW'* DirectCd='DIR'* StdCode='STDC'* (all DispCd),StdCode='STDC'* (all DispCd), Yield='YIELD'*(n*f=Yield='YIELD'*(n*f=4.04.0 mean*f= mean*f=5.15.1 std*f= std*f=4.14.1 min*f= min*f=5.15.1 max*f= max*f=5.15.1)) TensileA='TENSILE'*(mean*f=TensileA='TENSILE'*(mean*f=5.15.1 std*f= std*f=4.14.1 min*f= min*f=5.15.1 max*f= max*f=5.15.1)) ElongB='ELONGATION'*(mean*f=ElongB='ELONGATION'*(mean*f=5.15.1 std*f= std*f=4.14.1 min*f= min*f=5.15.1 max*f= max*f=5.15.1)) Mech1020='MECHVAL'*(mean*f=Mech1020='MECHVAL'*(mean*f=5.35.3 std*f= std*f=5.35.3 min*f= min*f=5.35.3 max*f= max*f=5.35.3)) /condense misstext='-' contents=‘ ' ;/condense misstext='-' contents=‘ ' ; runrun; ; ods html close;ods html close; ods listing;ods listing;

Page 24: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 2424

Do-it-yourself ExampleDo-it-yourself Example The Output:The Output:

Page 25: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 2525

Do-it-yourself ExampleDo-it-yourself Example

Page 26: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 2626

Instant ODS ExampleInstant ODS Example The Output using an The Output using an

ODS template:ODS template:

Page 27: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 2727

Instant ODS ExampleInstant ODS Example

Page 28: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 2828

SummarySummary

Quick Results using the Output Delivery Quick Results using the Output Delivery SystemSystem

Instant ODSInstant ODS

Do-it-yourself ExampleDo-it-yourself Example

Instant ODS ExampleInstant ODS Example

Page 29: ©Dofasco Inc., 2004 All rights reserved 1 Using the Output Delivery System October 22, 2004 Presentation to: The Toronto Area SAS Society.

October 22, 2004October 22, 2004© Dofasco Inc. 2004© Dofasco Inc. 2004All rights reservedAll rights reserved 2929

Questions?Questions?

Contact information:Lesley Harschnitz- [email protected] Cunningham- [email protected]