Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is there a way to extract from a variable about zip-code the cities corresponding?

    Hi everyone,

    I have a variable called "zip_code" for each zip code located on Spain.
    I just want to know if there is some special command to retrieve the right places of these zip codes, and put them automatically on a new variable (e.g. "zip_code2"), and have written the names of the places.

    For example, zip_code==46725 and zip_code2 is the corresponding municipality, in this case : "Municipio de Alfauir - Provincia de Valencia".

    Thank you very much for your help.

    Michael

  • #2
    Stata doesn't know anything about zip codes. To Stata, they're just numbers. But, although I have never looked for this in Spain, I am confident that somewhere on the internet there are websites that have downloadable tables that give the correspondence between the zip codes and their locations. You can find such a table and import it to a Stata data set. Then you can -merge- that with the data you have been working with. I do things like this often with zip codes in the United States. It would astonish me if their is no equivalent table for Spanish zip codes.

    Comment


    • #3
      Originally posted by Clyde Schechter View Post
      I am confident that somewhere on the internet there are websites that have downloadable tables that give the correspondence between the zip codes and their locations. .... I do things like this often with zip codes in the United States.
      According to at least one source (https://www.unitedstateszipcodes.org/) "Some ZIP codes will span multiple states in order to make mail routing and delivery more efficient." and according to another source (https://gis.stackexchange.com/questi...-than-one-city) their list is known. There may be more complications in other countries, but roughly, the zip codes are informative and meaningful for the postal mail service, not to an economist. There may be additional information not mentioned yet, (such as restriction that the zip-code is identifying a residential address, etc) that makes the analysis viable in a particular case, but generically, be very cautious in making such reverse inferences.

      Another word of caution, if you are trying to identify the persons from their known zip-codes, beware. At least in California, USA the Supreme Court has ruled that the zip-code is protected personal information (https://www.balough.com/zip-code-is-...l-information/ or https://www.crowell.com/en/insights/...california-law) so you may want to check all the appropriate clearances before proceeding (in Europe GDPR prevails, and while zip-code alone afaik is not considered protected, a zip-code plus city is, and this is exactly what you are trying to do if I am reading correctly).

      Best, Sergiy Radyakin

      Comment


      • #4
        Hi Clyde Schechter, Hi Sergiy Radyakin:

        Thank you so much for your advices.
        Have a nice day.

        Best,
        Michael

        Comment

        Working...
        X