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: Call for Content

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!

Submit your idea!

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