Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
##SASGF13
Copyright © 2013, SAS Institute Inc. All rights reserved. 1
SAS® Global Forum 2014March 23-26 Washington, DC
2
Agenda Overview of PDF and HTML
What is measured output?
How to size your output?
What if my output is too tall?
What if my output is too wide?
How to control paneling?
How to work with non-tabular output?
##SASGF13
Copyright © 2013, SAS Institute Inc. All rights reserved. 2
3
Where to Get the Good Stuff? Go to the support.sas.com web site for SAS employee
papers:
http://support.sas.com/rnd/papers Navigate to section for SGF 2014 papers
Look for paper title and download the zip file of programs.
4
Introduce the Superheroes: HTML WomanHTML Woman represents the HTML destination. The highlights of the HTML destination superpowers are:• Works in browsers• Standard way to display content on the web• “Paperless” office (not designed for printing)• No “pages”• Browser receives HTML tags and “renders” the output
##SASGF13
Copyright © 2013, SAS Institute Inc. All rights reserved. 3
5
Introduce the Superheroes: PDF GuyPDF Guy represents the PDF destination. The highlights of the PDF destination superpowers are:• Output is image of report as it would be printed• ODS creates output to be opened with Acrobat Reader and
other PDF readers• “Paged” destination• “Measured” destination• Many system options impact PDF output.
6
Creation Story – ODS HTML First introduced SAS 7.0
HTML “invented” by Tim Berners-Lee at CERN laboratory. HTML is a subset of SGML.
With SAS 8, ODS HTML created 3.2 tags.
With SAS 9, ODS HTML created 4.0 tags.
With SAS 9.4, ODS will create HTML5 compliant tags.
##SASGF13
Copyright © 2013, SAS Institute Inc. All rights reserved. 4
7
Creation Story – ODS PDF Printer Family Destination introduced SAS 7.0
ODS PS output initially had to be “distilled” into PDF format manually
PDF only 1 of Printer Family Destinations
Printer & PostScript first destinations
PDF production in SAS 8.2
8
Starting Exampleoptions orientation=portrait topmargin=.25in bottommargin=.25in
leftmargin=.25in rightmargin=.25in number;
ods html file='c:\temp\default1.html' style=htmlblue;ods pdf file='c:\temp\default1_portrait.pdf' style=printer notoc;proc report data=sashelp.cars nowd;title 'Default Output Portrait Orientation';footnote 'The Footnote';
run;ods _all_ close;
##SASGF13
Copyright © 2013, SAS Institute Inc. All rights reserved. 5
9
HTML Output
1 PageOutput is as wide/long as it needs to be.
10
PDF OutputPortrait:26 PagesLandscape:18 Pages
##SASGF13
Copyright © 2013, SAS Institute Inc. All rights reserved. 6
11
Zoom In PDF
Too many variables for Portrait page, MAKE—INVOICE on page 1, ENGINESIZE—LENGTH on page 2
12
What is Measured OutputChanging margins and orientation will impact number of pages that “fit”. However with 2 simple changes to fontsize and cellpadding attributes in previous code we’ll see the : the size of the output, one such is font size. So, let’s make two simple changes to the PROC REPORT output to show how fontsize and cellpadding can impact output. Consider the following change to the PROC REPORT code:
proc report data=sashelp.cars nowdstyle(report)={fontsize=9pt cellpadding=2px}style(header)={fontsize=9pt}style(column)={fontsize=9pt};
##SASGF13
Copyright © 2013, SAS Institute Inc. All rights reserved. 7
13
Results
14
Fontsize and Cellpadding
Fontsize 8ptFontsize 10ptFontsize 12ptFontsize 14ptFontsize 16ptFontsize 18ptFontsize 20ptFontsize 24pt
Cellpadding is the amount of “white space” that surrounds the font in the cell. Note how both cellpadding and fontsize impact the “width” of the text.
2px
12px
22px
32px
62px
##SASGF13
Copyright © 2013, SAS Institute Inc. All rights reserved. 8
15
What if My Output Is Too Tall? HTML output can be as “tall” as it needs to be
PDF page size, margins, fontsize, and cellpadding all are used to determine what will fit in the page “height”
One simple way to break up the output is to add explicit page breaks using procedure controls, such as explicit PAGEBY statement in PROC PRINT or PAGE dimension in PROC TABULATE:
table make,model,type*mean*(msrp mpg_highway mpg_city);
16
PDF Output
##SASGF13
Copyright © 2013, SAS Institute Inc. All rights reserved. 9
17
HTML Output
The logical page break in HTML output is represented by HTML horizontal rule in output.
18
Creating Columns in PDF Use the COLUMNS= option to create multi-column
output. This will reduce the number of pages needed for your report.
ods pdf file='c:\temp\demo3_use_columns.pdf' notoc style=printer columns=2;
proc report data=cars nowd;column make model msrp;by type;. . . more code . . .
run;ods _all_ close;
##SASGF13
Copyright © 2013, SAS Institute Inc. All rights reserved. 10
19
PDF Output
Output for Sedan shown in 2 columns
Output for Wagon starts new page because of BY statement.
20
Columns For HTML To create columnar output in HTML, you need to use a
different HTML-based destination.ods tagsets.htmlpanel style=htmlblue
file='c:\temp\demo3_use_HTMLPANEL.html' options(panelcolumns='2' doc='help' panelborder='2'
embedded_titles='No');ODS tagsets.htmlpanel event=row_panel(start);
. . . proc report code . . . ods _all_ close;
##SASGF13
Copyright © 2013, SAS Institute Inc. All rights reserved. 11
21
ODS HTMLPANEL Output
Output for Wagon starts new column because of BY statement.
22
What If My Output Is Too Wide? Explicit paneling allows you to control wide output by
splitting the output into “panels”
PROC REPORT performs explicit paneling when you use the ID option and the PAGE option
proc report data= cars nowd spanrows style(report)={width=100%};column Make Type Model Origin DriveTrain
MSRP Invoice EngineSize Cylinders Horsepower MPG_City MPG_Highway Weight Wheelbase Length;
define make / order id;define type / order id;define Cylinders / page;break after make/page ;run;
Cylinders will start
##SASGF13
Copyright © 2013, SAS Institute Inc. All rights reserved. 12
23
PDF Output
The ID option causes MAKE and TYPE to repeat on every panel.
The PAGE option causes the new panel to start with CYLINDERS after the repeat of MAKE and TYPE variables.
24
STARTPAGE=NO When you use the
ODS PDF option STARTPAGE=NO, you can further control the panels. In this output, both panels appear on a single page.
##SASGF13
Copyright © 2013, SAS Institute Inc. All rights reserved. 13
25
STARTPAGE=NOW If you have multiple
steps, you can use STARTPAGE=NOW to generate an explicit page break between groups.
Two panels for Mazda on one page and two panels for Volvo on one page.
26
Use STYLE To Your Advantage
The JOURNAL style is a great black and white style that is designed for journal publication. It has a crisp “no interior lines” table look with black borders between the header columns and the data cell area.
##SASGF13
Copyright © 2013, SAS Institute Inc. All rights reserved. 14
27
Custom Style Template
28
Adjusting CELLHEIGHT Style overrides for CELLHEIGHT might be treated
differently by ODS PDF and ODS HTML.proc report data=sashelp.cars nowd. . . more code . . .style(summary)={font_face='Albany AMT' font_size=14pt
color=cx004c1a background=cxccccffcellheight=1.25in vjust=m};
. . . more code . . .compute msrp;if msrp.mean gt 80000 then do;call define(_col_,'style',
'style={cellheight=.75in vjust=m}');end;
##SASGF13
Copyright © 2013, SAS Institute Inc. All rights reserved. 15
29
CELLHEIGHT Output
same
different
30
Flowing Text with WIDTH Another way to impact the HEIGHT of the cell is to
impact the WIDTH of the cell. Especially for long text strings, the narrower the width, the more the text flows and the cell gets higher.
proc report data=cars nowd;column make model type msrp invoice;define model / style(column)={width=1.0in};
run;
proc report data=cars nowd;column make model type msrp invoice;define model / style(column)={width=2.0in};
run;
##SASGF13
Copyright © 2013, SAS Institute Inc. All rights reserved. 16
31
Compare Output with WIDTH=1.0in
32
Compare Output with WIDTH=2.0in
##SASGF13
Copyright © 2013, SAS Institute Inc. All rights reserved. 17
33
Inserting Logo and Text Decorationods escapechar='^';proc report data=sashelp.cars(obs=20) nowdstyle(report)={width=50%}style(header)={fontweight=bold fontsize=14pt
textdecoration=underline};title j=l
'^{style[preimage="c:\sgf2014\create_superhero.png"] }' j=r 'My Report';
title2 link="http://marvel.com/games/play/31/create_your_own_superhero" 'Create Your Own SuperHero}';
column make model msrp mpg_city;run;
34
Output Results
##SASGF13
Copyright © 2013, SAS Institute Inc. All rights reserved. 18
35
Non-Tabular Output Images, SAS/GRAPH, and ODS Graphics
PDF HTML
36
Conclusion Life and our comic books would be boring if all the
superheroes were the same. Part of the fun of reading about or watching superheroes is seeing how creative each one of them is when faced with an obstacle. Can ODS PDF be similar to ODS HTML and vice versa? The answer is sometimes.
##SASGF13
Copyright © 2013, SAS Institute Inc. All rights reserved. 19
37
Your Turn
Questions??
38