Hi,
I have the following proc report which is output to ODS HTML. Is it possible to use the groupings to build a hyperlink for each cell?
For example, when the user clicks on the cell that shows the Actual Sales for Country=Canada and Region=East, is it possible to have a link to an alreay created file named "CanadaEast.html" and when the user clicks on predicted sales USA west, link to "USAWest.html".
proc report data=sashelp.prdsale nowd out=abscols style(summary)=Header;
column country ( region,(actual predict )) ('Overall' actual=act predict=pred);
define country / group style(column)=Header;
define region / across;
define actual / sum format=comma12.;
define predict / sum format=comma12.;
define act / sum format=comma12. style(column)=Header;
define pred / sum format=comma12. style(column)=Header;
rbreak after / summarize;
run;
Thanks,
cxkev182
You normally have to click on the column header, but a bit of pre-processing allows this.
proc means data=SASHELP.PRDSALE nway noprint;
class COUNTRY REGION;
var ACTUAL PREDICT ;
output out=SUM sum=;
run;
data _F;
retain TYPE 'N' FMTNAME 'LINKS';
set SUM;
START=ACTUAL ; LABEL=catt('<a href="',COUNTRY,REGION,'.htm">',ACTUAL ,'</a>'); output;
START=PREDICT; LABEL=catt('<a href="',COUNTRY,REGION,'.htm">',PREDICT,'</a>'); output;
run;
proc format cntlin=_F; run;
ods html file="%sysfunc(pathname(work))\test.htm" ;
proc report data=sashelp.prdsale nowd out=abscols style(summary)=Header;
column country ( region,(actual predict )) ('Overall' actual=act predict=pred);
define country / group style(column)=Header;
define region / across;
define actual / sum format=links. ;
define predict / sum format=links.;
define act / sum format=comma12. style(column)=Header;
define pred / sum format=comma12. style(column)=Header;
rbreak after / summarize;
run;
ods html close;
Region | ||||||
---|---|---|---|---|---|---|
EAST | WEST | Overall | ||||
Country | Actual Sales | Predicted Sales | Actual Sales | Predicted Sales | Actual Sales | Predicted Sales |
CANADA | 127485 | 120646 | 119505 | 112373 | 246,990 | 233,019 |
GERMANY | 124547 | 117579 | 121451 | 113975 | 245,998 | 231,554 |
U.S.A. | 118229 | 120587 | 119120 | 121135 | 237,349 | 241,722 |
370261 | 358812 | 360076 | 347483 | 730,337 | 706,295 |
You can check for duplicate values and add 0.00001 to differentiate between them if you want to be thorough.
You normally have to click on the column header, but a bit of pre-processing allows this.
proc means data=SASHELP.PRDSALE nway noprint;
class COUNTRY REGION;
var ACTUAL PREDICT ;
output out=SUM sum=;
run;
data _F;
retain TYPE 'N' FMTNAME 'LINKS';
set SUM;
START=ACTUAL ; LABEL=catt('<a href="',COUNTRY,REGION,'.htm">',ACTUAL ,'</a>'); output;
START=PREDICT; LABEL=catt('<a href="',COUNTRY,REGION,'.htm">',PREDICT,'</a>'); output;
run;
proc format cntlin=_F; run;
ods html file="%sysfunc(pathname(work))\test.htm" ;
proc report data=sashelp.prdsale nowd out=abscols style(summary)=Header;
column country ( region,(actual predict )) ('Overall' actual=act predict=pred);
define country / group style(column)=Header;
define region / across;
define actual / sum format=links. ;
define predict / sum format=links.;
define act / sum format=comma12. style(column)=Header;
define pred / sum format=comma12. style(column)=Header;
rbreak after / summarize;
run;
ods html close;
Region | ||||||
---|---|---|---|---|---|---|
EAST | WEST | Overall | ||||
Country | Actual Sales | Predicted Sales | Actual Sales | Predicted Sales | Actual Sales | Predicted Sales |
CANADA | 127485 | 120646 | 119505 | 112373 | 246,990 | 233,019 |
GERMANY | 124547 | 117579 | 121451 | 113975 | 245,998 | 231,554 |
U.S.A. | 118229 | 120587 | 119120 | 121135 | 237,349 | 241,722 |
370261 | 358812 | 360076 | 347483 | 730,337 | 706,295 |
You can check for duplicate values and add 0.00001 to differentiate between them if you want to be thorough.
Great, thanks for your help!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.