BookmarkSubscribeRSS Feed
Mathassens
Fluorite | Level 6

Hello,

 

I am currently trying to get a nice display of my donut in a pdf.

I tried a lot of differents codes but i can not get what i want.

May be could you help me please ?

My dataset used for my reporting is DONUT.

Here is my code:

 

 
ods pdf startpage=now;
 
ODS LAYOUT START;
 
ODS region x=-10 mm y=20 mm width=180 mm height=80 mm ;
 
ods graphics / width=8in height=6in;
 
pattern1 v=s c="&couleur_1.";
pattern2 v=s c="&couleur_2.";
pattern3 v=s c="&couleur_3.";
 
legend1 label=none across=2 FWIDTH=3 value=(h=6 pt justify=center) 
POSITION=(bottom center) offset=(0 pct,0 pct) shape=bar(4pct,3pct) value=("Assuré principal (2040)" "Conjoint (297)" "Enfant (1133)");
 
title h=12pt ls=1.5 "Effectifs Base &annee." bold j=center ;
 
 
proc gchart data=DONUT;
 
donut typ_ass / type=sum
 sumvar=pctn0 percent=inside value=inside slice=arrow
 noheader
 
    donutpct=50
    value=none
COUTLINE=white 
plabel=(font='Albany' color=white h=4)
    legend=legend1;
run;
 
ODS LAYOUT END;
 
ODS PDF CLOSE;
 
and i put some pictures of what i have ( at the left) and what i want (at the right) to display my donut in a pdf page.
 
Thanks you for your help 🙂
 
what_i_have.pngWhat I wantWhat I want 

 

5 REPLIES 5
Ksharp
Super User

You could try PROC SGPIE instead.

 

data have;
infile cards expandtabs truncover;
input DRS_LIB_TYP_ASS &$40.	N0	PCTN0	typ_ass &$40.;
cards;
Assuré principal	2040	0.588	Assuré principal (2040)
Conjoint	297	0.086	Conjoint (297)
Enfant	1133	0.327	Enfant (1133)
;
data have2;
 set have;
 do i=1 to N0;
  output;
 end;
run;

ods pdf file='c:\temp\temp.pdf' style=htmlblue;
option nonumber nodate;
title 'Effect Base 2021';
proc sgpie data=have2;
donut typ_ass/datalabeldisplay=(response percent) 
 datalabelloc=inside datalabelattrs=(color=white weight=bold);
keylegend /title='';
run;
ods pdf close;

Ksharp_0-1709270387551.png

 

Mathassens
Fluorite | Level 6

Thanks you for your answer but unfortunately, i have the following error:

ERROR: Procedure SGPIE not found.

ballardw
Super User

Which version of SAS are you running? Proc SGPIE was pre-production in 9.4.6 and production for 9.4.7 which would mean you are running 9.4.5 or earlier.

You can check by running:

Proc setinit;
run;

In the log you would see something like this in the output:

Original site validation data
Current version: 9.04.01M7P080520

The M7 means that I am currently rung 9.4.7 .

This means that you may want to update your install. That should be covered by any license.

Ksharp
Super User

Emm. Since you don't have PROC SGPIE license, then @GraphGuy (a.k.a Robert.Allison) may give you a help.

Mathassens
Fluorite | Level 6

My display is now quite nice with the proc gchart

I will keep my job 😉

Thanks a lot for your help 🙂 

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
  • 5 replies
  • 2434 views
  • 2 likes
  • 3 in conversation