There are some zip codes which have alphabets in them as shown below.I need to display only 08854 as the correct record.regular expressions does this job, but I figure the syntax.
00NSW
W85LJ
08854
DATA HAVE;
INPUT ZIPCODE $;
IF ANYALPHA(ZIPCODE) THEN DELETE;
CARDS;
00NSW
W85LJ
08854
;
Regards,
Haikuo
Are the data by any chance multinational and you are getting other system postal codes? If so you may want to modifiy Haikuo's suggestion to output the data to two different datasets.
You can also use the sashelp.zipcode table to determine if any particular ZIP code is valid. That data are updated every few months, so you may need to download the current one from sas.com.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.