![]() | ![]() | ![]() | ![]() | ![]() |
Note: The table template has two columns, NAME and PHONE. If a
variable mapped to the column NAME has a label, the label will
be used as the column header in the output, otherwise the
variable name will be used. Values for variables mapped to
the NAME column will be in italics. Variables mapped to the
column PHONE will use the column header "Telephone".
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.
proc template;
define table phonelist;
column name phone;
dynamic colheader;
define name;
generic=on;
header=colheader;
style=data{font_style=italic font_size=3};
end;
define phone;
header='Telephone';
style=data{font_face='SAS Monospace' font_size=3};
end;
end;
run;
title 'New Subscriber Telephone List';
/* Create format to standardize the presentation of the phone number */
proc format;
picture phonenum .='Not available'
other='0000)000-0000' (prefix='(');
run;
/* Create dummy data */
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;
/* Specify output destination */
ods html body='phone.htm';
data _null_;
set phones;
/* use the PHONELIST template, map LAST_NAME from WORK.PHONE to the */
/* template column NAME, assign "Last Name" as the column header. */
/* Map FIRST_NAME from WORK.PHONES to the template column NAME, assign */
/* the column header as "First Name". Map BUSINESS_PHONE from WORK.PHONES */
/* to the template column name PHONE and apply the format PHONENUM. */
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 BUSINESS_PHONE is missing then write out all three columns, overwrite the third */
/* column with HOME_PHONE ...else if HOME_PHONE is missing, write out all three columns... */
/* else write out all three columns, skip a line and write out just the HOME_PHONE */
/* in the third column */
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;
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.
| New Subscriber Telephone List |
| Last Name | First Name | Telephone |
|---|---|---|
| Archuleta | Ruby | Not available |
| Ito | Takei | (704)298-2145 |
| Joad | Tom | (209)963-2764 |
| (209)668-4741 | ||
| Johnson | Jerome | (919)319-1677 |
| (919)846-2198 | ||
| Kent | Palinor | (919)782-3199 |
| Montague | Romeo | (800)899-2164 |
| (360)973-6201 | ||
| Rashid | Imani | (508)852-2146 |
| (508)366-9821 |
| Type: | Sample |
| Topic: | SAS Reference ==> DATA Step Query and Reporting ==> Creating Reports ==> Non Graphical SAS Reference ==> ODS (Output Delivery System) Third Party ==> Output ==> HTML Third Party ==> Output ==> PDF Third Party ==> Output ==> Postscript Third Party ==> Output ==> RTF |
| Date Modified: | 2005-12-08 11:34:29 |
| Date Created: | 2004-09-30 14:09:10 |
| Product Family | Product | Host | SAS Release | |
| Starting | Ending | |||
| SAS System | Base SAS | All | 8 TS M0 | n/a |





