Thank you Ksharp. Your solution worked and got rid of the embedded carriage returns. But I ran into another problem. I modified the code to read in a text file with 10,405 records. About 1% percent of the records have embedded carriage returns. The remaining 99% are fine. The program inputted all 10,405 records. But it only outputted 80 records. I was expecting around 10,300. The SAS log didn't indicate any errors so I'm a little puzzled. The modified code is below. filename xlog "c:\test\contactlog.txt"; data have; infile xlog; input; length want $ 2000; retain want; want=cats(want,_infile_); if countw(want,'|')=11 then do;output;call missing(want);end; ;;;; run; contactlog.txt has 10 variables but the first variable doesn't start with a pipe. The layout looks like this var1 | var2 | var3 | var4 | var5 | var 6 | var7 | var8 | var9 | var10 | var8 is the problem variable that sometimes has embedded carriage returns. Thanks
... View more