The IMPORT procedure with GETNAMES=NO uses FIRSTOBS=2 instead of FIRSTOBS=1 in the INFILE statement in the generated DATA step code


Beginning in SAS® 9.4M9 (TS1M9), after you apply the hot fix from SAS KB0045497, PROC IMPORT with the GETNAMES=NO statement generates DATA step code with an INFILE statement using FIRSTOBS=2 instead of FIRSTOBS=1.

Here is an example of the PROC IMPORT code:

proc import datafile='c:\temp\class.csv' out=class2 dbms=dlm replace;
delimiter=',';
getnames=no;
run;

As a result, the following occurs in the SAS log snippet:

35 proc import datafile='c:\temp\class.csv' out=class2 dbms=dlm replace;
36 delimiter=',';
37 getnames=no;
38 run;

39 /**********************************************************************
40 * PRODUCT: SAS
41 * VERSION: 9.4
42 * CREATOR: External File Interface
43 * DATE: 28JUL26
44 * DESC: Generated SAS Datastep Code
45 * TEMPLATE SOURCE: (None Specified.)
46 ***********************************************************************/
47 data WORK.CLASS2 ;
48 %let EFIERR = 0; /* set the ERROR detection macro variable */
49 infile 'c:\temp\class.csv' delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2 ;
50 informat VAR1 $7. ;

Workaround

To prevent the FIRSTOBS= option from being set to 2 when using GETNAMES=NO, add the DATAROW=1 statement. Here is an example:

proc import datafile='c:\temp\class.csv' out=class3 dbms=dlm replace;
delimiter=',';
getnames=no;
datarow=1;
run;



***Internal-Only Information***

Author: Amber Elam

JIRA/DEFECT: [SAS9-63570] 94M9: PROC IMPORT with GETNAMES=NO uses FIRSTOBS=2 instead of FIRSTOBS=1 on the INFILE statement - SAS R&D JIRA 

Keywords: proc_import, GETNAMES=NO, FIRSTOBS=2, INFILE, KB0045497, SAS9-63570,