![]() | ![]() | ![]() | ![]() |
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 sort data=sashelp.shoes out=sorted;
by product;
run;
/* Go add the HTML anchors to a copy of the SHOES dataset */
data work.shoes;
set sorted end=eof;
by product;
if first.product then do;
pnumber + 1;
end;
length file $80 href $80 ;
file = "product" || trim(left(put(pnumber, 4.0))) || ".htm";
href = 'href="' || trim(file) || '"';
run;
/* OK, produce a bar graph of products per region. That */
/* html= tells SAS/GRAPH to construct a hotlink using the */
/* contents of the variable as the place to go - a very */
/* easy way to generate a "clickable graph". */
/* */
/* It only takes a little planning to "know" that I'm */
/* going to generate reports "per product" and to name */
/* them consecutively to have the links do the right */
/* thing, even though the individual reports are not */
/* generated till later. */
/* Point ODS in the right direction */
ods html
dev=gif
body="shoes.htm"
;
ods listing close;
goptions reset=global;
goptions target=gif
device=html
gunit=pct
ftext=swiss
htitle=6
htext=3
ctext=black
noborder
transparency
noninterlaced
hsize=6 in
vsize=4.5 in
;
/* Define legend characteristics */
legend1 label=none shape=bar(4,4) offset=(,2) pct
position=(top center outside) mode=share;
pattern1 value=solid c=blue;
pattern2 value=solid c=red;
pattern3 value=solid c=orange;
pattern4 value=solid c=yellow;
pattern5 value=solid c=cyan;
title2 .c=black " Products per region "
.c=blue "&sysdate &systime";
footnote .c=black "Click a Bar to go there...";
proc gchart data=shoes;
hbar3d product
/ subgroup=region
shape=cylinder
html=href
descending
freq percent
patternid=subgroup
name="products"
;
run;
quit;
ods html close;
/* Now generate the individual reports. That */
/* NEWFILE=TABLE comes in handy - it has ODS skip to a */
/* new file for each table generated by the procedure */
/* in this case one per product. */
/* */
/* This is as far as we go toward generating HTML for our */
/* products. The SUBSIDIARY column is a link to a page */
/* that does not exist, it is for illustration purposes */
/* only. */
ods html file="product1.htm" newfile=table;
title2;
footnote;
proc report data=shoes nowd;
column product region subsidiary sales;
define product / order noprint "Product";
define region / order "Region";
define subsidiary / order "Subsidiary";
define sales / sum "Sales";
break before product / page ;
compute before _page_ / left
style={font_style=italic background=orange foreground=blue};
line "&sysdate -- details for " product $20.;
endcomp;
compute subsidiary ;
call define(_col_, "URL",
"http://www.somecompany.com/GOES_HERE" || trim(subsidiary));
endcomp;
run;
/* All done, let us take a look. */
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.
This code produces HTML files.Click here to see the frameset
Results for this sample were generated in SAS Release 9.1.3 Service Pack 2.
| Type: | Sample |
| Topic: | SAS Reference ==> Procedures ==> GCHART Third Party ==> Output ==> HTML SAS Reference ==> ODS (Output Delivery System) SAS Reference ==> Procedures ==> REPORT Third Party ==> Output ==> Device Drivers ==> GIF, JPEG, PNG |
| Date Modified: | 2008-10-03 15:08:51 |
| Date Created: | 2005-08-11 10:47:20 |
| Product Family | Product | Host | SAS Release | |
| Starting | Ending | |||
| SAS System | Base SAS | All | 9.1 TS1M3 | n/a |



