Hello!
I have a data set with Street, City, State, and ZipCode but some of the data only contain City and State and are missing ZipCode.
I know that the SASHELP.ZIPCODE library contains ZipCode data for City and States.
How would I be able to:
Take the instances that are missing ZipCode --> Take State and City that are present --> Compare to the SASHELP.ZIPCODE library and then --> Return the ZipCode value stored in SASHELP.ZIPCODE library if the City and State values match the StateCode and (City or Alias_CityN)
Really lost and any guidance is appreciated!
@orangekitty wrote:
Hello!
I have a data set with Street, City, State, and ZipCode but some of the data only contain City and State and are missing ZipCode.
I know that the SASHELP.ZIPCODE library contains ZipCode data for City and States.
How would I be able to:
Take the instances that are missing ZipCode --> Take State and City that are present --> Compare to the SASHELP.ZIPCODE library and then --> Return the ZipCode value stored in SASHELP.ZIPCODE library if the City and State values match the StateCode and (City or Alias_CityN)
Really lost and any guidance is appreciated!
Most cities with population over 10,000 or so are likely to have more than one Zip code. So, are you willing to accept any Zip code in the city?
Also some very small towns may not have their own Zip code but receive mail in a nearby town and so may not be in the Zip code data set.
For your consideration, you may have some spelling issues for matching values of names as well. If you have names with apostrophes the apostrophe may not be present in the Zip code set. Some common abbreviations may need to be expanded if in your data such as St. Louis would require "Saint Louis" for matching the SAS data.
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.