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

RE: st: Re: openning an SPSS file

From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: Re: openning an SPSS file
Date   Thu, 16 Oct 2003 12:36:12 +0100

Richard Williams
> >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-
> 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).

That's evidently an alternative. 

No reason, however, to change your SPSS 
data -- in a way you presumably will need to reverse --
when there appears to be a simple official 
Stata fix for the problem on Stata entry. 

[email protected] 
*   For searches and help try:

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