Geocoding addresses is fairly straightforward thing to do with many programming languages and service, but most (if not all) require an internet connection. I work in a highly-secure research data center and what I am looking for is a geocoding option that can be performed without an internet connection. I haven't been able to find a definitive answer to this yet. Is this possible with PROC GEOCODE?
Once you download the address data from maps online (http://support.sas.com/rnd/datavisualization/mapsonline/index.html), no internet connection is needed to use PROC GEOCODE.
Thanks for the prompt answer! Will the GEOCODE work with user proved datasets? (e.g. TIGER/Line shapefiles?) I will have no internet connection whatsoever and bringing external data into the data center where I do research is quite a process.
GEOCODE takes address data, as text, not SHP files.
The other G procedures, GINSIDE, GMAP and SGMAP will work with SHP files. Not sure about TIGER/Line as I've never worked with those.
I ran a RDC type lab and it was fine with GEOCODE. Make sure you do download the supporting files required though ahead of time and verify the version of SAS, I find the labs are usually a few versions behind :(.
@jGaboardi wrote:
Thanks for the prompt answer! Will the GEOCODE work with user proved datasets? (e.g. TIGER/Line shapefiles?) I will have no internet connection whatsoever and bringing external data into the data center where I do research is quite a process.
Reeza mentioned "The other G procedures, GINSIDE, GMAP and SGMAP will work with SHP files."
That might need a little clarification. In order to use SHP files (Shapefiles) with these procedures, I believe you first have to use Proc Mapimport to import the Shapefiles into SAS datasets (I don't think these procedures can work with the Shapefiles directly). But this isn't important for your proc Geocode question. 🙂
Proc Geocode will support custom look up data sets, the option on the Proc Geocode statement is LOOKUP= <dataset name>.
Please read the entire documentation for the Proc Geocode statement. There are nearly 20options used to tell which variables in the look up data set are used for which purpose. Note that you can also use a data set that contains IPv4 internet addresses for look up. The fun part is building the appropriate data.
It has been awhile since I looked but the US Census website actually used to have SAS code for using TIGER files.
The fun part is building the appropriate data.
The "fun" part. LOL. This has been the bane of my existence (and my bread and butter) for many years now.
@jGaboardi wrote:
The fun part is building the appropriate data.
The "fun" part. LOL. This has been the bane of my existence (and my bread and butter) for many years now.
The 'fun' part is likely why we all have jobs 🙂
You don't need an Internet connection to run Proc Geocode ... but you do need "lookup data" dataset(s) that your SAS session can get to.
If city-level or zipcode-level geocoding is good enough for your purposes, then you can use the sashelp.zipcode dataset (which we ship with SAS) as your lookup dataset. Below are 2 examples.
If you want to do street-level geocoding, for US addresses, then you'll need to download the (large) street-level lookup data that Dan pointed you to in a previous comment.
data my_data1;
city='Cary'; state='NC';
run;
proc geocode data=my_data1 out=my_data1 lookup=sashelp.zipcode method=CITY;
run;
proc print data=my_data1;
run;
data my_data2;
city='Cary'; state='NC'; zip=27513;
run;
proc geocode data=my_data2 out=my_data2 lookup=sashelp.zipcode method=ZIP;
run;
proc print data=my_data2;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.