I found that the NAMEROW option only works for Excel files, not CSVs (or other delimited text files). The way I solved a similar problem (the first 9 lines of each text file are file headers, not column headings - those are on line 10 with data starting at line 11) was to use a temporary file where the output of the original starts at the line with the column labels. For example, my code looks like this: /* Need to cut the first 9 rows that do not contain header info */
options obs=50; /* just use 50 lines for testing purposes - set to max to production */
filename tempdata temp;
data _null_;
infile "&filenm."
firstobs=10
lrecl=32760
dlm=','
missover
dsd ;
file tempdata dlm=',' lrecl=32760;
input;
put _infile_;
run;
/* import from temp file */
proc import out=work.test datafile=tempdata
dbms=csv replace;
datarow=2;
getnames=yes;
run; Of course, &filenm is a macro variable holding the full path filename of the file you are attempting to import. "firstobs=10" allows me to skip those first 9 useless lines. "filename tempdata temp" sets up a text file in the WORK folder that is output to in the "file tempdata dlm=',' lrecl=32760;" step of the "data _NULL_" block and then becomes the input of the PROC IMPORT block at the end. The PROC IMPORT works as usual (DBMS=CSV for comma-delimited, DATAROW=2 to instruct IMPORT that the data starts on the 2nd line of the new/temporary file; GETNAMES=YES uses the column labels from the former 10th line - now top line - of the file). I hope that covers everything.
... View more