BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
RichardAD
Quartz | Level 8

I'm trying to figure out if the following is possible.  A picture is worth a thousand words...

I would like to have the cell in the rows under the across header link to other output.

Clicking on the data value in the cell (the n-statistic in this example) should link to an anchor corresponding output for [table][dn]

RichardAD_0-1702323930995.png

Example data:

data x;
  input k q;
datalines;
1 2
1 2
1 2
2 7
2 8
2 8
2 9
3 100
;

data y;
  input p r;
datalines;
0 0
1 1
2 2
3 3
3 3
3 3
3 3
3 3
4 1
4 2
;

proc sql ;
  create table xf as
  select 'x' as table, k, count(distinct q) as dn
  from x group by k;

proc sql ;
  create table yf as
  select 'y' as table, p, count(distinct r) as dn
  from y group by p;

data fs ;
  set xf yf;
run ;

proc sql;
  create table x2 as select *, count(distinct q) as dn from x group by k order by dn, k ;
  create table y2 as select *, count(distinct r) as dn from y group by p order by dn, p ;

ods html file='r.html' style=plateau;

proc report data=fs;
  title 'counts';
  column table dn ;
  define table / group ;
  define dn / across ;
run ;

proc print noobs data=x2;
  title 'x2';
  by dn ;
run;

proc print noobs data=y2;
  title 'y2';
  by dn ;
run;

ods html close;

 

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

  Here's another picture from one of my PROC REPORT examples:

Cynthia_sas_0-1702335295669.png

In this example, Country is the first GROUP item and REGION (EAST or WEST) is the ACROSS item. In separate steps, I created 4 separate files, as shown in the screen shot (CanadaEast.html, CanadaWest.html, GermanyEast.html and GermanyWest.html). Then, a CALL DEFINE is used to dynamically build a URL for every cell under an ACROSS item. In this case, I attached the URL to the column for SUM and didn't do anything with the column for MEAN. In this way, you can see how absolute column numbers have to be used to determine which cell gets a link for which file.

  Hope this points you in a direction that gets you closer to what you want.

Cynthia

View solution in original post

3 REPLIES 3
Cynthia_sas
SAS Super FREQ

Hi:

  Here's another picture from one of my PROC REPORT examples:

Cynthia_sas_0-1702335295669.png

In this example, Country is the first GROUP item and REGION (EAST or WEST) is the ACROSS item. In separate steps, I created 4 separate files, as shown in the screen shot (CanadaEast.html, CanadaWest.html, GermanyEast.html and GermanyWest.html). Then, a CALL DEFINE is used to dynamically build a URL for every cell under an ACROSS item. In this case, I attached the URL to the column for SUM and didn't do anything with the column for MEAN. In this way, you can see how absolute column numbers have to be used to determine which cell gets a link for which file.

  Hope this points you in a direction that gets you closer to what you want.

Cynthia

RichardAD
Quartz | Level 8
Thanks, that's a start.

Q: Is there a way to access the stacked column values that appear in the
headers?

Right now I'm thinking I have to use Proc SQL before the REPORT in order to
have an array I can use...

proc sql;
select distinct dn into :dns separated by ',' from ... ;

compute freq;
array dns(&dns);
... url formula involves _C_ and dns()...
endcomp;
Cynthia_sas
SAS Super FREQ
Hi:
No, you cannot directly access the header values. The absolute column numbers should indicate which column is for EAST and which for WEST (in my example).
Cynthia

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1366 views
  • 1 like
  • 2 in conversation