data have;
infile datalines dlm=",";
length country zip format $20;
input country $ zip $;
retain Rx;
if _N_=1 then Rx=rxparse("$U to A,$D to N");
format= rxchange(rx, 1000, zip);
drop Rx;
cards;
Canada,A6C 2X8
Canada,A6C-2X8
France,31360
Switzerland,123
United States,55344
United States,TW18 4BQ
;run;
data codes;
infile cards dlm=",";
input country : $20. code : $20. ;
cards;
Canada,ANA NAN
France,NNNNN
Switzerland,NNNN
United States,NNNNN
;
run;
data want;
merge have codes;
by country;
if trim(format)= trim(code) then Improper_Flag='N';
else Improper_Flag='Y';
run;
... View more