Prior to SAS® 9.4, there was not production syntax to enable the precise, non-columnar placement of tables, text, and images on a PDF page. ODS LAYOUT syntax provides these features and provides new production syntax starting in SAS 9.4 (TS1M0). ODS LAYOUT syntax facilitates the precise placement of text, tables, and images on a PDF page using ODS REGION statements.
The sample code on the Full Code tab illustrates the use of ODS LAYOUT ABSOLUTE to place output created by the ODSLIST, ODSTEXT, REPORT, and SGPLOT procedures on the same page. The keyword ABSOLUTE is not necessary as it is implied if neither the COLUMNS= nor the ROWS= statement option is used.
ODS LAYOUT ABSOLUTE is documented here: ODS LAYOUT ABSOLUTE Statement
ODS LAYOUT GRIDDED is documented here:
ODS LAYOUT GRIDDED statement
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
The first maintenance release of SAS® 9.4 (TS1M1) must be running in order to use the SYMBOLCHAR statement in PROC SGPLOT.
/* Data sets used by PROC SGPLOT */
data temperatures;
input Day : $9. High Low Forecast $7.;
datalines;
Monday 73 61 Cloudy
Tuesday 76 60 Showers
Wednesday 78 59 Sunny
Thursday 76 60 Sunny
Friday 78 64 Showers
Saturday 79 63 Sunny
Sunday 75 64 Sunny
;
run;
data myattrmap;
input id $ value $ markercolor $ markersymbol $;
datalines;
myid Cloudy grey cloud
myid Sunny orange sun
myid Showers blue umbrella
;
run;
title;
footnote;
/* Set landscape orientation, and turn off the date and page number */
options orientation=landscape nodate nonumber;
/* Ensure that all ODS destinations are closed */
ods _all_ close;
/* Inline styles will be used later, so set the ESCAPECHAR value */
ods escapechar="^";
/* Open the PDF destination, turn off the table of contents/bookmarks, */
/* and set NOGTITLE which removes titles from graph images */
ods pdf file="file.pdf" notoc nogtitle;
title1 "ODS PDF using: styles.Pearl, ODS LAYOUT, and PROCs ODSLIST, ODSTEXT, REPORT & SGPLOT";
footnote1 "Created by SAS version: &sysver";
/* Define a layout that is 7.25 inches high and 10.5 inches wide.
We have set the system option ORIENTATION= to LANDSCAPE on an OPTIONS statement.
We defined a title and footnote, whose text will be placed outside the layout. */
ods layout start height=7.25in width=10.5in;
ods region x=1in y=.75in width=3.5in;
proc odstext;
p "The ODSTEXT procedure offers a powerful tool for inserting paragraph style text into your ODS destinations. " / style=systemtitle;
p "The ODSTEXT procedure allows us to: format text with style control offered with the statement option style=, use data sets, and add bullets." / style=systemtitle;
p ' ';
p "A close sibling is PROC ODSLIST, used to generate the following bulleted list of improved ODS PDF features:" / style=header;
run;
data features;
input feature $25.;
datalines;
Styles.Pearl
ODS LAYOUT
PROCs ODSLIST & ODSTEXT
;
run;
proc odslist data=features;
item feature /style={bullet="disc"};
end;
run;
ods region x=4in y=.5in;
ods graphics on / reset noborder height=3.5in;
proc sgplot data=temperatures dattrmap=myattrmap;
title;
footnote;
highlow x=day low=low high=high / lineattrs=(color=biyg thickness=12pt);
scatter x=day y=high / markerattrs=(size=20pt) attrid=myid group=forecast name="x";
symbolchar name=Cloud char='2601'x / voffset=.5;
symbolchar name=Sun char='2600'x / voffset=.5;
symbolchar name=Umbrella char='2602'x / voffset=.5;
xaxis label=" ";
xaxistable high / valueattrs=(size=9pt weight=bold)location=inside;
xaxistable low / valueattrs=(size=9pt weight=bold) location=inside;
keylegend "x"/ noborder;
run;
ods region y=4in;
proc format;
value myfmt low-40="^{style [foreground=red] ^{unicode 2193} "
40-high="^{style [foreground=green] ^{unicode 2191} ";
run;
proc odstext ;
p " ";
p "A subset of SASHELP.CARS where MPG_HIGHWAY is greater than 40 " /
style={font=(", Albany",10pt,bold) just=c};
run;
proc report data=sashelp.cars(where=(mpg_highway gt 40 and cylinders eq 4)) spanrows
style(report)={posttext="^{style [font_weight=bold] PROC FORMAT uses inline formatting and the Unicode style function to differentiate models based on the combined MPG}" };
col make model mpg_highway mpg_city avg type enginesize horsepower drivetrain;
define make / order;
define avg / computed "Combined MPG" format=8. style(column)={posttext=myfmt.};
compute avg ;
avg=sum(mpg_highway.sum,mpg_city.sum)/2;
endcomp;
run;
/* End the current layout */
ods layout end;
/* Close the PDF destination so that we can open FILE.PDF */
ods pdf close;
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
Click to open file.pdf
Type: | Sample |
Date Modified: | 2015-05-18 10:58:58 |
Date Created: | 2015-05-14 14:20:39 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | Base SAS | z/OS | 9.4 TS1M0 | |
Z64 | 9.4 TS1M0 | |||
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.4 TS1M0 | |||
Microsoft® Windows® for x64 | 9.4 TS1M0 | |||
Microsoft Windows 8 Enterprise x64 | 9.4 TS1M0 | |||
Microsoft Windows 8 Pro x64 | 9.4 TS1M0 | |||
Microsoft Windows 8.1 Enterprise 32-bit | 9.4 TS1M0 | |||
Microsoft Windows 8.1 Enterprise x64 | 9.4 TS1M0 | |||
Microsoft Windows 8.1 Pro | 9.4 TS1M0 | |||
Microsoft Windows 8.1 Pro 32-bit | 9.4 TS1M0 | |||
Microsoft Windows Server 2008 R2 | 9.4 TS1M0 | |||
Microsoft Windows Server 2008 for x64 | 9.4 TS1M0 | |||
Microsoft Windows Server 2012 Datacenter | 9.4 TS1M0 | |||
Microsoft Windows Server 2012 R2 Datacenter | 9.4 TS1M0 | |||
Microsoft Windows Server 2012 R2 Std | 9.4 TS1M0 | |||
Microsoft Windows Server 2012 Std | 9.4 TS1M0 | |||
Windows 7 Enterprise x64 | 9.4 TS1M0 | |||
Windows 7 Professional x64 | 9.4 TS1M0 | |||
64-bit Enabled AIX | 9.4 TS1M0 | |||
64-bit Enabled HP-UX | 9.4 TS1M0 | |||
64-bit Enabled Solaris | 9.4 TS1M0 | |||
HP-UX IPF | 9.4 TS1M0 | |||
Linux for x64 | 9.4 TS1M0 | |||
Solaris for x64 | 9.4 TS1M0 |