Reputation: 1537
In sgplot, use inset
statement can insert a text box inside graph.
proc sgplot data=_test5;
vbar x / response=y ;
keylegend / position=topright noborder autoitemsize;
xaxis display=(nolabel);
yaxis grid;
inset 'text here' /border position=topright;
run;
For position=
, it only provides serveral fixed options. But actually I know the ideal position for text is something like (400,380). Is there a way to deal with this?
Upvotes: 1
Views: 4889
Reputation: 63434
If you want to put the text at various places, you have a few options. The simplest is an annotate dataset, where you specify where to put the text. This is explained here. example using your example dataset from the previous question:
data annods;
input x1 y1 function $ drawspace :$10. label &:$9.;
datalines;
400 380 text WALLPIXEL Text Here
;;;;
run;
proc sgplot data=_test3 sganno=annods;
vbarparm category=Day response=DailySales/group=dow barwidth=0.7 nooutline;
series x=day y=WeeklySales;
keylegend / position=topright noborder autoitemsize;
xaxis display=(nolabel);
yaxis grid;
run;
If you're placing a lot of these, you can use the scatterplot
with markerchar
to place text as an overlaid scatterplot, or use the text
plot available in 9.4 TS1M2.
I don't believe there's a way to make an exactly specified inset, though there may be a way to work around it playing with the various margins. I suspect Sanjay (the lead developer, who often answers questions on communities.sas.com) is the right person to answer that specifically.
Upvotes: 3