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

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