2

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.

Marisa Carlos
  • 23
  • 1
  • 3
  • What version of Stata created that file? And what version of SAS do you have? – Joe Oct 28 '16 at 21:25
  • I'm using SAS 9.4. I did not create the Stata dataset, but have been able to open it using version 14. I tried saving it as version 13 and importing that file, but received the same error. – Marisa Carlos Oct 29 '16 at 17:18

1 Answers1

3

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.

Joe
  • 62,789
  • 6
  • 49
  • 67