BookmarkSubscribeRSS Feed
tc
Lapis Lazuli | Level 10 tc
Lapis Lazuli | Level 10

 Are You Ready For Some Football?Are You Ready For Some Football?

 

After checking out the How Do I Show Geographical Data Using the SGMAP Procedure? on-demand seminar from @DanH_sas, how could I not try to create a map of the 25 biggest college football stadiums in the country? Btw, documentation shows there are LOTS more useful SGMAP BUBBLE statement options once I get access to SAS Viya 3.5, Post-9.4M6.

 

*  Fun With SAS ODS Graphics: The 25 Largest College Football Stadiums
   Data source: ncaa.com/news/football/article/2018-07-30/25-biggest-college-football-stadiums-country;
   
FILENAME stadiums url 'https://docs.google.com/spreadsheets/d/1WGsCQQog2VBiobj9eCnUa_bQO9sGTH11VEq13-MNNNk/export?format=csv&gid=0';
proc import datafile=stadiums out=stadiums DBMS=CSV REPLACE; GETNAMES=Yes; DATAROW=2; * Grab geocoded point data from Google Sheets;

data stadiums2; * Nudge Rank+Sachool (Rank+School) a bit to avoid collisions (Top/Middle/Bottom, Left/Center/Right); 
set stadiums;
select (school);
  when ('San Diego State', 'Auburn', 'Michigan', 'South Carolina', 'Florida') schoolR=' '||catx(' ',rank,school); 
  when ('Southern Cal.', 'San Diego Stat', 'Texas', 'Alabama') schoolL=catx(' ',rank,school);
  when ('Georgia') schoolTL=catx(' ',rank,school);
  when ('Notre Damex') schoolBL=catx(' ',rank,school);
  when ('Ohio State', 'Notre Dame') schoolB=catx(' ',rank,school);
  when ('Clemson','UAB','Penn State') schoolTR=catx(' ',rank,school);
  otherwise schoolT=catx(' ',rank,school);
end;

data heading; * Provide a report heading near NW coast;
longitude=-110.0000; latitude=44.1; heading='25 Largest College Football Stadiums';

data chartdata; * Merge point data + heading;
set stadiums2 heading;

ods graphics / reset height=6.25in width=11in antialias;
proc sgmap plotdata=chartdata noautolegend; * Chart data; 
esrimap url='http://services.arcgisonline.com/arcgis/rest/services/Canvas/World_Light_Gray_Base';
bubble x=longitude y=latitude size=capacity / datalabel=schoolT  datalabelattrs=(size=8pt color=navy) datalabelpos=top; * Stadium points;
bubble x=longitude y=latitude size=capacity / datalabel=schoolR  datalabelattrs=(size=8pt color=navy) datalabelpos=right;
bubble x=longitude y=latitude size=capacity / datalabel=schoolL  datalabelattrs=(size=8pt color=navy) datalabelpos=left;
bubble x=longitude y=latitude size=capacity / datalabel=schoolTR datalabelattrs=(size=8pt color=navy) datalabelpos=topright;
bubble x=longitude y=latitude size=capacity / datalabel=schoolTL datalabelattrs=(size=8pt color=navy) datalabelpos=topleft;
bubble x=longitude y=latitude size=capacity / datalabel=schoolBL datalabelattrs=(size=8pt color=navy) datalabelpos=bottomleft;
bubble x=longitude y=latitude size=capacity / datalabel=schoolB  datalabelattrs=(size=8pt color=navy) datalabelpos=bottom;
scatter x=longitude y=latitude / datalabel=heading datalabelattrs=(size=18pt color=navy) markerattrs=(size=0); * Heading; 
run;

Sample Data (Full Data at Google Sheets)

Sample DataSample Data

1 REPLY 1
Rick_SAS
SAS Super FREQ

I think you don't need separate variables for the labels, nor separate BUBBLE statements. You can put all labels in one variable:

data Have;
length Label $10;
input x y size Label;
datalines;
0 0 102 Texas
0 3  86 Oklahoma
0 5  85 Nebraska
1 0 102 LSU
1 6  69 Iowa
2 8  80 Wisconson
3 2 101 Alabama
;

proc sgplot data=Have; 
bubble x=x y=y size=size / datalabel=Label  datalabelattrs=(size=8pt color=navy) datalabelpos=top;
run;

SAS INNOVATE 2024

Innovate_SAS_Blue.png

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. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 594 views
  • 4 likes
  • 2 in conversation