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.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
  • 2393 views
  • 0 likes
  • 2 in conversation