BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
gbortolami
Calcite | Level 5

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!

GiovanniCapture_SAS.PNG

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
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;

Ksharp_0-1705559560939.png

 

View solution in original post

3 REPLIES 3
ballardw
Super User

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.

Ksharp
Super User
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;

Ksharp_0-1705559560939.png

 

gbortolami
Calcite | Level 5
Thanks a lot!!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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
  • 3 replies
  • 356 views
  • 1 like
  • 3 in conversation