My legend is not showing up. I have tried increasing the area size of my graph but it still doesn't show up. No errors appear in my log. Does anyone have any suggestions? Thanks!
proc template;
define statgraph percent ;
begingraph / border=off datacolors=(white CX90B0D9 white CX90B0D9 white CX90B0D9);
layout overlay / walldisplay=(fill)
yaxisopts=( display=(tickvalues line label)GRIDDISPLAY=on LABELATTRS=(size=8pt)
TICKVALUEATTRS=( size=8pt ) label="Percent"
offsetmin=0 offsetmax=0 linearopts=( viewmin=0 viewmax=50 tickvaluelist=(0 10 20 30 40 50)))
xaxisopts=( DISCRETEOPTS=(TICKVALUEFITPOLICY=split TICKVALUESPLITJUSTIFY=center)
TICKVALUEATTRS=( size=8pt weight=bold ) display=( tickvalues));
DiscreteLegend "z_ovrwt1" / title= 'z_ovrwt1' ;
barchartparm x=sex y=percent / group=z_ovrwt1 GROUPDISPLAY=cluster
errorupper=uppct errorlower=lowpct
ERRORBARATTRS=(color=black thickness=1.5)
OUTLINEATTRS=(color=black thickness=1.5);
scatterplot y=dataloc x=sex / group=z_ovrwt1 groupdisplay=cluster
markercharacter=percent MARKERCHARACTERATTRS=(size=8pt weight=bold color=black );
discretelegend "z_ovrwt1"/ title= "string";
endlayout;
endgraph;
end;
run;
proc sgrender data=percent template=percent;
format z_ovrwt1 ovrwt. sex sex.;
run;
SAS 9.4
DiscreteLegend "z_ovrwt1"
is going to expect either a Legendlabel = "z_ovrwt1" or a name='z_ovrwt1' in the graph definition.
such as
barchartparm x=sex y=percent / group=z_ovrwt1 GROUPDISPLAY=cluster
errorupper=uppct errorlower=lowpct
ERRORBARATTRS=(color=black thickness=1.5)
OUTLINEATTRS=(color=black thickness=1.5)
name='z_ovrwt1'
;
DiscreteLegend "z_ovrwt1"
is going to expect either a Legendlabel = "z_ovrwt1" or a name='z_ovrwt1' in the graph definition.
such as
barchartparm x=sex y=percent / group=z_ovrwt1 GROUPDISPLAY=cluster
errorupper=uppct errorlower=lowpct
ERRORBARATTRS=(color=black thickness=1.5)
OUTLINEATTRS=(color=black thickness=1.5)
name='z_ovrwt1'
;
It worked. Thanks!!!
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.