BookmarkSubscribeRSS Feed
SosoT
Calcite | Level 5

Hi

I want to add brackets and asterisks on a boxplot to highlight boxes that are significantly different.

I have tried the following annotate code:

data anno;

length xc1 $ 6;

retain drawspace "datavalue";

function="polyline";

y1=0.019;

xc1= "class1";

output;

y1=0.020;

output;

xc1="class2";

output;

y1=0.019;

output;

y1=0.020;

output;

run;

proc sgplot data= myData sganno=anno;

    vbox values/category=categoy ;

run;

But no line is draw on the plot.

Can somebody can help me?

4 REPLIES 4
Jay54
Meteorite | Level 14

Please see documentation.  After POLYLINE, you need one or morePOLYCONT function for the subsequent points.  Also, it will be easier if you attach your data set.

SosoT
Calcite | Level 5

Thank you for your answer.

I have tried to add POLYCONT function.

data anno;

length xc1 $ 15;

retain drawspace "datavalue";

function="polyline";

y1=0.019;

xc1= "class1";

output;

y1=0.020;

function="polycont";

output;

xc1="class2";

function="polycont";

output;

y1=0.019;

function="polycont";

output;

run;

But then I add the following warning "

WARNING: L'instruction DrawPolyline a des valeurs manquantes/incorrectes pour la position (X or Y). Instruction de tracé ignorée."

I attach the data

Jay54
Meteorite | Level 14

With cataqgory values, the XC1 value provided have to EXACTLY match the value on the axis.   We will improve the matching at our end to make this easier.  In the meantime, make sure your XC values are EXACTLY the same as the values on the axis.

Soso_Anno.png

proc import datafile='C:\Soso_data.xls'
     dbms=XLS out=myData replace;
run;

data mydata2;
  length cat $6;
  set mydata;
  cat=category;
  run;

data anno;
length xc1 $6;
retain drawspace "datavalue";

function="polyline";
y1=0.019;
xc1= "class1";
output;

function="polycont";
y1=0.020;
xc1="class2";
output;

run;

ods listing;

proc sgplot data= myData2 sganno=anno;
    vbox values/category=cat ;
run;

SosoT
Calcite | Level 5

Thank you very much.

It works perfectly.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 938 views
  • 3 likes
  • 2 in conversation