Dear all,
I am using sgplot in sas studio for academics.
Building a very simple scatter plot (Variable 1 vs Variable 2), I am using a third variable as colorresponse.
The results is showing me the color legend for Variable 3 with a discrete tick interval excluding the highest and lowest values (see screenshot attached).
I would like to modify the tick interval in the legend in order to have the lowest (0) and the highest (0.32) values indicated, any tips?
Thanks a lot!
Giovanni
data rattrmap;
retain id "id";
length min $ 5 max $ 5;
input min $ max $ ALTCOLORMODEL1 $ ALTCOLORMODEL2 $ ;
datalines;
0 0.1 white greyaa
0.1 0.2 greyaa grey99
0.2 0.3 grey99 grey88
0.3 1 grey88 black
;
run;
data have;
call streaminit(123);
do i=1 to 100;
x=rand('integer',0,90);
y=rand('integer',-30,80);
r=rand('uniform');
output;
end;
run;
proc sgplot data=have rattrmap=rattrmap;
scatter x=x y=y /markerattrs=(symbol=circlefilled) colormodel=(white black) colorresponse=r rattrid=id ;
run;
When asking how to modify any existing procedure you should include the current code you are using so we have some idea what you have attempted. Best is also to include some example data in the form of a working data step so we can test suggestions to see that they will actually work. Code should be pasted as text into text or code box opened on the forum with the </> or "running man" icons that appear above the main message windows. The main message boxes on this forum will reformat pasted text and may result in code that doesn't run properly when copied and run elsewhere.
data rattrmap;
retain id "id";
length min $ 5 max $ 5;
input min $ max $ ALTCOLORMODEL1 $ ALTCOLORMODEL2 $ ;
datalines;
0 0.1 white greyaa
0.1 0.2 greyaa grey99
0.2 0.3 grey99 grey88
0.3 1 grey88 black
;
run;
data have;
call streaminit(123);
do i=1 to 100;
x=rand('integer',0,90);
y=rand('integer',-30,80);
r=rand('uniform');
output;
end;
run;
proc sgplot data=have rattrmap=rattrmap;
scatter x=x y=y /markerattrs=(symbol=circlefilled) colormodel=(white black) colorresponse=r rattrid=id ;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.