Hello,
I'm trying to see if I can geocode an address file and get back Fips State, Fips County, Tract, Block, Place, MSA, CBSA, etc.
The code below only returns Y, X, Block, Tract, M_ADDR, M_CITY, M_STATE, M_ZIP, M_OBS, _MATCHED_, _STATUS_, _NOTES_, _SCORE_ and then my columns, ID, RAW_ADDRESS, RAW_CITY, RAW_STATE, RAW_ZIP. I'm not sure how to get the FIPS variables, Place, MSA, CBSA.
proc geocode
method = street
addressvar = RAW_ADDR
addresscityvar = RAW_CITY
addresszipvar = RAW_ZIP
addressstatevar = RAW_ST
data = temp
out = temp_out
attribute_var = (BLOCK, TRACT)
lookupstreet = geodata.USM
;
run ;
Thank you
I'm not sure which interpretation of "place" you are using.
You can join your data with SASHELP.ZIPCODE to get state FIP, County FIP and MSA.
proc sql;
create table want as
select a.*, b.state, b.county, b.msa
from have as a left join SASHELP.ZIPCODE as b
on a.zipcode=b.zip;
quit;
Note that the Zip in SASHELP.ZIPCODE is numeric. There are a few city name variables that might correspond to your place.
You may need to find another dataset with CBSA to perform a similar merge.
I'm not sure which interpretation of "place" you are using.
You can join your data with SASHELP.ZIPCODE to get state FIP, County FIP and MSA.
proc sql;
create table want as
select a.*, b.state, b.county, b.msa
from have as a left join SASHELP.ZIPCODE as b
on a.zipcode=b.zip;
quit;
Note that the Zip in SASHELP.ZIPCODE is numeric. There are a few city name variables that might correspond to your place.
You may need to find another dataset with CBSA to perform a similar merge.
Hi ballardw,
Thank you so much for you help. That did get me those 3 variables I needed. The place is the FIPS Place and the CBSA are the other 2 I need. I will look to see if SAS offers a file that will contain those 2 variables.
Thank you again for your help.
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 the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.