BookmarkSubscribeRSS Feed
jss539
Fluorite | Level 6

Hello,

 

I have a property-year level dataset that I am trying to create a bubble map with.  I want a bubble for each city (not picky with this to be city, just figured it'd look the neatest), and I want the bubble size to be how many properties are in that city (not property-years, just properties).  I have geocoded the data from addresses to give me coordinates, as well as city, state, and zip code.  

 

Here is a small sample of my data:

data have;
	informat ID 1. year 4. city $20. state $2. x 3.15 y 3.15 ;
	input ID year city state x y;
cards;
1 2000 Chicago IL -87.621871 41.899244
1 2001 Chicago IL -87.621871 41.899244
1 2004 Chicago IL -87.621871 41.899244
2 2002 Chicago IL -87.6233945 41.888304319
2 2008 Chicago IL -87.6233945 41.888304319
3 2005 Austin TX -94.27806133 30.89219138
3 2006 Austin TX -94.27806133 30.89219138
4 2006 Austin TX -95.34376564 30.896487545
5 2008 Charlotte NC -80.75357998 35.303729755
5 2010 Charlotte NC -80.75357998 35.303729755
;

Thanks for the help! 

 

3 REPLIES 3
Ksharp
Super User

Here is Robert Allison 's paper . Check Attachment .

GraphGuy
Meteorite | Level 14

You might get more responses on the "Graphics Programming" forum, than the "SAS Programming" one (although this question has a bit of both ...)

 

One way to do what you're basically asking is to pre-summarize your data, and then use Proc SGmap's "bubble" capability (and if you use SGmap, you'll want to be using the latest version of SAS, to get the latest functionality of this recently-added proc).

 

Here's some code that should be a good starting place:

 

proc sql noprint;
create table summarized as
select unique id, city, x, y, count(*) as count
from have
group by id, city, x, y;
quit; run;

 

proc sgmap plotdata=summarized;
openstreetmap;
bubble x=x y=y size=count /
fillattrs=(color=dodgerblue)
datalabel=city datalabelpos=top
datalabelattrs=(color=red size=10pt weight=bold)
legendlabel='Bubble size represents number of properties';
run;

 

bubblemap.png

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
  • 3 replies
  • 866 views
  • 0 likes
  • 3 in conversation