BookmarkSubscribeRSS Feed
tdwilliams1
Calcite | Level 5

I have a pie chart with some very long labels.  I know for other chart types, you can use fitpolicy=split to cause the text to wrap.  Do pie charts have a simlar option?  Otherwise, I end up with tiny charts and very long labels.

 

I've used the slice property to move the label inside outside and arrow. This changes the alignment, but still looks pretty sloppy.

 

Thanks!

 

gchart66.png

6 REPLIES 6
Jay54
Meteorite | Level 14

You are right, there is no FITPOLICY option for GTL PIECHART.  I suggest you call in a suggestion to SAS Tech Support.

You can try using CENTERFIRSTSLICE option if you are using GTL to see if you get better placement.  This will not work with GCHART.

ballardw
Super User

It might help to so the code you are using so we know the actual options in effect.

You might try a LEGEND to generate a reference legend instead of placing the labels  beside the slices. You have fair control of location and such.

tdwilliams1
Calcite | Level 5

Here is the code.  As you will notice right away, it is running within a macro, so there ar a lot of macro variables. But it should illustrate the options I'm using.

 

I tried using the legend option, but that creates a whole new set of layout problems, since I cannot figure out how to get the legend text to wrap.

 

 

 ...

goptions reset=all cback=white border htitle=12pt htext=10pt ;
proc gchart
Data=&ResultsTable
(
WHERE=
(
Category = "&Category" and
MeasureName="&MeasureName" and
StudyGroupField= "&StudyGroupField" )
)
;
Title "&Category &MeasureName";
pie MeasureValue /
sumvar=Members
group= StudyGroup
across=&StudyGroupCount
percent=arrow
NoHeading
slice=arrow
;

run;
Title;
quit;

 ...

 

 

ballardw
Super User

Proc Gchart is not likely to receive many upgrades because of the limitations of device dependent output graphics.

I am going to suggest looking into LEGEND as something that works relatively simple with Proc Gchart pie charts. Or make the values of the group variables shorter. Or use an annotate data set, which is not going to be easy in any way.

 

If someone is not forcing use of a pie chart I would suggest moving to Proc Sgplot or GTL and use of a bar chart or other graphic instead of pie charts.

DanH_sas
SAS Super FREQ

As @Jay54 mentioned, pie charts are supported in GTL. Using the legend support in DISCRETELEGEND might get you something that will work for you.

Jay54
Meteorite | Level 14

A macro for creating Pie Charts using GTL was published here:

https://blogs.sas.com/content/graphicallyspeaking/2018/06/25/pie-charts-redux/

 

Code is included in link at the bottom of the article.  Only a few parameters are needed, but more are provided to tweak the results.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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
  • 6 replies
  • 1265 views
  • 0 likes
  • 4 in conversation