Using the Output Delivery System in the DATA Step |
ODS features: |
PROC TEMPLATE |
FILE statement, ODS option:
| COLUMNS= suboption
| FORMAT= attribute |
| DYNAMIC= attribute |
| GENERIC=
attribute | |
| TEMPLATE= | |
PUT _ODS_:
| column pointer controls |
| line pointer
controls | |
|
This example illustrates how to use a simple user-defined table
definition in the DATA step. It also illustrates the use of pointer controls
in the PUT _ODS_ statement.
Note: This example uses file names that may not be valid
in all operating environments. To successfully run the example in your operating
environment, you may need to change the file specifications. See Alternative ODS HTML Statements for Running Examples in Different Operating Environments. ![[cautionend]](../common/images/cautend.gif)
![Note about code](../common/images/snbut.gif) | /* Define the table definition 'phonelist' */
proc template;
define table phonelist;
column name phone;
dynamic colheader;
define name;
generic=on;
header=colheader;
style=data{font_style=italic font_size=5};
end;
define phone;
header='Telephone';
style=datafixed;
end;
end;
run; |
![Note about code](../common/images/snbut.gif) | ods listing close; |
![Note about code](../common/images/snbut.gif) | ods html body='ptcntrl-body.htm'; |
![Note about code](../common/images/snbut.gif) | title 'New Subscriber Telephone List'; |
![Note about code](../common/images/snbut.gif) | proc format;
picture phonenum .='Not available'
other='0000)000-0000' (prefix='(');
run; |
![Note about code](../common/images/snbut.gif) | data phones;
length first_name $20 last_name $25;
input first_name $ last_name $ business_phone home_phone;
datalines;
Jerome Johnson 9193191677 9198462198
Romeo Montague 8008992164 3609736201
Imani Rashid 5088522146 5083669821
Palinor Kent . 9197823199
Ruby Archuleta . .
Takei Ito 7042982145 .
Tom Joad 2099632764 2096684741
; |
![Note about code](../common/images/snbut.gif) | proc sort data=phones;
by last_name;
run; |
![Note about code](../common/images/snbut.gif) | data _null_;
set phones; |
![Note about code](../common/images/snbut.gif) | file print ods=(template='phonelist' |
![Note about code](../common/images/snbut.gif) | columns=
(name=last_name
(generic=on
dynamic=(colheader='Last Name'))
name=first_name
(generic=on
dynamic=(colheader='First Name'))
phone=business_phone
(format=phonenum.)
)
); |
![Note about code](../common/images/snbut.gif) | if (missing(business_phone)) then
put _ods_ @3 home_phone;
else if (missing(home_phone)) then
put _ods_;
else
put _ods_ / @3 home_phone;
run; |
![Note about code](../common/images/snbut.gif) | ods html close; |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.