The SAS Output Delivery System and reporting techniques

ODS HTML Page customisation

Reply
Frequent Contributor
Posts: 75

ODS HTML Page customisation

Gday,

I was wondering if it's possible to customise the way the links show up on the left frame of some ODS HTML output.

Here's the structure of the code that I'm running:

ods html file = "f.html"
frame = "t.html"
page = "p.html"
path = "&base_dir.\&eom.\Distribution\html\"
newfile=page
style = newstyle;

title1 'Personal Specialty';

ods proclabel "Personal Specialty: Accident Year Summary Report";
proc report data = Summary.Uw_data_dom nowd &proc_rpt_opt. &macro_style.;
column
accyr
&macro_vars.
;

define accyr / 'AccYr' group order=formatted ;

%common_calcs;

rbreak after / summarize;
run;
ods html close;
^^


http://img41.imageshack.us/img41/586/odshtmlpage.png
^^

I want p.html to have the text highlighted in red (see link) to be the link and remove the rest of the text.


Thanks.
-John T.
Super Contributor
Super Contributor
Posts: 3,174

Re: ODS HTML Page customisation

Start here:

http://support.sas.com/rnd/base/ods/templateFAQ/index.html


Under the heading ODS HTML, there are SAS notes with details on the topic/post you requested.

Scott Barry
SBBWorks, Inc.
Frequent Contributor
Posts: 75

Re: ODS HTML Page customisation

Thanks for the response sbb, I have looked at a lot the links on the URL you provided a couple of months ago, and had no luck on this topic. Do you have a more specific link?


When I first attempted this exercise, I found the following:
proc template;
define style newstyle;
parent=styles.default;
style PagesItem from IndexItem / Posttext=" of the Personal Specialty";
end;
run;
^^

It's close, but it doesn't change what the link is and it doesn't remove the text.

I got the above from:
http://support.sas.com/kb/23/434.html
^^

Message was edited by: John T

Message was edited by: John T
Super Contributor
Super Contributor
Posts: 3,174

Re: ODS HTML Page customisation

Share all of your executed SAS code, including the ODS statement and any PROC execution that generates output, preferably as a SAS log output, pasted in your post-reply.

Scott Barry
SBBWorks, Inc.
Frequent Contributor
Posts: 75

Re: ODS HTML Page customisation

2055 data _null_;
2056 lm = intnx('month', today(), -1, 'e');
2057
2058 call symput('yr', year(lm) );
2059 call symput('eom', put(lm, yymmn6.) );
2060 run;

NOTE: Numeric values have been converted to character values at the places given by:
(Line)Smiley SadColumn).
2058:22
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds


2061 %put &yr.;
2010
2062 %put &eom.;
201001
2063
2064
2065 %macro common_calcs();
2066 define gwp / analysis sum format=comma15.;
2067 define gep / analysis sum format=comma15.;
2068 define Incurred / analysis sum format=comma15.;
2069
2070 define AttrIncurred / noprint ;
2071 define LgeIncurred / noprint ;
2072 define CatIncurred / noprint ;
2073 define ibnr / noprint ;
2074 define GEC / noprint ;
2075 define AdminExp / noprint ;
2076 define OpProfitAT / noprint ;
2077 define Capital / noprint ;
2078
2079 define Attr_GLR / computed format = percent12.;
2080 define Lge_GLR / computed format = percent12.;
2081 define Cat_GLR / computed format = percent12.1;
2082 define Inc_GLR / computed format = percent12.1;
2083 define Ult_GLR / computed format = percent12.1;
2084
2085 define Comm_rate / 'Comm_%' computed format = percent12.1;
2086 define ExpRate / computed format = percent12.1;
2087 *define ROC / computed format = percent12.1;
2088 define ROC / computed format = pctpic.;
2089
2090
2091 compute Attr_GLR;
2092 if -AttrIncurred.sum/gep.sum = . then
2093 Attr_GLR = 0;
2094 else
2095 Attr_GLR = -AttrIncurred.sum/gep.sum;
2096 endcomp;
2097
2098 compute Lge_GLR;
2099 if -LgeIncurred.sum/gep.sum = . then
2100 Lge_GLR = 0;
2101 else
2102 Lge_GLR = -LgeIncurred.sum/ gep.sum ;
2103 endcomp;
2104
2105 compute Cat_GLR;
2106 if -CatIncurred.sum/gep.sum = . then
2107 Cat_GLR = 0;
2108 else
2109 Cat_GLR = -CatIncurred.sum/ gep.sum ;
2110 endcomp;
2111
2112 compute Inc_GLR;
2113 if -incurred.sum /gep.sum = . then
2114 Inc_GLR = 0;
2115 else
2116 Inc_GLR = -incurred.sum/ gep.sum ;
2117 endcomp;
2118
2119 compute Ult_GLR;
2120 if -sum(incurred.sum, ibnr.sum) / gep.sum = . then
2121 Ult_GLR = 0;
2122 else
2123 Ult_GLR = -sum(incurred.sum, ibnr.sum) / gep.sum ;
2124 endcomp;
2125
2126
2127 compute Comm_rate;
2128 if -gec.sum/gep.sum = . then
2129 Comm_rate = 0;
2130 else
2131 Comm_rate = -gec.sum/gep.sum;
2132 endcomp;
2133
2134 compute ExpRate;
2135 if -AdminExp.sum /gep.sum = . then
2136 ExpRate = 0;
2137 else
2138 ExpRate = -AdminExp.sum/ gep.sum ;
2139 endcomp;
2140
2141 compute ROC;
2142 if OpProfitAT.sum/Capital.sum = . then
2143 ROC = 0;
2144 else
2145 ROC = OpProfitAT.sum/Capital.sum ;
2146 endcomp;
2147 %mend;
2148
2149 proc format;
2150 picture pctpic (round) low-<0 = '0099.9%' (mult=1000 prefix='-')
2151 0-high = '0099.9%' (mult=1000) ;
NOTE: Format PCTPIC is already on the library.
NOTE: Format PCTPIC has been output.
2152 run;

NOTE: PROCEDURE FORMAT used (Total process time):
real time 0.09 seconds
cpu time 0.01 seconds


2153 %let base_dir = H:\Technical\Portfolio Management\Reports\Monthly\UW Performance Report;
2154 LIBNAME Summary "&base_dir.\&eom.\Basedata";
NOTE: Libref SUMMARY was successfully assigned as follows:
Engine: V9
Physical Name: H:\Technical\Portfolio Management\Reports\Monthly\UW Performance
Report\201001\Basedata
2155
2156
2157 %let macro_vars =
2158 GWP GEP Incurred
2159 AttrIncurred LgeIncurred CatIncurred ibnr
2160 GEC AdminExp OpProfitAT Capital
2161
2162 Attr_GLR Lge_GLR Cat_GLR Inc_GLR Ult_GLR
2163 Comm_rate ExpRate ROC
2164 ;
2165
2166 %let macro_style =
2167 style(report) = [cellspacing=3 borderwidth=5 bordercolor=blue]
2168 style(header) = [foreground=white background=purple FONT_WEIGHT=medium font_size=1.7]
2169 style(column) = [foreground=black background=white font_face=helvetica font_size=1]
2170 style(lines) = [foreground=white background=black font_style=italic font_weight=bold
2170! font_size=1]
2171 style(summary) = [foreground=cx3e3d73 background=cxaeadd9 font_face=helvetica font_size=1
2171! just=r]
2172 ;
2173
2174
2175
2176 proc template;
2177 define style newstyle;
2178 parent=styles.default;
2179 style PagesItem from IndexItem / Posttext=" of the Personal Specialty";
2180 end;
NOTE: Overwriting existing template/link: Newstyle
NOTE: STYLE 'Newstyle' has been saved to: SASUSER.TEMPLAT
2181 run;
NOTE: PROCEDURE TEMPLATE used (Total process time):
real time 0.12 seconds
cpu time 0.04 seconds


2182
2183
2184 %let proc_rpt_opt =
2185 headline headskip
2186 /*NOEXEC*/
2187 ;
2188
2189 *need to output FILE FRAME and PAGE to generate links;
2190 *however we will not use the p.html file, we will use one created manually;
2191 options nodate pageno=1;
2192 ods html /*file = "&base_dir.\&eom.\Distribution\html\f.html"
2193 frame = "&base_dir.\&eom.\Distribution\html\t.html"
2194 page = "&base_dir.\&eom.\Distribution\html\p.html"*/
2195 file = "f.html"
2196 frame = "t.html"
2197 page = "p.html"
2198 path = "&base_dir.\&eom.\Distribution\html\"
2199 /*base = "H:\Technical\Portfolio Management\Reports\Monthly\UW Performance
2199! Report\&eom.\Distribution\html"*/
2200 /*ase = "&base_dir.\&eom.\Distribution\html\"*/
2201 newfile=page
2202 style = newstyle;
NOTE: Writing HTML Body file: f.html
NOTE: Writing HTML Pages file: p.html
NOTE: Writing HTML Frame file: t.html
2203
2204 title1 'Personal Specialty';
2205
2206
2207 ods proclabel "Personal Specialty: Accident Year Summary Report";
2208 proc report data = Summary.Uw_data_dom nowd &proc_rpt_opt. &macro_style.;
2209 column
2210 accyr
2211 &macro_vars.
2212 ;
2213
2214 define accyr / 'AccYr' group order=formatted ;
2215
2216 %common_calcs;
2217
2218 *break after class_type / summarize;
2219 rbreak after / summarize;
2220
2221 * title '22Sales for the Southeast Sector';
2222 run;

NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line)Smiley SadColumn).
1 at 1:6 1 at 1:21 1 at 1:6 1 at 1:21
NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line)Smiley SadColumn).
1 at 1:6 1 at 1:21 1 at 1:6 1 at 1:21
NOTE: There were 884 observations read from the data set SUMMARY.UW_DATA_DOM.
NOTE: PROCEDURE REPORT used (Total process time):
real time 0.23 seconds
cpu time 0.03 seconds
2223
2224
2225 ods proclabel "Personal Specialty: Accident Year Summary Report";
2226 proc report data = Summary.Uw_data_dom nowd &proc_rpt_opt. &macro_style.;
2227 column
2228 class_type accyr
2229 &macro_vars.
2230 ;
2231
2232 define class_type / group order=formatted ;
2233 define accyr / 'AccYr' group order=formatted ;
2234
2235 %common_calcs;
2236
2237 break after class_type / summarize;
2238 rbreak after / summarize;
2239
2240 * title '22Sales for the Southeast Sector';
2241 run;

NOTE: Writing HTML Body file: f1.html
NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line)Smiley SadColumn).
6 at 1:6 6 at 1:22 7 at 1:6 7 at 1:21 7 at 1:6 7 at 1:21 6 at 1:6
6 at 1:19 4 at 1:6 2 at 1:34 2 at 1:6 2 at 1:13 2 at 1:6 2 at 1:19
2 at 1:19
NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line)Smiley SadColumn).
6 at 1:6 6 at 1:22 7 at 1:6 7 at 1:21 7 at 1:6 7 at 1:21 6 at 1:6
6 at 1:19 4 at 1:6 2 at 1:34 2 at 1:6 2 at 1:13 2 at 1:6 2 at 1:19
2 at 1:19
NOTE: There were 884 observations read from the data set SUMMARY.UW_DATA_DOM.
NOTE: PROCEDURE REPORT used (Total process time):
real time 0.21 seconds
cpu time 0.09 seconds

^^


There's about 13 more of those proc report steps, and finally:


2563 ods html close;
Frequent Contributor
Posts: 75

Re: ODS HTML Page customisation

2151 0-high = '0099.9%' (mult=1000) ;
NOTE: Format PCTPIC is already on the library.
NOTE: Format PCTPIC has been output.
2152 run;

NOTE: PROCEDURE FORMAT used (Total process time):
real time 0.09 seconds
cpu time 0.01 seconds


2153 %let base_dir = H:\Technical\Portfolio Management\Reports\Monthly\UW Performance Report;
2154 LIBNAME Summary "&base_dir.\&eom.\Basedata";
NOTE: Libref SUMMARY was successfully assigned as follows:
Engine: V9
Physical Name: H:\Technical\Portfolio Management\Reports\Monthly\UW Performance
Report\201001\Basedata
2155
2156
2157 %let macro_vars =
2158 GWP GEP Incurred
2159 AttrIncurred LgeIncurred CatIncurred ibnr
2160 GEC AdminExp OpProfitAT Capital
2161
2162 Attr_GLR Lge_GLR Cat_GLR Inc_GLR Ult_GLR
2163 Comm_rate ExpRate ROC
2164 ;
2165
2166 %let macro_style =
2167 style(report) = [cellspacing=3 borderwidth=5 bordercolor=blue]
2168 style(header) = [foreground=white background=purple FONT_WEIGHT=medium font_size=1.7]
2169 style(column) = [foreground=black background=white font_face=helvetica font_size=1]
2170 style(lines) = [foreground=white background=black font_style=italic font_weight=bold
2170! font_size=1]
2171 style(summary) = [foreground=cx3e3d73 background=cxaeadd9 font_face=helvetica font_size=1
2171! just=r]
2172 ;
2173
2174
2175
2176 proc template;
2177 define style newstyle;
2178 parent=styles.default;
2179 style PagesItem from IndexItem / Posttext=" of the Personal Specialty";
2180 end;
NOTE: Overwriting existing template/link: Newstyle
NOTE: STYLE 'Newstyle' has been saved to: SASUSER.TEMPLAT
2181 run;
NOTE: PROCEDURE TEMPLATE used (Total process time):
real time 0.12 seconds
cpu time 0.04 seconds


2182
2183
2184 %let proc_rpt_opt =
2185 headline headskip
2186 /*NOEXEC*/
2187 ;
2188
2189 *need to output FILE FRAME and PAGE to generate links;
2190 *however we will not use the p.html file, we will use one created manually;
2191 options nodate pageno=1;
2192 ods html /*file = "&base_dir.\&eom.\Distribution\html\f.html"
2193 frame = "&base_dir.\&eom.\Distribution\html\t.html"
2194 page = "&base_dir.\&eom.\Distribution\html\p.html"*/
2195 file = "f.html"
2196 frame = "t.html"
2197 page = "p.html"
2198 path = "&base_dir.\&eom.\Distribution\html\"
2199 /*base = "H:\Technical\Portfolio Management\Reports\Monthly\UW Performance
2199! Report\&eom.\Distribution\html"*/
2200 /*ase = "&base_dir.\&eom.\Distribution\html\"*/
2201 newfile=page
2202 style = newstyle;
NOTE: Writing HTML Body file: f.html
NOTE: Writing HTML Pages file: p.html
NOTE: Writing HTML Frame file: t.html
2203
2204 title1 'Personal Specialty';
2205
2206
2207 ods proclabel "Personal Specialty: Accident Year Summary Report";
2208 proc report data = Summary.Uw_data_dom nowd &proc_rpt_opt. &macro_style.;
2209 column
2210 accyr
2211 &macro_vars.
2212 ;
2213
2214 define accyr / 'AccYr' group order=formatted ;
2215
2216 %common_calcs;
2217
2218 *break after class_type / summarize;
2219 rbreak after / summarize;
2220
2221 * title '22Sales for the Southeast Sector';
2222 run;

NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line)Smiley SadColumn).
1 at 1:6 1 at 1:21 1 at 1:6 1 at 1:21
NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line)Smiley SadColumn).
1 at 1:6 1 at 1:21 1 at 1:6 1 at 1:21
NOTE: There were 884 observations read from the data set SUMMARY.UW_DATA_DOM.
NOTE: PROCEDURE REPORT used (Total process time):
real time 0.23 seconds
cpu time 0.03 seconds
2223
2224
2225 ods proclabel "Personal Specialty: Accident Year Summary Report";
2226 proc report data = Summary.Uw_data_dom nowd &proc_rpt_opt. &macro_style.;
2227 column
2228 class_type accyr
2229 &macro_vars.
2230 ;
2231
2232 define class_type / group order=formatted ;
2233 define accyr / 'AccYr' group order=formatted ;
2234
2235 %common_calcs;
2236
2237 break after class_type / summarize;
2238 rbreak after / summarize;
2239
2240 * title '22Sales for the Southeast Sector';
2241 run;

NOTE: Writing HTML Body file: f1.html
NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line)Smiley SadColumn).
6 at 1:6 6 at 1:22 7 at 1:6 7 at 1:21 7 at 1:6 7 at 1:21 6 at 1:6
6 at 1:19 4 at 1:6 2 at 1:34 2 at 1:6 2 at 1:13 2 at 1:6 2 at 1:19
2 at 1:19
NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line)Smiley SadColumn).
6 at 1:6 6 at 1:22 7 at 1:6 7 at 1:21 7 at 1:6 7 at 1:21 6 at 1:6
6 at 1:19 4 at 1:6 2 at 1:34 2 at 1:6 2 at 1:13 2 at 1:6 2 at 1:19
2 at 1:19
NOTE: There were 884 observations read from the data set SUMMARY.UW_DATA_DOM.
NOTE: PROCEDURE REPORT used (Total process time):
real time 0.21 seconds
cpu time 0.09 seconds

^^


There's about 13 more of those proc report steps, and finally:


2563 ods html close; Message was edited by: John T
Super Contributor
Super Contributor
Posts: 3,174

Re: ODS HTML Page customisation

I encourage you to start out by coding a more reasonable sized SAS program that exercises the SAS programming/function elements you need to accomplish your objective.

Consider using the SASHELP sample data files where one may fit your presentation requirements - or cook up your own "simplified" data structure for testing and validation purposes.

Then move on to the repetitive PROC REPORT invocations as you have demonstrated.

With the more concise SAS program example, you also may find individuals more responsive on the forum to assist in your overall quest.

Scott Barry
SBBWorks, Inc.
Frequent Contributor
Posts: 75

Re: ODS HTML Page customisation

Sorry, I didn't post the whole segment of code the first time, because I didn't think it was relevant and I didn't want to overwhelm others.

At the end of the day the content doesn't really matter, I just want to know if it's possible to change/customise the content in the PAGE frame without manually coding the html myself.

I based my code on the SASHELP ODS HTML Statement section.

I have found a link on the online documentation I originally used:
http://support.sas.com/onlinedoc/913/getDoc/en/odsug.hlp/a002175885.htm#a002302743
^^

If you look at the HTML output, you can see that the actual link to the tables is nested. I just want the link associated with the 1. The Report Procedure text (and change what it says too).
SAS Super FREQ
Posts: 8,864

Re: ODS HTML Page customisation

Hi:
In addition to the Tech Support Note that you already found, these are some other relevant notes:
http://support.sas.com/kb/23/345.html
http://support.sas.com/kb/23/344.html
http://support.sas.com/kb/23/429.html

I believe that you will need to use different template techniques. The one you have only changes PagesItem and you will probably need to change other style elements, as well. A very good resource for you will be the ODS Template FAQ, which you can find here:
Template FAQ:
http://support.sas.com/rnd/base/ods/templateFAQ/index.html
Look specifically for Table of Contents and/or Table of Pages under the ODS HTML topic.

Also, rather than go down the template road, you might wish to investigate ODS DOCUMENT -- which is PERFECT for rearranging/relabelling the Table of Contents using either the interactive Document Window or PROC DOCUMENT -- after the TOC is exactly the way you want, then you can replay your output. The only hitch with the ODS DOCUMENT/PROC DOCUMENT approach -- is that PROC REPORT is not supported until SAS 9.2.

Meanwhile, back in PROC TEMPLATE-land, I'm confused by what you want. Your image showed the following structure to your table of contents:
1. Personal Speciality Accident Year Summary Report
- Page 1 of the Personal Speciality (link)
2. Personal Speciality Accident Year Summary Report
- Page 2 of the Personal Speciality (link)
3. Personal Speciality Accident Year Summary Report
- Page 3 of the Personal Speciality (link)

You had a red rectangle around #1 and said you wanted #1 text to be the link and not the "- Page 1 of the Personal Speciality" Do you want the equivalent of Option A or Option B?? The style element you change will depend on what you want.
[pre]
Option A:
1. Personal Speciality Accident Year Summary Report (link)
2. Personal Speciality Accident Year Summary Report (link)
3. Personal Speciality Accident Year Summary Report (link)

OR is this what you want to see:

Option B:
- Page 1 of the Personal Speciality (link)
- Page 2 of the Personal Speciality (link)
- Page 3 of the Personal Speciality (link)
[/pre]

cynthia
Frequent Contributor
Posts: 75

Re: ODS HTML Page customisation

Posted in reply to Cynthia_sas
I'm yet to check all those links, but I'm after option b (and only b) in terms of what I want to see.

Sorry, I was trying to highlight that I don't want any nesting.

Just to confirm, we are currently on 9.1.3.

I actually filled a form about getting training from SAS about topics like this, however have not heard back in around a week. Is there anything out there (well in Sydney Australia) which is suitable?
Ask a Question
Discussion stats
  • 9 replies
  • 291 views
  • 0 likes
  • 3 in conversation