Sunday 15 September 2013

How do I create a pie chart in SAS for a variable whose values I've grouped using PROC FORMAT? -



How do I create a pie chart in SAS for a variable whose values I've grouped using PROC FORMAT? -

i have variable ideology takes on values 1 7. i've decided create these continuous values 3 groups using proc format so:

proc format; value ideofmt 1-2='lib or extr lib' 3-5='mod lib, slight lib or slight cons' 6-7='cons or extr cons'; run;

i want create pie chart takes business relationship grouping of these continuous values, if possible without having modify info itself. i've tried is:

proc gchart data=sasuser.project2; pie ideology /noheading percent=arrow slice=inside value=inside coutline=black woutline=2; format ideology ideofmt.; run;

this gets me pie chart has grouping labels want, pie chart split 7 slices (corresponding 7 values) instead of 3 (corresponding 3 groups).

any help much appreciated. thanks!

add discrete alternative pie statement:

proc gchart data=sasuser.project2; pie ideology /noheading percent=arrow slice=inside value=inside coutline=black discrete woutline=2; format ideology ideofmt.; run; quit;

otherwise, think sas assigns slices based on quantiles of data, ignoring formatted values.

also, quit statement required @ end of proc gchart in add-on run statement.

sas pie-chart

No comments:

Post a Comment