0
votes

I'm importing a .TSV file, with the first row being the variable name and the first column as IDs, into SPSS using a syntax but I keep getting a Failure opening file error in my output. This is my code so far:

GET DATA 
/TYPE=TXT 
/FILE=\filelocation\filename.tsv
/DELCASE=LINE
/DELIMTERS="/t"
/QUALIFIER=''
/ARRANGEMENT=DELIMITED
/FIRSTCASE=2
/IMPORTCASE=ALL
/VARIABLES=
/MAP
RESTORE.
CACHE.
EXECUTE.
SAVE OUTFILE = "newfile.sav"

I think I'm having an issue in the delimters or qualifiers subcommand. Wondering if I should also include the variables under the variables subcommand. Any advice would be helpful. Thanks!

1
Are you on a Windows machine? "Failure opening file" could indicate that the TSV file is open in some other application (e.g. Notepad or Excel) and the filesystem isn't giving SPSS access to open it - Kevin Troy
That could have been it. I also believe part of the issue was I had not put the variables in the syntax. It ended up working after I included variablenumber AUTO. - TWB

1 Answers

0
votes

The GET DATA command you cite above has an empty /VARIABLES= subcommand. If you used the "File -> Import Data -> Text Data' wizard, it would have populated this subcommand for you. If you are writing the GET DATA command syntax yourself, then you'd have to supply that list of field names yourself.