BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
paolo_santin
Calcite | Level 5

Hi!

I would like to create a pie chart with SAS but I have special needs.

In the graph it should be possible to change the colour of the text based on an independent variable.

What I want to achieve is shown below.

pie_chart.PNG

PROC GCHART can decide if the value are shown inside or outside the graph and the colours of them.

But what about a mixture of them, Is this possible with SAS system?

Is annotation dataset the only way to solve this problem?

Thank you in advance,

Best regards

Paolo

1 ACCEPTED SOLUTION

Accepted Solutions
GraphGuy
Meteorite | Level 14

One way would be to annotate the text - then you have programmatical control over exactly what the label says, and also the exact color.

To do that, you'll probably need to use the cntl2txt annotate function (in combination with others), as described here (note this example annotates both the pie, and the label):

http://support.sas.com/documentation/cdl/en/graphref/63022/HTML/default/viewer.htm#annodict-cntl2txt...

Using cntl2txt is a bit 'tricky' (I'm not very good with it, and I don't think I have any examples of using it to label a pie chart).

View solution in original post

2 REPLIES 2
GraphGuy
Meteorite | Level 14

One way would be to annotate the text - then you have programmatical control over exactly what the label says, and also the exact color.

To do that, you'll probably need to use the cntl2txt annotate function (in combination with others), as described here (note this example annotates both the pie, and the label):

http://support.sas.com/documentation/cdl/en/graphref/63022/HTML/default/viewer.htm#annodict-cntl2txt...

Using cntl2txt is a bit 'tricky' (I'm not very good with it, and I don't think I have any examples of using it to label a pie chart).

paolo_santin
Calcite | Level 5

Hi Robert and thank you for your fast answer!

As you said I don't think there are other ways than create an annotation dataset with all the informations about slice colors, label and everything else.

I've found this paper on the net and it seems to be a very nice starting point.

http://www.mwsug.org/proceedings/2011/coders/MWSUG-2011-CC13.pdf

Br

Paolo

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 2 replies
  • 1468 views
  • 0 likes
  • 2 in conversation