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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 6 replies
  • 677 views
  • 6 likes
  • 3 in conversation