BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
nancy6
Calcite | Level 5

 

proc sgplot data=lsmeans_cog_plot noautolegend;
styleattrs
datacolors=(steelblue darkorange forestgreen crimson)
datacontrastcolors=(steelblue darkorange forestgreen crimson);
band x=year lower=lower upper=upper /
group=group
transparency=0.7
name="band";
series x=year y=estimate /
group=group
markers
markerattrs=(symbol=circlefilled size=9)
lineattrs=(thickness=2.5)
name="line"
legendlabel=" ";
xaxis label="Year"
values=(2008 to 2020 by 2)
labelattrs=(size=12pt)
valueattrs=(size=11pt);
yaxis label="cognitive score"
labelattrs=(size=12pt)
valueattrs=(size=11pt);
keylegend "line" /
title="self-report hearing loss"
titleattrs=(size=11pt)
valueattrs=(size=10pt)
location=inside
position=bottomleft
noborder;
run;

 

 

I tried using
inset "A" / position=topleft textattrs=(size=16pt weight=bold) backcolor=white noborder;,
but this places the “A” inside the plotting area. I also tried
title j=left h=16pt bold "A";,
which positions the “A” outside the graph entirely.

Ideally, I would like the panel label to appear —the “A” positioned just outside the plotting area but within the overall figure boundary (above yaxis label).

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
/*****************************/
%let label1=A(*ESC*){sup 'mw -1'}  ;
data _anno;
length label $ 200;
 drawspace="graphpercent"; function="text"; textweight="normal"; textsize=12;textcolor="black"; width=200;
 x1=5; y1=95;label="&label1."; output;
 run;
proc sgplot data=sashelp.class sganno=_anno;   
scatter x=weight y=height;   
xaxis label=' ';
yaxis label=' ';
run;

Ksharp_0-1777359202764.png

 

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26

I would think the TEXT command in PROC SGPLOT would work, that's what it was designed to do (but I have not tried it).

--
Paige Miller
DanH_sas
SAS Super FREQ
Titles normally go within the graph but outside the plot area. However, if you are using the NOGTITLE option on the ODS HTML statement, the the title will be pulled outside of the graph.
Ksharp
Super User
/*****************************/
%let label1=A(*ESC*){sup 'mw -1'}  ;
data _anno;
length label $ 200;
 drawspace="graphpercent"; function="text"; textweight="normal"; textsize=12;textcolor="black"; width=200;
 x1=5; y1=95;label="&label1."; output;
 run;
proc sgplot data=sashelp.class sganno=_anno;   
scatter x=weight y=height;   
xaxis label=' ';
yaxis label=' ';
run;

Ksharp_0-1777359202764.png

 

Catch up on SAS Innovate 2026

Dive into keynotes, announcements and breakthroughs on demand.

Explore 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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 315 views
  • 4 likes
  • 4 in conversation