Sample 24606: Creating tabular output with DATA step and ODS using a custom template
Specify the FILE PRINT ODS statement to create an output
object with the DATA Step. Use PROC TEMPLATE to define a
custom table definition. Include footers that span specified
columns.
Note:
ODS provides table definitions that define the structure of
the output from SAS procedures and from the DATA Step. You
can also create your own table definitions using PROC TEMPLATE.
A custom table can be created from scratch, or can inherit from
an existing template. This sample creates a new table from
from scratch called OUTDATA. The table defines three generic
columns (COL1 COL2 COL3) and two footers. The custom template
was needed to allow the footnotes to span specified columns.
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.
data info;
input id $ weight dose;
datalines;
02458 115 7
29856 149 12
78342 102 6
;
proc template;
define table outdata;
column col1 col2 col3;
define column col1;
generic;
end;
define column col2;
generic;
end;
define column col3;
generic;
end;
define footer foot1;
text 'AM only';
start=col3;
end=col3;
end;
define footer foot2;
text 'Measured at 1 hour intervals* 15 mil dosage ';
split='*';
end;
end;
run;
/* Close listing destination to save resources */
ods listing close;
/* Specify the output destination. HTML was chosen just for demonstration. */
ods html file='c:\temp\dosage.html';
/* Specify template OUTDATA and map variables from WORK.INFO to the columns */
/* defined in OUTDATA. The reserved word _ODS_ can be used on the PUT */
/* statement to write out the variables as ordered on the PDV. FILE PRINT ODS */
/* must be specified to use the reserved word _ODS_. */
data _null_;
set info;
file print ods=(template='outdata'
columns=(
col1=id(generic=on)
col2=weight(generic=on)
col3=dose(generic=on)
));
put _ods_;
run;
ods html close;
ods listing;
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.
Specify the FILE PRINT ODS statement to create an output
object with the DATA step. Use PROC TEMPLATE to define a
custom table definition. Include footers that span specified
columns.
| Type: | Sample |
| Topic: | SAS Reference ==> DATA Step Query and Reporting ==> Creating Reports ==> Non Graphical SAS Reference ==> ODS (Output Delivery System) Third Party ==> Output ==> XML Third Party ==> Output Third Party ==> Output ==> Postscript Third Party ==> Output ==> RTF Third Party ==> Output ==> PDF Third Party ==> Output ==> HTML
|
| Date Modified: | 2006-09-28 03:02:43 |
| Date Created: | 2004-09-30 14:08:57 |
Operating System and Release Information
| SAS System | Base SAS | All | 8 TS M0 | n/a |