symbol1 pointlabel = ("#N" h=.5 font=simplex nodropcollisions) value=none;
N is a number of cases. I'd like to see that number as label in a scatterplot, instead of a dot.
proc gplot data=have; plot X * Y = 1; /* Surmised that "= 1" means symbol1 */ run; quit;
Unfortunately N shows in the plot having many decimal places, all 0.
I figured using int() would do the trick, to just show N alone, no superfluous unwanted decimal places.
I tried several ways, but none seem to work. One approach that does not work is:
Another possibility would be to create an ad-hoc variable, N2, that is int(N), and then to use N2 instead of N in the pointlabel. But I'm not sure how to code such.
Any help toward a solution greatly appreciated.
Would you be willing to use PROC SGPLOT instead? If so, you can use the MARKERCHAR= option to specify a variable name. Instead of markers, the value of that variable is plotted. You can controls the size and color of the text by using the MARKERCHARATTRS= option:
data Have; input x y N; datalines; 1 2 37 3 1 23 5 2 16 4 1 2 5 4 1 3 3 18 ; proc sgplot data=Have; scatter x=x y=y / markerchar=N markercharattrs=(size=14); run;
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.
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.