Extract Zip code from address field
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | * Extract zip codes from address (zip is in last 5 non-blank characters of the field). * rlevesque@videotron.ca. DATA LIST LIST /adress(A50). BEGIN DATA "Bob Smith, farmer NY 56215 " "John Allen, Esq NC 12345" "John Allen, Esq NC 12A45" END DATA. * invalid code (containing non numeric characters appear as missing. Compute zip=NUMBER(SUBSTR(RTRIM(adress),LENGTH(RTRIM(adress))-4),F5.0). FORMATS zip(F8.0). Execute. |
Related pages
...