Hi! I am reading in several text files using a wildcard in the infile statement and I include additional statements to store the name of the file in a separate variable. Each text file includes the variable names in the first row.
DATA work.test
LENGTH filename txt_file_name $256;
RETAIN txt_file_name;
INFILE "C:\samplepath\*.txt"
EOV = eov
FILENAME = filename
DLM = ","
MISSOVER
DSD
LRECL = 32767;
INPUT@;
IF _N_ = 1 OR EOV THEN DO;
txt_file_name = scan(filename, -1,"\");
EOV = 0;
DELETE;
END;
ELSE
INPUT .....
The files that I am reading in 'should' all have the same structure. Is there a way to test within this data step that the files being read in all have the same number of variables? I am trying to avoid reading them all in separately and checking that way. I was thinking that replacing the MISSOVER option with the STOPOVER option might work, but I get an error message "INPUT statement exceeded record length." Any help is greatly appreciated. Thanks!