assuming everything is consistent (which might be a big assumption). data want(keep=rec); infile fid; length txt $100. rec $100. ; retain rec; input txt & $100.; if substr(txt,1,8)='Customer' then do; /*handles customer1 and customer2*/ rec=''; input txt & $100.; /*name*/ rec=compress(txt); input txt & $100.; /*address*/ rec=catx(', ',rec,txt); input txt & $100.; /*city*/ rec=catx(', ',rec,txt); output; end; else if substr(txt,1,9)='Amount = ' then do; rec=substr(txt,10); output; end; else if substr(txt,1,7)='Field1:' then do; rec=substr(txt,9); output; end; else if substr(txt,1,7)='Field2:' then do; rec=substr(txt,9); input txt & $100.; /*address*/ rec=catx(', ',rec, txt); input txt & $100.; /*city*/ rec=catx(', ',rec, txt); output; end; run;
... View more