Read ASCII file with a forward slash delimiter
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | SPSS AnswerNet: Result Solution ID: 100008900 Product: SPSS Base Version: 10.0 O/S: WINDOWS Question Type: Data Import-Export Question Subtype: Reading Different File Types Title: Using "/" as a delimiter in a text file Description: Q. In SPSS 10, I am trying to read in my text file that is delimited using a forward-slash (/) as the only delimiter or as one of a multi-delimited text file. My data appears correct in the preview pane of the text import wizard, however when I click finish to attempt to import the text file, I get the error message: Error. Command name: GET DATA (2267) Missing expected token: = This command not executed. I have also tried pasting the syntax directly from the syntax editor and running it from the syntax editor and I get the same error message. What is wrong? A. The problem occurs in SPSS 10 because of the use of GET DATA instead of DATA LIST LIST in previous windows versions. As you can see in the syntax, GET DATA uses forward-slashes (/) as the initiator of SPSS subcommands. There are two options you have to get your data into SPSS. The first option would be to open the text file in a text editor such as WordPad or Notepad and do a "Replace All" on the forward-slash into a different delimiter. In Wordpad, Edit->Replace-> Replace All. In Notepad, Search->Replace->Replace All. The second option would be to use a DATA LIST LIST syntax to read in your text file. An example of this would be: DATA LIST LIST(',', '/') file='C:\\Program Files\\SPSS\\filename.txt' / V1(f8.2) V2(f8.2) V3(f8.2) V4(f8.2) V5(f8.2) V6(f8.2). EXECUTE . Created on: 08/16/2000 |
Related pages
...