Data visualization with SAS programming

Formats not working in some gchart procedures

Reply
Learner
Posts: 1

Formats not working in some gchart procedures

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 

 

SAS Super FREQ
Posts: 8,820

Re: Formats not working in some gchart procedures

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

Ask a Question
Discussion stats
  • 1 reply
  • 207 views
  • 0 likes
  • 2 in conversation