BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
cxkev182
Fluorite | Level 6

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

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisNZ
Tourmaline | Level 20

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.

 

 

 

View solution in original post

2 REPLIES 2
ChrisNZ
Tourmaline | Level 20

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.

 

 

 

cxkev182
Fluorite | Level 6

Great, thanks for your help!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1926 views
  • 0 likes
  • 2 in conversation