piechart: overlapping values

Reply
Contributor
Posts: 43

piechart: overlapping values

[ Edited ]

Dear Community,

 

i just created a pie chart and have a lot of overlapping values. Do you know how to deal with it?

I also would like to have the whole Name of the categories, but its only the first 7 letters. What can i do about it?

 

Thank you in advance Smiley Happy

 

data arzneimittelgruppen;
set arzneimittelgruppen;
if allergy=1 then category="allergy";
if antibiotics=1 then category="antibiotics";
if antidiabetic=1 then category="antidiabetic";
if antihypertensive=1 then category="antihypertensive";
if antipsychotic=1 then category="antipsychotic";
if antivirals=1 then category="antivirals";
if biologicals=1 then category="biologicals";
if contrast=1 then category="contrast";
if copd=1 then category="copd";
if dermatology=1 then category="dermatology";
if registry=1 then category="registry";
if eye=1 then category="eye";
if haematology=1 then category="haematology";
if hormone=1 then category="hormone";
if neurological=1 then category="neurological";
if nondrug=1 then category="nondrug";
if nonpres=1 then category="nonpres";
if oncology=1 then category="oncology";
if orphan=1 then category="orphan";
if others=1 then category="others";
if pain=1 then category="pain";
if urologics=1 then category="urologics";
run;

data arzneimittelgruppen;
set arzneimittelgruppen;
format category $20.;
run;

data arzneimittelgruppen;
  length category $ 20;
  set arzneimittelgruppen;
run;


PROC GCHART 
DATA=arzneimittelgruppen;
PIE3d category / other=0 clockwise type= percent;
RUN;
QUIT;

piechart.png

Super User
Posts: 13,508

Re: piechart: overlapping values

Posted in reply to marysmith

You can get the full value of your Category variable by adding a LENGTH statement prior to assigning a value.

 

Length category $ 20;

if allergy=1 then category="allergy";

 

If a length is not explicitly set then SAS default rules will assign a length. Since the first use you have is to assign "allergy" then the length gets set to 7 to hold that word. Everything longer then gets truncated.

 

Pie charts in general are hard to interpret the visual portion of contribution to a whole. The tilted 3d version is even worse.

If a Pie chart must be use then use PIE instead of pie3d and the option percent=arrow may help with displaying text of the smaller slices.

Contributor
Posts: 43

Re: piechart: overlapping values

Thank you! Ah I found my mistake thanks! Yeah I had a piechart before and I did it with the arrow option, but still the values overlapped Smiley Sad
Ask a Question
Discussion stats
  • 2 replies
  • 73 views
  • 0 likes
  • 2 in conversation