Hello SAS users,
I'm trying to change the colour of this bubble plot to have different colors for different sizes and add a label.
This is my code for the plot:
proc sgmap plotdata=belluno2; openstreetmap; where lon > 10.435428 and lat > 44.847916 and lat < 46.731138; bubble x=lon y=lat size=f /group=source bradiusmin=0.2 fillattrs=(transparency=.4); keylegend; run;
And this is the output:
My goal is to replicate/have something similar to the graph here below (made with R), where the color gets lighter when the frequency gets bigger and a label where i can see the size of the bubble beside the frequency.
Is it possible?
Thank you a lot!
Changing color with the value of a response variable is amazingly enough COLORESPONSE coupled with COLORMODEL
There is an example here: https://support.sas.com/kb/68/115.html
that shows using a continuous bar with the meaning of the response color
Since you apparently want a darker color associated with the smaller value of your response variable then you might want
colormodel=(darkblue lightblue)
I would recommend the GRADLEGEND (gradient legend) as it shows a continuous value so people can interpret color shades a bit more accurately than discrete bubbles
Changing color with the value of a response variable is amazingly enough COLORESPONSE coupled with COLORMODEL
There is an example here: https://support.sas.com/kb/68/115.html
that shows using a continuous bar with the meaning of the response color
Since you apparently want a darker color associated with the smaller value of your response variable then you might want
colormodel=(darkblue lightblue)
I would recommend the GRADLEGEND (gradient legend) as it shows a continuous value so people can interpret color shades a bit more accurately than discrete bubbles
When I enter the code for colorresponse and colormodel, the following error apperars:
Syntax error, expecting one of the following: ;, BRADIUSMAX, BRADIUSMIN, CM, DATALABEL, DATALABELATTRS,
DATALABELPOS, FILL, FILLATTRS, GROUP, IN, LEGENDLABEL, MM, NAME, NOFILL, NOMISSINGGROUP, OUTLINE, PCT, PT, PX,
TRANSPARENCY.
I'm using SAS 9.4M6 release, is there anything I can try for this release?
ANY time that you have a question about an error please copy the code and all the warnings, notes, errors and messages from the log for the step with the error. On the forum open a text box using the </> icon above the message window and paste the text. The entire procedure or data step, not just the line that causes the error.
The text box is important because frequently SAS provides diagnostic characters indicating where the problem was detected and the main message windows in the forum software will reformat pasted text reducing the usefulness of the diagnostics. The entire procedure or data step because the cause might be a missing ; on a previous statement, missing a ( or ) or similar elsewhere in the code.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.