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.
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.
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 ;
Category = "&Category" and
StudyGroupField= "&StudyGroupField" )
Title "&Category &MeasureName";
pie MeasureValue /
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.
A macro for creating Pie Charts using GTL was published here:
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.
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.
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.