Search code examples
sasasciistataimporterrornon-ascii-characters

SAS proc import error: "Didn't see end for |varnames| element. Got -> ||"


I am getting the following error when I try to import a .dta file:

Didn't see end for ¦varnames¦ element. Got -> ¦¦
Requested Input File Is Invalid
ERROR: Import unsuccessful. See SAS Log for details.

The code I am using to import this file is simple, so it should not be a syntax issue. It is of the form below if interested:

proc import datafile = "$path.\data.dta"
dbms=stata
out = data
run;

Any idea what this might be due to? The dataset I am trying to import consists of 4 character variables and ~10,000 obs.


Solution

  • SAS supports version 12 and earlier of Stata through PROC IMPORT currently. You may want to try saving it as a version 12 file and see if that fixes the error. Per @Nick-Cox in comments, see saveold command in Stata to do that.

    See PROC IMPORT documentation for more details.