BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
djrisks
Barite | Level 11

Hello @Manj,

 

You can make the median line have a dotted line by using lineattrs=(pattern=34).

 

What do you mean by increase the length of the caps. Do you mean the width of the caps or the thickness, or do you want the caps to go higher/lower on the y-axis?

Manj
Fluorite | Level 6
Hi
The median line is created by combining two boxes at median using highlow statements. Hence the line pattern isn’t working only for the median line .

Regarding the ‘cap’ I meant increasing the width NOT the thickness
Tx
djrisks
Barite | Level 11

You can use the NOOUTLINE option to remove the outline of the bars. And then use another HIGHLOW statement with TYPE=LINE to draw the median, and then you can set the median attribute. You can also use the HIGHLOW statement to increase the width of the caps.

DanH_sas
SAS Super FREQ

To change the median line pattern, use the MEDIANATTRS option:

medianattrs=(pattern=dash)

For the cap size, use the CAPSCALE option:

capscale=1.5 /*for example */

 

Hope this helps!

Dan

DanH_sas
SAS Super FREQ

Ignore what I posted. I thought you were still using box plots.

DanH_sas
SAS Super FREQ

Instead of using a HIGHLOW plot for the whiskers, use a SCATTER plot with Y error bars. Then, you can use CAPSCALE to control the size of the caps.

Manj
Fluorite | Level 6

@DanH_sas and all those replied,

Thanks, as I got some kind of clue from each of your responses.

 

@DanH_sas Thanks , I tried ERRORCAPSCALE (as shown in the https://blogs.sas.com/content/graphicallyspeaking/files/2017/11/Cap_Scale.txt) ,but that is not working for me . I use SAS 9.4 version. Is it because of that?

 

I found a way to keep the median dashed line. 

 

See below my output and code:

 

data aaa;
set stat;
IQR=(p75-p25) *1.5;
IQR_plus=p75+IQR;
iqr_neg=p25-iqr;
mchar='-';
mbigchar='------------------------------------'; /** to keep the median dashed line***/
cnsrtxt=put(cnsr,mace.);
run;

 

proc sgplot data=aaa nocycleattrs;

highlow x=cnsr high=p75 low=p25 / group=cnsrtxt type=bar
groupdisplay=cluster grouporder=ascending clusterwidth=0.7 barwidth=0.7 name='a';

scatter x=cnsr y=mean / group=cnsrtxt groupdisplay=cluster
grouporder=ascending clusterwidth=0.7 markerattrs=(size=9 symbol=circlefilled );

scatter x=cnsr y=p75 / yerrorupper=iqr_plus yerrorlower=p75 group=cnsrtxt groupdisplay=cluster
grouporder=ascending clusterwidth=0.7 markerchar=mchar markercharattrs=(size=1); ;

scatter x=cnsr y=p25 / yerrorupper=p25 yerrorlower=iqr_neg group=cnsrtxt groupdisplay=cluster
grouporder=ascending clusterwidth=0.7 markerchar=mchar markercharattrs=(size=1);


scatter x=cnsr y=median / yerrorupper=median yerrorlower=median noerrorcaps group=cnsrtxt groupdisplay=cluster
grouporder=ascending clusterwidth=0.7 markerchar=mbigchar markercharattrs=(size=9);


keylegend 'a' / location=outside position=bottom across=1 title="";

xaxis display=none;
yaxis label =" xxxxxxxxxxxxxxxxx";
run;

 

 

 
 

 

 

 

 

 

 

 

 

DanH_sas
SAS Super FREQ

The CAPSCALE options were added in SAS 9.4m5. What version do you have?

Manj
Fluorite | Level 6

i use SAS 9.4

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 23 replies
  • 3435 views
  • 3 likes
  • 4 in conversation