Features: |
PROC TEMPLATE
|
ODS destination: | RTF |
proc template; define table phonelist; column name phone; dynamic colheader; define name; generic=on; header=colheader; style=data{fontstyle=italic fontsize=5}; end; define phone; header='Telephone'; style=datafixed; end; end; run;
ods html close;
ods rtf body='your_rtf_file.rtf';
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 RTF close;
proc template; define table phonelist; column name phone; dynamic colheader; define name; generic=on; header=colheader; style=data{fontstyle=italic fontsize=5}; end; define phone; header='Telephone'; style=datafixed; end; end; 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 ;
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;