DATA Step, Macro, Functions and more

Proc Template Legend

Accepted Solution Solved
Reply
Contributor
Posts: 21
Accepted Solution

Proc Template Legend

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


Accepted Solutions
Solution
‎06-08-2017 05:20 PM
Super User
Posts: 10,483

Re: Proc Template Legend

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'

;

View solution in original post


All Replies
Solution
‎06-08-2017 05:20 PM
Super User
Posts: 10,483

Re: Proc Template Legend

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'

;

Contributor
Posts: 21

Re: Proc Template Legend

 

It worked. Thanks!!!

 

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 154 views
  • 0 likes
  • 2 in conversation