I added one dataline to show a matching case:
data a;
length gender $1 name $20 birthday 8 status $1 line $100;
format birthday yymmdd10.;
if not prxId then prxId + prxParse("@([MF])(\d{1,2}/\d{1,2}/\d{1,2})(\D+)(\w)@");
input line;
if prxMatch(prxId, line) then do;
gender = prxPosn(prxId, 1, line);
birthday = input(prxPosn(prxId, 2, line), mmddyy8.);
name = prxPosn(prxId, 3, line);
status = prxPosn(prxId, 4, line);
output;
end;
drop line prxId;
datalines;
M10/21/46CADYA
F11/11/50CLINEB
M11/11/52SMITHA
F10/10/80OPPENHEIMERB
M04/04/60JOSEA
F11/11/52SMITHA
;
data b;
length gender $1 name $20 birthday 8 weight 8 line $100;
format birthday yymmdd10.;
if not prxId then prxId + prxParse("@([MF])(\d{1,2}/\d{1,2}/\d{1,2})(\D+)(\d+)@");
input line;
if prxMatch(prxId, line) then do;
gender = prxPosn(prxId, 1, line);
birthday = input(prxPosn(prxId, 2, line), mmddyy8.);
name = prxPosn(prxId, 3, line);
weight = input(prxPosn(prxId, 4, line), best.);
output;
end;
drop line prxId;
datalines;
M10/21/46CODY155
F11/11/50CLEIN166
F11/11/52SMITH185
F10/10/80OPPENHAIMER199
M02/07/60JOSA173
;
proc sql;
create table ab as
select a.*, b.weight
from a natural join b;
select * from ab;
quit;
... View more