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

Can We able to fill the Marker symbols with data values in the scatter graph like in the  first image? any suggestions. Thank you.

SASuserlot_1-1640031237838.png

SASuserlot_2-1640031294880.png

 

 

PS: Example provided is sashelp.class dataset, there is a overlapping of data points. For our study specific graph there is no overlapping issue.

proc template;
	define statgraph xx;
		begingraph/BORDER=off;
		  layout lattice / ;
		 layout overlay /xaxisopts=(label=' ' linearopts =(tickvaluelist=(10 11 12 13 14 15 16 ) viewmin=10 viewmax=17 TICKVALUEFITPOLICY=THIN))
		    yaxisopts = (linearopts =(tickvaluelist=(50 55 60 65 70 ) viewmin=50 viewmax=70));
		    scatterplot x=age y=height  / 
		         markerattrs = (symbol=diamond size=20 color=maroon);
		       			
		    referenceline x=13;
		   annotate;
  		endlayout;
endlayout;
endgraph;
end;
run;

ods graphics on/ width= 9in height= 5.6in border=off   ;
ods html;
ods listing close; 
proc sgrender data=class template="xx";
run; 
ods _all_ close;
ods graphics off;

 

1 ACCEPTED SOLUTION
6 REPLIES 6
Reeza
Super User

Probably, but not sure there's an automated way to separate the overlaps easily.

I would try just plotting the labels first and seeing how that looked. 

 

Here's the steps you'd need to do: 

 

  1. Make sure the symbol is big enough to hold a font size that's legible for you.
  2. Think about overlaps and how you want to deal with them (likely manual jittering will be required)
  3. Use a TEXT statement or datalabel statement to plot your labels, you may need to tweak your X/Y position to get them centered. 

 

SASuserlot
Barite | Level 11

Thank you @Reeza for your  response .

Please read my comments for you Reponses.

1. Yes I will make sure of the symbol size,  Mostly my data points are single digits so there will be no issue with the size.

2. There is no overlapping issue in my data points. 

3. Tried Data label option however it always displaying the values (labels) outside of the symbol. I am not sure  what you mean by tweaking. You expecting to create two graphs and overlap the labels with marker symbols?

 

Reeza
Super User
Try the TEXT option instead. Datalabels are designed to be beside the symbol, whereas a TEXT statement lets you specify the coordinates.
SASuserlot
Barite | Level 11

Thank you @Jay54 . It worked for me. 

Thank you @Reeza  for your valuable suggestions.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 6 replies
  • 1114 views
  • 6 likes
  • 3 in conversation