BookmarkSubscribeRSS Feed
Zifferfoot
Calcite | Level 5

I am making a pie chart for the variable Test_Program_Status. There are 5 options "InProgress" "Approved" "Planning" "Complete" and "."

My data has:

173 Complete

18 InProgress

1 Planning and

4 null values.

I am using Proc Template and then Proc SGRENDER to create the pie chart. The problem I'm having is that it is grouping my variable status of Planning and null into one and calling it "Other". So I have 173 Complete 18 InProgress and 5 Other. How do I get the pie chart to show all values of my variable and not group them together?

 

My code is below:

PROC TEMPLATE;
DEFINE STATGRAPH pie;
Dynamic Title;
BEGINGRAPH / border=false designheight=450 ;

discreteattrmap name="piecolors";
value "InProgress" / fillattrs=(color=Orange);
value "Approved" / fillattrs=(color=Green);
value "Planning" / fillattrs=(color=Yellow);
value "Complete" / fillattrs=(color=Blue);
value "." / fillattrs=(color=Red);
enddiscreteattrmap;
discreteattrvar attrvar=Test_Program_Status var=Test_Program_Status attrmap="piecolors";
Entrytitle Title5 / textattrs=(color=black size=12pt weight=bold);

LAYOUT REGION;

PIECHART CATEGORY = Test_Program_Status /
DATALABELLOCATION = INSIDE
Datalabelattrs = (weight=bold size=16)
DATALABELCONTENT = (RESPONSE)
CATEGORYDIRECTION = CLOCKWISE
DATASKIN = NONE
START =90 NAME = 'pie';
DISCRETELEGEND 'pie' / border=false valueattrs=(color=black size=12pt);
ENDLAYOUT;
ENDGRAPH;
END;
RUN;

PROC SGRENDER DATA = Tst_Pgm_Data
TEMPLATE = pie;
dynamic Title = "Reviews Scheduled During the Period";
RUN;

1 REPLY 1
Zifferfoot
Calcite | Level 5

OTHERSLICE=TRUE | FALSE

specifies whether to consolidate smaller pie slices into a single slice that represents “other” values that are in the data, or whether to display those smaller slices as separate pie slices. If this option is set to FALSE, then all unique category values appear as slices. If this option is set to TRUE, then some of the smaller slices might be combined into a single slice, referred to as the Other slice.

 

The solution is to add "otherslice = false"

 

PIECHART CATEGORY = Test_Program_Status /

Otherslice = false
DATALABELLOCATION = INSIDE

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1 reply
  • 1044 views
  • 0 likes
  • 1 in conversation