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

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;


PIX.jpg
1 ACCEPTED SOLUTION

Accepted Solutions
Jay54
Meteorite | Level 14

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

2 REPLIES 2
Jay54
Meteorite | Level 14

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.

LB
Quartz | Level 8 LB
Quartz | Level 8

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  

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

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