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!!!
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.