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!!!

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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