BookmarkSubscribeRSS Feed
erkenbea
Calcite | Level 5

I am working on SAS 9.4 on a windows machine. 

 

I am using PROC GCHART to produce donut charts that are divided by whether someone is on the same or opposite gendered team. 

 

It's working great except some of the charts have a legend that does not include the formats but rather, numbers that are not even present in the variable. The odd thing is that the legend is fine for some charts and not for others even though the code and the attributes of the variables are the same. 

 

Here is an example below: 

 

 **** This one works see first graph on attachment*****

PROC GCHART DATA=gender;
TITLE "Type of Injury By Gender Opposing Participation";
DONUT q20 / SUBGROUP=oppgen VALUE=inside PERCENT=INSIDE
LEGEND;
RUN;

 

**** This one doesn't see second graph on attachment****

PROC GCHART DATA=gender;
TITLE "Injury occured in practice or competition By Gender Opposing Participation";
DONUT q10 / SUBGROUP=oppgen VALUE=inside PERCENT=INSIDE
LEGEND;
RUN;

 

Those values are not even in the data set. 1="competition" 2=practice 3=performance

 

 

Things I have tried: 

1) I have made a HBAR using SGPLOT -- the labels work here. 

2) I have checked that the formats are attached

3) I have tried to change the numeric variable into a character but get all missing values then. 

4) I have used a format statement within the PROC GCHART

5) I have re-created the dataset. 

6) I have tried using the "LEGEND VALUES= Statement" but it says that it is the wrong place or thinks I am specifying the places for the labels of the pie and wants "INSIDE" "ARROW" etc.

 

Any help would be appreciated -- I have not been able to find this happening to anyone else on the google or the forum and I am tearing my hair out! Thank you, Alex 

 

1 REPLY 1
Cynthia_sas
SAS Super FREQ

Hi:

  I don't see a format or a label statement in your code. You didn't post any data, so no one can test your code or make suggestions. The screen shots below were taken using SASHELP.PRDSALE. As you can see, there is a concentric DONUT for each unique value of COUNTRY (the SUBGROUP variable) and each segment in the DONUT is colored based on the values of PRODUCT. So, the legend reflects the values for PRODUCT.

 

cynthia

 

  Here's output using only the LABEL statement:

gchart1_only_label.png

 

  And, here's output using the LABEL and FORMAT (with a user-defined format):

gchart2_use_label_and_format.png

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
  • 1 reply
  • 1191 views
  • 0 likes
  • 2 in conversation