Opps.
If you want all rows have the same length for each variable.Try the following, You need to
change it a little,That is easy.
[pre]
%let path=c:\temp\;
filename fname pipe "dir &path.adhoc_*.txt /B";
data result;
infile fname length=len;
input filename $varying200. len;
filename=cats("&path",filename);
infile dummy filevar=filename length=len end=last;
_filename=scan(filename,-1,'\');
do until(last);
input row $varying200. len;
if length(scan(row,1,',')) ne 2 or
length(scan(row,2,',')) ne 6 or
length(scan(row,3,',')) ne 4 or
length(scan(row,4,',')) ne 4 or
length(scan(row,5,',')) ne 5
then do;
success='N';
output;
leave;
end;
if last then do;
success='Y';
output;
end;
end;
run;
proc print noobs;run;
_filename row success
Adhoc_dsdq.txt 12 498983 duwr 49dw 98394 N
Adhoc_ffgfq.txt 22,438983,dfsr,efrw,92354 Y
Adhoc_wq.txt 222,438983,dfsr,efrw,92354 N
Adhoc_wsaa.txt 12 498983 duwr 49dw 98394 N
[/pre]
Ksharp