When making a graph through gplot, is there a way to add extra information as text to your graph, but the info is predefined and should be gathered from your data.
I now do the following, and would like for the first graph to have a text box somewhere (preferably top right corner) with "flag = 0" and with "flag = 1" for the last two graphs.
data digits;
input ID $1. digit observed expected;
datalines;
A 1 33.3 33.3
A 2 33.3 33.3
A 3 33.3 33.3
B 1 25 33.3
B 2 75 33.3
B 3 0 33.3
C 1 45 33.3
C 2 45 33.3
C 3 10 33.3
;run;
data attribute;
input ID $1. flag;
datalines;
A 0
B 1
C 1
;
proc gplot data=digits;
plot expected*digit
observed*digit
/ overlay legend vref=0 ;
by ID;
run;
In PROC GPLOT, you would need to use the ANNOTATE facility to add text or a box to a graph
You might be better off using PROC SGPLOT to do your plotting (it's a newer procedure with lots of nice features), in which case you can add text more easily using the INSET or TEXT statements.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: