Data visualization with SAS programming

vbarparm datalabels

Accepted Solution Solved
Reply
Frequent Contributor
Frequent Contributor
Posts: 133
Accepted Solution

vbarparm datalabels

So I have the code below- 

Essentially I am attempting to use a datalabel for vbarparm that essentially uses a character value that combines a percentage/n

value such as (85%/n=5) -however the values do not render unlike in the scatter that does work.  Graph is attached that demonstrates

 

Code is below- Any suggestions appreciated- 

Lawrence 

 

proc sgplot data=max_mobility;
vbarparm category=specific_day response=TOTS/ group=keylegnd grouporder=ascending dataskin=pressed SEGLABEL
groupdisplay=stack DATALABEL=dt_label SPLITCHAR="/" datalabelpos=data seglabelfitpolicy=none 


scatter x=specific_day y=pct_mob_dis /
markerattrs=graphdata1(size=40 symbol=circlefilled )
filledoutlinedmarkers markeroutlineattrs=(thickness=0)
markerfillattrs=graphdata4 dataskin=pressed datalabel=dtot_label SPLITCHAR="\" datalabelpos=center legendlabel='Percent Mobilized';
keylegend / location=outside position=right title='Mobility Scale' ;
YAXIS LABEL = "Distribution of maximum activity levels (%)" TICKVALUEFORMAT=percent10. ;
XAXIS LABEL = "DATE" ;

run;

Attachment

Accepted Solutions
Solution
‎05-25-2017 05:15 PM
SAS Super FREQ
Posts: 1,061

Re: vbarparm datalabels

If the VBARPARM has groups (default stacked), then data label option does not work.  This was due to the need to show only one label at the top of the bar.  GROPY=CLUSTER would work.  However, this issue will be fixed for SAS 9.40M5.  We will still show only one label at the top, but it will be the one of the labels from the segment, most likely the first.  So, you must have the same value for all the segments of the bar to get reliable results.

 

While you can still display a label using TEXT plot, you have to compute the y coordinate of the stack.  The fix at V9.4M5 will avoid that need.  In your graph using SCATTER to display the value, you can set YAXIS offsetmin=0 to make the bars sit on the x-axis.

View solution in original post


All Replies
Solution
‎05-25-2017 05:15 PM
SAS Super FREQ
Posts: 1,061

Re: vbarparm datalabels

If the VBARPARM has groups (default stacked), then data label option does not work.  This was due to the need to show only one label at the top of the bar.  GROPY=CLUSTER would work.  However, this issue will be fixed for SAS 9.40M5.  We will still show only one label at the top, but it will be the one of the labels from the segment, most likely the first.  So, you must have the same value for all the segments of the bar to get reliable results.

 

While you can still display a label using TEXT plot, you have to compute the y coordinate of the stack.  The fix at V9.4M5 will avoid that need.  In your graph using SCATTER to display the value, you can set YAXIS offsetmin=0 to make the bars sit on the x-axis.

Frequent Contributor
Frequent Contributor
Posts: 133

Re: vbarparm datalabels

Thanks Sanjay-

So if it is not feasible to do so now then the client is willing to accept a table below. 

I know you can use the datalabelpos to create a table below except it does not render in the same order as the group order- 

How I can match it? 

 

vbarparm category=specific_day response=TOTS/ group=keylegnd grouporder=ascending dataskin=pressed SEGLABEL
groupdisplay=stack DATALABEL=dt_label SPLITCHAR="/" datalabelpos=data seglabelfitpolicy=none /*SEGLABELFORMAT=percent10.*/;

 

Thanks again.

 

Lawrence  

☑ This topic is SOLVED.

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

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