BookmarkSubscribeRSS Feed
Quentin
PROC Star

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.

 

 

 

Check out the Boston Area SAS Users Group (BASUG) video archives: https://www.basug.org/videos.
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
PROC Star

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!

Check out the Boston Area SAS Users Group (BASUG) video archives: https://www.basug.org/videos.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 2 replies
  • 943 views
  • 1 like
  • 2 in conversation