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.
| /* 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; |
| ods listing close; |
| ods html body='ptcntrl-body.htm'; |
| title 'New Subscriber Telephone List'; |
| proc format;
picture phonenum .='Not available'
other='0000)000-0000' (prefix='(');
run; |
| 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
; |
| proc sort data=phones;
by last_name;
run; |
| data _null_;
set phones; |
| file print ods=(template='phonelist' |
| columns=
(name=last_name
(generic=on
dynamic=(colheader='Last Name'))
name=first_name
(generic=on
dynamic=(colheader='First Name'))
phone=business_phone
(format=phonenum.)
)
); |
| 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; |
| ods html close; |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.