Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Re: openning an SPSS file


From   Richard Williams <[email protected]>
To   [email protected]
Subject   Re: st: Re: openning an SPSS file
Date   Thu, 16 Oct 2003 06:13:51 -0500

There is a potential trap with the approach of 'saving as' a tab delimited file in SPSS and importing into Stata using 'insheet using filename'

If there is a missing value (no entry of a number) in any of the observations for a numeric variable in SPSS, SPSS outputs a space character in the saved tab-delimited file. When the file is read by Stata via 'insheet using filename', the space character converts the numeric variable into a string variable and doing the -summ var- command in Stata says that there are zero observations for this variable. This is because it is a string variable. I think that there is no need for SPSS to output a space character, but that is the way it is. Deleting the space character(s) in the tab-delimited file resolves the problem, but it is only a workaround. This occurs with Stata7 and Stata8.

Anothe workaround in Stata is to use
-destring, replace-

Regards, Garry
[email protected]
I use Stat Transfer so I have not encountered this problem. But, I imagine a workaround in SPSS would be to first recode your missing values, e.g. have something like RECODE VARNAME (SYSMIS = 999999).

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index