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;
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.
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.
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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.