BookmarkSubscribeRSS Feed
echoli
Obsidian | Level 7

Hi All,

 

I am using proc sgplot to plot a boxplot. but how can I add a star sign above the significance variables?

this is my boxplot figure, I want to add a sign in the last two box (red and green) to mark them as significant, since there P-value less than 0.05.

 

boxplot_1.png

Here is my code:

proc sgplot data=boxplot_1;
vbox lab_value / category = treatment group = group
lineattrs=(pattern=solid) whiskerattrs=(pattern=solid);
refline 0 / axis = y lineattrs = (color = black thickness = 2);
xaxis display=(nolabel) type = discrete labelattrs = (size = 15pt Weight = Bold) valueattrs = (size = 20pt);
yaxis grid labelattrs = (size = 20pt Weight = Bold) valueattrs = (size = 15pt);
keylegend / location = inside position = topleft across = 1;
run;

 

Any way to help me.

 

Thanks,

C

2 REPLIES 2
art297
Opal | Level 21

Would using the annotate feature suffice? see: https://support.sas.com/resources/papers/proceedings11/277-2011.pdf

 

Art, CEO, AnalystFinder.com

 

djrisks
Barite | Level 11

Hello C,

 

Here is an example that you can use and edit. Basically you need to create the observations in your dataset at the correct y value and use the markerchar option:

 

data cars;
  set sashelp.cars;
run;

data cars2;
  invoicey = 100000; make = "Acura"; char = "*"; output;
  invoicey = 100000; make = "Audi"; char = "*"; output;
  invoicey = 100000; make = "BMW"; char = "*"; output;
run;

data cars3;
  set cars cars2;
run;

proc sgplot data = cars3;
  where make in ("Acura" "Audi" "BMW");
  scatter x = make y = invoicey / markerchar = char markercharattrs=(size = 15 color = red);
  vbox invoice / category = make;
run;

 

Many thanks,

 

Kriss 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 2384 views
  • 0 likes
  • 3 in conversation