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
Solution ID: 100000545 Product: SPSS Base Title: Reading raw data files that has no carriage returns Description: Q. I have an ASCII data file I would like to analyze with SPSS, but the data is just one long stream, with no separation between records or fields, and no carriage returns. Is there a way I can get SPSS to read in this data? I have only been able to read the first record in the file, due to there being no carriage returns or any other delineating marks in the file. A. SPSS can read this data with the use of a FILE HANDLE command. If, for example, each record of a file named persons.dat is 147 characters long, with a person's name in positions 33-65 and the person's age in positions 112-113, the commands to read those fields would be FILE HANDLE mydata / name='persons.dat'/ mode=image / lrecl=147. DATA LIST file=mydata / name 33-65 (a) age 112-113. The MODE=IMAGE syntax specifies that this data file is a fixed-length data file with no end-of-line character. LRECL means "logical record length" and is required with MODE=IMAGE. The DATA LIST command reads ASCII input files. By default, SPSS assumes a fixed-field layout such as the one indicated above.