ods html close; ods html file="output.html"; /* City of Chicago Movies in the Parks data downloaded from: https://data.cityofchicago.org/Events/Chicago-Park-District-Movies-in-the-Parks-2019-Cal/p9gp-ih8p */ /* import the CSF movie data */ proc import datafile="U:\movies\Chicago_Park_District__Movies_in_the_Parks_2019_-_Calendar.csv" out=movies dbms=csv replace; datarow=2; /* start reading the data in the second row */ getnames=yes; /* generate SAS variable names from first row */ guessingrows=20; /* 20 is the default, it works fine for this data */ run; /* add city and state */ data movies; set movies; city="Chicago"; state="IL"; /* add an address with a ZIP code for an example */ if park_address = '6205 N. Sheridan Rd.' then zip=60660; run; /* add the library for PROC GEOCODE lookup data */ libname lookup 'c:\public\tigerdownloads\2018\data'; /* PROC GEOCODE to find latitude and longitudes */ proc geocode method=street /* street geocoding used here */ /* lookup data sets */ lookupstreet=lookup.usm /* converted TIGER lookup data set */ lookupcity=sashelp.zipcode /* set this if you do not have SAS GRAPH */ /* input data and variables */ data=movies /* input data set */ addressvar=park_address /* set this if "address" is not the variable name */ /* addresscityvar= set this if "city" is not the variable name */ /* addressstatevar= set this if "state" is not the variable name */ /* addresszipvar= set this if "zip" is not the variable name */ /* include variables from the lookup.uss data in your output */ attributevar=(side) /* include the side of the street in your output */ out=geocoded; /* output data set */ run; /* sort the data for printing */ proc sort data=geocoded; by _matched_; run; title 'Sample of Geocoded Addresses'; footnote1 'City Match used 130st Street instead of 130th Street'; footnote2 '6205 N Sheridan Rd had higher score becasue it had a ZIP code'; proc print noobs data=geocoded(obs=10); var park_address zip m_addr _matched_ _notes_ _score_ side M_zip; run; /* limit data to G-rated movies */ data geocoded2; set geocoded; where rating='G'; run; /* use PROC SGMAP to plot the movie locations */ /* set the Esri map URL and run PROC SGMAP */ %let url = http://services.arcgisonline.com/arcgis/rest/services; title1 'Locations of Outdoor G-rated Movies in Chicago'; footnote; proc sgmap plotdata=geocoded2; esrimap url="&url/World_Topo_Map"; scatter x=x y=y / group=title markerattrs=(symbol=circlefilled size=15); run; /* print the movie information */ title 'Date, Title and Address of Outdoor Movies'; proc print noobs data=geocoded2; var date title m_addr m_zip; run; quit; ods html close;