BookmarkSubscribeRSS Feed
bwalsh1
Calcite | Level 5

I am using proc report to summarize a dataset, output a HTML webpage, and provide URL links to other webpages. Within the proc report statement, the URL is generated within a compute block. I want to add filtering and sorting using

 

   compute P1;
      if  P1*1 > 90 then do;
         call define (_col_,'style','style={background=verylightgreen}');
      end;
      if  P1*1 < 90 then do;
         call define (_col_,'style','style={background=verylightorange}');
      end;
     if  P2*1 < 70 then do;
         call define (_col_,'style','style={background=verylightred}');
      end;
      urlstring2 = "&url_string_1.&url_string_2.&url_string_3 &url_string_4'"||trim(left(text_value))|| "'&parmfilters=P1#summaryLevel=text_value"|| "&url_string_6.&url_string_7.&url_string_8.&url_string_9.P1";
      call define (_COL_,'URL',urlstring2);
   endcomp;



ods tagsets.tableeditor file='my_file.html'
     options(autofilter="yes"
             autofilter_width="7em"
             autofilter_table="1"
             sort="yes"
             ) style=styles.sasweb ;

This works well, except that the autofiltering drop down filters on the embedded URL rather than the value of the column. The embeeded URL is quite long and not intuative as a filter. Is there a way to change this behavior so the filtering occurs on the value rather than the URL string?

 

Thanks

2 REPLIES 2
ballardw
Super User

You may need to post some example data and enough code to duplicate generating an output for testing. A shorter dummy URL string should suffice to see what is happening.

bwalsh1
Calcite | Level 5

Thank you for the quick response.

Here is a snippet of code that demonstrates the issue

proc sql;
   create table cars as
   select distinct make,
                   type,
                   count(type) as type_count
   from sashelp.cars
   group by make, type
   order by make, type
;
quit;

 %include '~/tableeditor/tableeditor.tpl';

 ods tagsets.tableeditor file='~/filter_demo.html'
      options(autofilter="yes"
              autofilter_width="4em"
              autofilter_table="1"
              sort="yes"
              ) style=styles.sasweb ;


 proc report data = cars nowd;
    column make type type_count;
    define make / display;
    define type / display;
    define type_count / display;
    compute type_count;
       url_string = "https://www.google.com/#q="||trim(make);
       call define (_COL_,'URL',url_string);
    endcomp;
 run;

ods tagsets.tableeditor close;

bwalsh1

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 965 views
  • 0 likes
  • 2 in conversation