BookmarkSubscribeRSS Feed
SarahDew
Obsidian | Level 7

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;
1 REPLY 1
PaigeMiller
Diamond | Level 26

In PROC GPLOT, you would need to use the ANNOTATE facility to add text or a box to a graph

See: https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=graphref&docsetTarget=p1b...

 

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.

https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=grstatproc&docsetTarget=p...

--
Paige Miller

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 1 reply
  • 1034 views
  • 0 likes
  • 2 in conversation