This should show you exactly what is in the raw file.
0D0A is end of record windows CR/LF
0A is Unix end of record
It makes a difference it you ar erunning on Unix or Windows
HAVE A RAW FILE WITH BAD HEX CODES ( 0A and 0D for instance)
file c:/txt/badhex.txt
The records look fine in the log window
AAAAAAAAAAA
BBBBBB
AAAAAAAAAAA
BBBBBB
AAAAAAAAAAA
BBBBBB
WANT ( A lising like this to see the bad characters like 0A and 0D in the data
RULE: ----+----1----+----2----+----3----+-
1 CHAR AAAAAAAAAAA.BBBBBB..
ZONE 44444444444044444400
NUMR 11111111111A222222DA
2 CHAR AAAAAAAAAAA.BBBBBB..
ZONE 44444444444044444400
NUMR 11111111111A222222DA
3 CHAR AAAAAAAAAAA.BBBBBB..
ZONE 44444444444044444400
NUMR 11111111111A222222DA
SOLUTION
* create a bad file;
data _null_;
file "c:/txt/badhex.txt" lrecl=20 recfm=f;
do i=1 to 3;
txt=cats(repeat('A',10),'0A'X,repeat('B',5),'0D0A'X);
put txt;
putlog txt;
end;
run;quit;
* just pick and lrecl and recfm that is close to what your record length is and
use the code below. Then look for bad chars;
data _null_;
infile "c:/txt/badhex.txt" recfm=f lrecl=20;
input r20 $char20.;
list;
run;quit;
NOTE: The infile "c:/txt/badhex.txt" is:
Filename=c:\txt\badhex.txt,
RECFM=F,LRECL=20,File Size (bytes)=60,
Last Modified=22Aug2016:13:31:11,
Create Time=22Aug2016:13:24:00
RULE: ----+----1----+----2----+----3----+-
1 CHAR AAAAAAAAAAA.BBBBBB..
ZONE 44444444444044444400
NUMR 11111111111A222222DA
2 CHAR AAAAAAAAAAA.BBBBBB..
ZONE 44444444444044444400
NUMR 11111111111A222222DA
3 CHAR AAAAAAAAAAA.BBBBBB..
ZONE 44444444444044444400
NUMR 11111111111A222222DA
A better way is to use the old text editor and 'proc fslist'.
However this does not work well or at all in
(EE,EG,UE,SAS Studio)
filename fsl "c:\txt\badhex.txt' lrecl=20 recfm=f;
proc fslist file=fsl;
run;quit;
When the full screen editor comes up, you will need
a nice command line. This is where all the other editors fail.
On the command line type nums on;hex on;
You can use quite a few of the old text editor scripting commands
like find '0A'X;
... View more