data test;
set sashelp.class;
if age in (12,13) then gr=1;
else if age =14 then gr=2;
else gr=3;
run;
proc sort data=test;
by gr;
run;
proc format;
value gr
1="kids Reference"
2="teenagers 9 (4-24)"
3="old 78 (32-189)"
;
proc template;
define style mystyle;
parent=styles.sasweb;
class graphwalls /
frameborder=on;
class graphbackground /
color=white;
end;
run;
ods graphics on / reset=all;
ods html style=mystyle path='.' file='newgraph.html';
ods graphics / reset=all width=6.5in height=4.5in border=off ;
legend1 label=none;
proc sgplot data=test DATTRMAP=attrmap1;
scatter x=weight y=Height /group=gr ;
keylegend / location=outside position=bottom NOBORDER down=4;
label gr='Age, years OR (95% CI)';
format gr gr.;
run;
The least you can do is:
1. Please format the code you post
2. Please run the code you post; This code results in an error.
Also:
3.The only way to align text in the manner you want is to use fixed-pitch font, as you have been told.
Do you understand this?
4. If you do, you can see why this aligns the legend as you request:
proc format;
value gr
1="kids Reference"
2="teenagers 9 (4-24)"
3="old 78 (32-189)"
;
...
proc sgplot data=TEST;
...
keylegend / ... valueattrs=(family='Courier New') ;
...
run;
Here is the image (broken on some browsers it seems):
