Graphics Programming

Data visualization using SAS programming, including ODS Graphics and SAS/GRAPH. Charts, plots, maps, and more!
BookmarkSubscribeRSS Feed
Quentin
Super User

Hi All,

 

I'm tearing apart a slow GTL boxplot (10-20 seconds on a 100,000 obs dataset) to see what parts are making it slow.  I'm using an attribute map to traffic-light it, and it seems that may be one contributor.  Running v9.3.

 

Below sample code I expand sashelp.prdsale into 144,000 obs, then run two SGRENDER steps to make box plots.  When I use the template with an attribute map, it takes 7 seconds, vs 1 second when there is no attribute map.  Interestingly, if I remove the /group option on the BOXPLOT statement, the time is the same.  So the time seems to be in the creation of the attribute map.

 

Does it make sense that building an attribute map would slow the SGRENDER step this much?  In my head the attribute map might only have 2 levels (red and black), but perhaps it ends up with 144,000?  

 

proc template;
  define statgraph BoxWithAttributeMap;
    begingraph;
      discreteattrmap name='AttrMapBox';
          value 'Red'    / fillattrs=(color=red) ;
          value 'Black'  / fillattrs=(color=lightgrey) ;
      enddiscreteattrmap;
      discreteattrvar 
        attrVar=AttrColorBox
        var=BoxColor
        attrmap='AttrMapBox' 
      ;
      layout overlay ;
        boxplot x=category y=actual /group=AttrColorBox ;
      endlayout; 
    endgraph;
  end;

  define statgraph BoxNoAttributeMap;
    begingraph;
      layout overlay ;
        boxplot x=category y=actual;
      endlayout; 
    endgraph;
  end;
run;

data prdsale;
  set sashelp.prdsale;
  category=catx('-',country,region,product);
  length BoxColor $10;
  if category='CANADA-EAST-BED' then BoxColor='Red';
  else BoxColor='Black';
  do i=1 to 100;
    output;
  end;
run;

proc sgrender data=prdsale template="BoxWithAttributeMap";
run;
proc sgrender data=prdsale template="BoxNoAttributeMap";
run;

 

 

Thanks,

--Q.

 

 

 

The Boston Area SAS Users Group is hosting free webinars!
Next up: Troy Martin Hughes presents Calling Open-Source Python Functions within SAS PROC FCMP: A Google Maps API Geocoding Adventure on Wednesday April 23.
Register now at https://www.basug.org/events.
2 REPLIES 2
Jay54
Meteorite | Level 14

Hi Quentin,

 

The experts here at SAS are looking into your use case, and have identified reasons for the slowdown.  This will be something we can address in the next release.

 

In the meantime, you could possibly work around the isue that is slowing this down..  Since you have a large data set, the parm data created for rendering contains not only the data for drawing the box, but also the original data set.  That is slowing down the internal process.  One way (similar to your previous question) would be to run the box plot WITHOUT the attr map setting and get the parm data (ODS OUTPUT).  Filter out the rows where STAT is missing.  Note, the STAT column name may have an internally generated long column name.

 

Now, run the GTL program with the AttrMap using BOXPLOTPARM and the new cleaned data set.  You will have to assign the internally generated long column names, including the one for group.  Use that for the group and the attrmap.  See if this helps.

 

 

Quentin
Super User

Thanks @Jay54, can definitely see how BOXPLOTPARM would help with this issue as well.  Really appreciate all your help on here (and your books and presentations and... )  I'll likely have more questions next week....

 

But have a great weekend!

The Boston Area SAS Users Group is hosting free webinars!
Next up: Troy Martin Hughes presents Calling Open-Source Python Functions within SAS PROC FCMP: A Google Maps API Geocoding Adventure on Wednesday April 23.
Register now at https://www.basug.org/events.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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
  • 2 replies
  • 1730 views
  • 1 like
  • 2 in conversation