BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. 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 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1114 views
  • 4 likes
  • 2 in conversation