BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Whitlea
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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

2 REPLIES 2
ballardw
Super User

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'

;

Whitlea
Obsidian | Level 7

 

It worked. Thanks!!!

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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