Data visualization with SAS programming

Group values get truncated in proc gchart

Reply
Occasional Contributor
Posts: 10

Group values get truncated in proc gchart

Hello,

I'm attempting to produce a bar chart with both a group and sub-group variable.  My issue is that the sub-group variable values get truncated at 32 characters, which causes some odd groupings on the chart.  I've looked at support.sas.com and also in the communities site to see if there is a resolution for this but from what I can tell this issue was meant to be fixed in SAS 9.2. 

I'm currently working with SAS 9.2 and EG 7.1.  We have plans to upgrade to SAS 9.4 in the fall but we're not quite there yet.

Any suggestions would be greatly appreciated.

Thank you,

Pearl

Note:  I've copied in the code generated from the chart task below.

PROC SORT

  DATA=WORK.CHART_DATA_HASP_FINAL(FIRSTOBS=1  KEEP=TIME_INTV_1 FLOWGATE_NAME SHADOW_PRICE EDR_TRADE_DT)

  OUT=WORK.SORTTempTableSorted

  ;

  BY DESCENDING EDR_TRADE_DT;

RUN;

%_sas_pushchartsize(450,300);

  GOPTIONS CBACK=WHITE;

Legend1

  FRAME

  LABEL=( FONT='Arial' HEIGHT=8pt JUSTIFY=LEFT   " ")

  ;

Axis1

  STYLE=1

  WIDTH=1

  MINOR=NONE

  LABEL=(  ANGLE=90 "Shadow Value ($/MW)")

;

Axis2

  STYLE=1

  WIDTH=1

  VALUE=(ANGLE=90)

  LABEL=NONE

;

TITLE;

FOOTNOTE;

PROC GCHART DATA=WORK.SORTTempTableSorted

;

  VBAR

  TIME_INTV_1

/

  SUMVAR=SHADOW_PRICE

  SUBGROUP=FLOWGATE_NAME

  CLIPREF

FRAME CFRAME=WHITE

  MIDPOINTS="0:00"T TO "23:45"T BY "0:15"T

  TYPE=SUM

  MISSING

  LEGEND=LEGEND1

  COUTLINE=SAME

  RAXIS=AXIS1

  MAXIS=AXIS2

  LREF=1

  CREF=LTGRAY

  AUTOREF

;

  FORMAT TIME_INTV_1 HHMM5.

  SHADOW_PRICE DOLLAR8.;

  LABEL

  FLOWGATE_NAME="Constraint"

  SHADOW_PRICE="Shadow Value"

  EDR_TRADE_DT="Trade Date";

  BY DESCENDING EDR_TRADE_DT;

/* -------------------------------------------------------------------

   End of task code

   ------------------------------------------------------------------- */

RUN; QUIT;

Grand Advisor
Posts: 10,262

Re: Group values get truncated in proc gchart

I would try putting the full text into an ORDER or VALUE statement in the legend and see what happens. You don't mention how many levels you have for your subgroup but if the graph size is small ( is that 450 by 300 pixels?) then you may have issues with space available so font and size for the values might be critical.

Occasional Contributor
Posts: 10

Re: Group values get truncated in proc gchart

Hi BallardW,

Thanks for your reply.  From what I can tell this isn't simply a display issue, but rather a grouping issue, so that while I start out with ten sub-groups per day, some of them get grouped together so that only 8 or 9 show up on the chart since the names are identical until the last few characters which happen to be past the 32-character limit.  This makes the values identical after they get truncated, so they get grouped together erroneously.  Unfortunately I can't recode the values to be shorter since these names are already modified as much as possible from the original, so I can't shorten them to get around the 32-character limit.

Thanks again,

Pearl

Ask a Question
Discussion stats
  • 2 replies
  • 351 views
  • 0 likes
  • 2 in conversation