BookmarkSubscribeRSS Feed
palolix
Lapis Lazuli | Level 10
Dear SAS Community,
 
I would like my spider plot to start from 0 in the center of the plot. I tried the option starinradius=0 but the starlines got totally messed up. I would greatly appreciate it your help!
 
Thank you very much
 
palolix_0-1786049284220.png

I tried this code:

 

proc format;
value DM_range    1 = '15-20' 2 = '20-25' 3 = '25-30' 4 = '30-35' ;
 
 
data wide;
input DM_range  a_texture b_texture c_texture d_texture e_texture f_texture g_texture;
 
format DM_range DM_range.;
output;
 
datalines;
1 10.71 30.36 12.50 23.21 1.79  75.00 5.36
2 26.42 24.53 29.25 2.83  0.94  69.81 3.77
3 34.15 22.93 42.93 7.32  2.44  44.88 3.41
4 54.96 21.37 55.73 1.53  7.63  30.53 3.05
;
run;
 
proc sort data=wide out=long;
    by DM_range;
run;
 
/* Transpose texture */
proc transpose data=long name=texture_label out=long1(rename=(COL1 = texture_value) );
    by DM_range;
    var a_texture b_texture c_texture d_texture e_texture f_texture g_texture;
run;  
 
  PROC PRINT DATA=long1 ;
RUN ;
 
 
data longnew;
    set long1;
    if texture_label = 'a_texture' then texture_label = 'Creamy';
    else if texture_label = 'b_texture' then texture_label = 'Mushy';
else if texture_label = 'c_texture' then texture_label = 'Smooth';
else if texture_label = 'd_texture' then texture_label = 'Stringy';
else if texture_label = 'e_texture' then texture_label = 'Dry';
else if texture_label = 'f_texture' then texture_label = 'Watery';
else if texture_label = 'g_texture' then texture_label = 'None';
run;
 
PROC PRINT DATA=longnew ;
RUN ;
 
goptions reset=all cback=white border htitle=12pt htext=12pt;
goptions ctext=gray40;
footnote1 j=c h=10pt "N 15-20= 56; N 20-25= 106; N 25-30= 205; N 30-35= 131";
axis1 color=grayde order=(0 to 100 by 20) /*value=none*/; 
title1 j=c h=13pt 'Comparison of texture by DM range for BL516 (relative %)';
 
proc gradar data=longnew;
   chart texture_label / freq=texture_value ORDERACROSS=FORMATTED
                 overlay=DM_range
staraxis=(axis1 axis1 axis1 axis1 axis1 axis1 axis1)
/*starinradius=0*/
spiderweb
noframe
 starcircles=(25 50)
 cstarcircles=black
cstars=(blue lime red Fuchsia)
wstars=(2 2 2 2)
lstar=(1 1 1 1)
cframe=white
                 ;
run;
quit;
 
If I include starinradius=0, the 0 starts at the center of the graph but the lines totally change and this is not what I want.
palolix_1-1786049408841.png

 

2 REPLIES 2
ballardw
Super User

I ran your code as posted and the log for the Gradar part shows:

NOTE: Processing beginning for CHART statement number 1.
WARNING: Negative or zero value encountered for FREQ= variable.
WARNING: These observations are not processed.
NOTE: 27 nonmissing values of texture_label are processed.
NOTE: Radar categories are sorted in the order determined by the
      classification cell corresponding to DM_range=15-20.
WARNING: One or more overlay values is missing.
NOTE: 67846 bytes written to C:\Users\Owner\AppData\Local\Temp\SAS
      Temporary Files\_TD16884_DESKTOP-C36D7SF_\radar.png.
68   quit;

NOTE: PROCEDURE GRADAR used (Total process time):
      real time           0.36 seconds
      cpu time            0.15 seconds


You may want to consider if these warnings about values are affecting the plot.

 

I am not sure what you want when you say you want the "plot to start from 0".   If you want 0 at the center of the plot you will have some lines spike inward has you have values in plot your plot set like 0.94, 1.79 and 1.53 which with the scale of values you show will approach the center. So perhaps a better description of what you actually want for appearance will help.

 

I will admit that it has been a long time since I used GRADAR regularly, like 1996, and then mostly for windroses as I was dealing with wind directions. Are you sure that you want to use a FREQ variable? There are a few places where non-integer Freqs behave a bit oddly and that may be the cause of the warnings.  I also seem to remember that having numeric values was best for controlling orders of appearance.

 

palolix
Lapis Lazuli | Level 10

Thank you very much for your reply! The warnings are due to the value 0.94 (if I replace that value with a number above 0, then all warnings and notes are gone). What I would like is the 0 at the center of the plot if possible. The values I have are relative percentages.

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand in the Innovate Hub.

Watch 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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 43 views
  • 0 likes
  • 2 in conversation