Data visualization with SAS programming

sgplot and legend

Reply
Frequent Contributor
Posts: 115

sgplot and legend

I am using the below script to create a bullet chart. I am not asking for a legend but it's still gived me the legend.

ods graphics / reset width=250 height=130 ;
proc sgplot data=chart ;
hbar binner/ response=bin3 transparency=0.2 nooutline barwidth=1 fillattrs=(color=gray) ;
hbar binner/ response=actual transparency=0.2 nooutline barwidth=.3 fillattrs=(color=black) ;
refline .71 /lineattrs=(color=red Thickness=4px ) axis=x ;
yaxis display =none;
xaxis display=(nolabel);

run;
SAS Super FREQ
Posts: 864

Re: sgplot and legend

Use the NOAUTOLEGEND option on the proc statement to turn off the legend.

Thanks!
Dan
Frequent Contributor
Posts: 115

Re: sgplot and legend

Thanks. That worked.
Another question.
I an using databels to show the value of the measure variable.
By default the value appears at the end of the bar. Is there a way of making it appear in the bottom inside of the bar chart.


proc sgplot data=chart NOAUTOLEGEND ;
hbar binner/ response=bin3 transparency=0.2 nooutline barwidth=1 fillattrs=(color=cxD9D9D9) ;
hbar binner/ response=bin2 transparency=0.2 nooutline barwidth=1 fillattrs=(color=cxBDBDBD) ;
hbar binner/ response=bin1 transparency=0.2 nooutline barwidth=1 fillattrs=(color=cx636363) ;
hbar binner/ response=actual transparency=0.2 nooutline barwidth=.3 fillattrs=(color=black) datalabel=bottom;
refline .71 /lineattrs=(color=red Thickness=4px ) axis=x ;
yaxis display =none;
xaxis display=(nolabel);
run;
Post a Question
Discussion Stats
  • 2 replies
  • 122 views
  • 0 likes
  • 2 in conversation