Probably the key is, to find the position of the first digit/non-character. Perl-functions should be useful. This program probably needs some house-keeping, but in principle should work: Data Have; Input Address_Line_2 $50.; Datalines; MADISON WI 53714-1006 SUN PRAIRIE WI 53590-2585 MADISON WI 53716-2125 ; Run; Data Want; Set Have; Pos_of_first_digit=PRXMatch("/\d/",Address_line_2); Zip=Substr(Address_line_2,Pos_of_first_digit); * find Position of zip; State=(Substr(Address_line_2,Pos_of_first_digit-3,2)); * assumption: state is 2 characters long; Address_line_2=Substr(Address_line_2,1,Pos_of_first_digit-4); * drop zip and state; Run;
... View more