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 (BASUG) is hosting our in person SAS Blowout on Oct 18!
This full-day event in Cambridge, Mass features four presenters from SAS, presenting on a range of SAS 9 programming topics. Pre-registration by Oct 15 is required.
Full details and registration info 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 (BASUG) is hosting our in person SAS Blowout on Oct 18!
This full-day event in Cambridge, Mass features four presenters from SAS, presenting on a range of SAS 9 programming topics. Pre-registration by Oct 15 is required.
Full details and registration info at https://www.basug.org/events.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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