I am attempting to create a SAS PROC HTTP query of the Census geocoding API for batch geocoding. I have been able to get the test API for a single address, but not the batch file processing example.
* Geocode Single Address;
proc http
url='https://geocoding.geo.census.gov/geocoder/geographies/address?street=1600+Pennsylvania+Ave&city=Wash...'
in=address
out=geocode;
run;
filename address '//queens.org/FILESHARES/csfs10/CORE01/Core/Geocode/PatientAddresses.csv';
filename geocode '//queens.org/FILESHARES/csfs10/CORE01/Core/Geocode/PatientGeocode.json';
* Batch geocode up to 10,000 addresses in CSV file format;
proc http
url='https://geocoding.geo.census.gov/geocoder/geographies/addressbatch'
in=address
out=geocode;
run;
What does the LOG show for the batch attempt?
Did you try a "batch" with just one address before attempting 10,000?
I emailed the Census Geocoding Support Service and received this response:
Hi Jim,
The batch request needs to be sent as multipart/form-data. We aren't sure how to do this in SAS, but hopefully there are examples or documentation you can refer to on how to format the request as multipart/form-data.
------------
The example batch file provided on the website is a comma delimited (.csv) file with no header or trailer records. I'm reviewing the multipart/form-data posts as a possible solution.
If you end up finding the solution independent of responses to your SAS community topic, I for one would appreciate seeing the solution. No harm in marking one's own response as a solution.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.