Announcement

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

  • From ZIPcode+4 to ZIP

    Goodmorning,

    I am working with a database that contains the number of crimes in neighborhoods from different cities in the USA.
    I have geocoded each crime and I retrieved the ZIPcode for each observation. However, some obs have the ZIP+4 while others (the majority) only have the 5 digit ZIP. How can I delete the +4 part (-####) from the observation containing it in order to have only the 5 digit ZIP code for each obs?
    Thank you very much,
    ac

    Click image for larger version

Name:	dta.JPG
Views:	1
Size:	225.4 KB
ID:	1613919

  • #2
    Code:
    gen g_postcode5=substr(g_postcode,1,5)

    Comment


    • #3
      Thank you very much, you have been really helpful

      Comment

      Working...
      X