BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
SASuserlot
Barite | Level 11

I am creating the data labels on the forest plot. However My data labels overlapping with the Error bars. How I can Avoid this. I tried using DATALABELPOSITION But no luck. I thought of Creating Blank space before dataset ( data point values). However it won't change it dynamically , if any values changes in future. Can you please suggest the Options.

Example: How the labels should look!

SASuserlot_0-1639752873273.png

How My labels are displaying

SASuserlot_1-1639752973883.png

layout overlay /xaxisopts=(label=' ' linearopts =(tickvaluelist=(-2 0 2) viewmin=-2 viewmax=2))
	/*type=discrete discreteopts =(  tickvaluelist=( '-0.5' '0' '0.5' '1' '2')))*/
		    y2axisopts = (display=none);
		    scatterplot x=OR y=ORCI / 
			markerattrs = (symbol=diamondfilled size=0 color=white) yaxis=y2;
		    scatterplot x=OR y=ORCI  / datalabel = OR datalabelattrs = (size=7) datalabelposition=right 
		         markerattrs = (symbol=diamondfilled size=10 color=darkgrey)
		          yaxis=y2
		           xerrorlower = lcl xerrorupper = ucl errorbarcapshape = none;
		   referenceline x=0;
		   annotate;

  		endlayout;

 

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

Instead using the error bar on the SCATTERPLOT statement, use a HIGHLOWPLOT plot. Set the LOWCAP=NONE and HIGHCAP=none, and set the HIGHLABEL to be the same variable as the DATALABEL. The change should look something like the following:

 

layout overlay /xaxisopts=(label=' ' linearopts =(tickvaluelist=(-2 0 2) viewmin=-2 viewmax=2))
	/*type=discrete discreteopts =(  tickvaluelist=( '-0.5' '0' '0.5' '1' '2')))*/
		    y2axisopts = (display=none);
		    scatterplot x=OR y=ORCI / markerattrs = (symbol=diamondfilled size=0 color=white) yaxis=y2;
            highlowplot y=ORCI low=lcl high=ucl / lowcap=none highcap=none highlabel=OR labelattrs=(size=7) 
lineattrs=(color=darkgrey) yaxis=y2; scatterplot x=OR y=ORCI / markerattrs = (symbol=diamondfilled size=10 color=darkgrey) yaxis=y2; referenceline x=0; annotate; endlayout;

Hope this helps!

Dan

View solution in original post

2 REPLIES 2
DanH_sas
SAS Super FREQ

Instead using the error bar on the SCATTERPLOT statement, use a HIGHLOWPLOT plot. Set the LOWCAP=NONE and HIGHCAP=none, and set the HIGHLABEL to be the same variable as the DATALABEL. The change should look something like the following:

 

layout overlay /xaxisopts=(label=' ' linearopts =(tickvaluelist=(-2 0 2) viewmin=-2 viewmax=2))
	/*type=discrete discreteopts =(  tickvaluelist=( '-0.5' '0' '0.5' '1' '2')))*/
		    y2axisopts = (display=none);
		    scatterplot x=OR y=ORCI / markerattrs = (symbol=diamondfilled size=0 color=white) yaxis=y2;
            highlowplot y=ORCI low=lcl high=ucl / lowcap=none highcap=none highlabel=OR labelattrs=(size=7) 
lineattrs=(color=darkgrey) yaxis=y2; scatterplot x=OR y=ORCI / markerattrs = (symbol=diamondfilled size=10 color=darkgrey) yaxis=y2; referenceline x=0; annotate; endlayout;

Hope this helps!

Dan

SASuserlot
Barite | Level 11

Perfect. It worked. Thanks Dan.😍

SASuserlot_0-1639762605211.png

 

sas-innovate-2024.png

📢

ANNOUNCEMENT

The early bird rate has been extended! Register by March 18 for just $695 - $100 off the standard rate.

 

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 

 

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
  • 751 views
  • 4 likes
  • 2 in conversation