Dear Statalisters,
(dear Sergiy Radyakin),
I recently found a shortcoming of -savespss-: When a data set contains a single value label longer than 255 characters (bytes?), the SPSS data file produced seems to be malformed.
I'm running -savespss- version 1.61 in Stata 13.1, fully patched. The problem exists both under Ubuntu 14.04 and Windows Server 2008 R2 environments.
Consider the following Stata code to produce a SPSS file:
The resulting SPSS file cannot be read. SPSS answers the GET FILE statement with the following error message:
PSPP produces an error message more detailed:
Note that as soon as you change the local `length' in the Stata code chunk to 255 or less, everything works as expected.
Is this a known limitation to -savespss-? Does anyone encounter the same problem? And: Is there any known workaround, despite manually truncating all value labels to 255 characters?
Kind regards
Bela
(dear Sergiy Radyakin),
I recently found a shortcoming of -savespss-: When a data set contains a single value label longer than 255 characters (bytes?), the SPSS data file produced seems to be malformed.
I'm running -savespss- version 1.61 in Stata 13.1, fully patched. The problem exists both under Ubuntu 14.04 and Windows Server 2008 R2 environments.
Consider the following Stata code to produce a SPSS file:
Code:
local length 256 quietly { clear set obs 1 generate variable=1 label define VALLAB 1 `"`=`length'*"a"'"' label values variable VALLAB } capture : confirm file `"test.sav"' if (_rc==0) erase `"test.sav"' savespss `"test.sav"'
Code:
GET FILE='test.sav'. >Error. Command name: GET FILE >Invalid SPSS Statistics data file: test.sav (DATA1204) >Execution of this command stops. >Error # 1405 in column 8. Text: test.sav >Error when attempting to get a data file.
Code:
GET FILE="test.sav". error: `test.sav' near offset 0x1f8: Variable index record (type 4) does not immediately follow value label record (type 3) as it should.
Is this a known limitation to -savespss-? Does anyone encounter the same problem? And: Is there any known workaround, despite manually truncating all value labels to 255 characters?
Kind regards
Bela
Comment