I want to annotate a footnote on the graph using sgplot, with a line break between the first and the second lines of the annotated footnote, so that the results look like this:
Below is my unsuccessful attempt at doing so:
ods graphics / width=6in height=4in;
data anno_footnote1;
length function $10 anchor $20 drawspace $20;
function='text';
drawspace='GraphPercent';
x1=11; y1=4;
label= "NOTE: First line of annotated footnote.";
textcolor='gray77'; textsize=8;
width=100;
run;
data anno_footnote2;
length function $10 anchor $20 drawspace $20;
function='text';
drawspace='GraphPercent';
x2=11; y2=2;
label="SOURCES: Second line of annotated footnote.";
textcolor='gray77'; textsize=8;
width=5000;
run;
data anno_footnote;
set anno_footnote1 anno_footnote2;
run;
proc sgplot data=sashelp.class noautolegend uniform=all sganno=anno_footnote;
bubble x=age y=height size=Weight / group=Sex;
run;
Hello @KRA15,
Try this:
data anno_footnote;
length function $10 anchor $20 drawspace $20 label $60;
anchor='bottomleft';
function='text';
drawspace='GraphPercent';
textcolor='gray77'; textsize=8;
width=100;
x1=1; y1=4;
label="NOTE: First line of annotated footnote.";
output;
x1=1; y1=0;
label="SOURCES: Second line of annotated footnote.";
output;
run;
proc sgplot data=sashelp.class noautolegend uniform=all sganno=anno_footnote pad=(bottom=10 pct);
bubble x=age y=height size=Weight / group=Sex;
run;
Hello @KRA15,
Try this:
data anno_footnote;
length function $10 anchor $20 drawspace $20 label $60;
anchor='bottomleft';
function='text';
drawspace='GraphPercent';
textcolor='gray77'; textsize=8;
width=100;
x1=1; y1=4;
label="NOTE: First line of annotated footnote.";
output;
x1=1; y1=0;
label="SOURCES: Second line of annotated footnote.";
output;
run;
proc sgplot data=sashelp.class noautolegend uniform=all sganno=anno_footnote pad=(bottom=10 pct);
bubble x=age y=height size=Weight / group=Sex;
run;
I get decent looking results with:
ods graphics / width=6in height=4in;
data anno_footnote;
length function $10 drawspace $20 label $100;
function='text';
drawspace='GraphPercent';
textcolor='gray77'; textsize=7; anchor="left";
width=100;
x1=5; y1=5;
label= "NOTE: First line of annotated footnote.";
output;
x1=5; y1=2;
label="SOURCES: Second line of annotated footnote.";
output;
run;
proc sgplot data=sashelp.class noautolegend uniform=all sganno=anno_footnote;
bubble x=age y=height size=Weight / group=Sex;
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.