Please try the below code
data have;
input col1:$ col2$ col3:&$100.;
cards;
P 1095 SMITH, HOWARD
C 01-08-11 $45.0
C 01-17-11 $37.5
P 1096 BARCLAY, NICK
C 01-09-11 $150.5
P 1097 REISCH, DEBORAH
C 01-02-11 $109.0
C 03-02-11 $100.0
P 1099 WILSON, ERNEST
C 01-03-11 $45.0
C 01-05-11 $45.0
;
data want;
set have;
retain name id;
if col1='P' then do;
name=col3;
id=col2;
end;
else if col1='C' then do;
date=input(col2,mmddyy10.);
sale=col3;
end;
format date mmddyys8.;
if col1='C';
drop col:;
run;
... View more