Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: SPSS to Stata - Variable with 14 digits not transformed correctly

From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: SPSS to Stata - Variable with 14 digits not transformed correctly
Date   Fri, 2 Mar 2012 11:54:43 +0000

In this context values like 1.001e+13 are to be thought of as, strictly, sets of values which are all displayed in the same way with a particular format. Crucially, changing the display format does nothing to change what is stored; by definition, it only changes how that is displayed. 

14-digit identifiers can only be held accurately in Stata as string variables or -double- variables. If your identifier variable is -float- instead, then you will have lost precision in importing to Stata and the only way to regain that precision is to read the data in again.  Recasting from -float- to -double- does nothing useful as the extra details have been lost already. 

-usespss- is user-written (SSC). Its author is intermittently active on Statalist. I've never used it but I see no way in its help to change how particular variables are imported. I guess that you need some other solution. As I don't use SPSS or SPSS files at all I can only guess that you need to look at export options in SPSS and import options in Stata and find a match. Others on this list who do use SPSS should be able to add better advice. 

In short, this problem as you describe it cannot be fixed in Stata. You must import again. 

[email protected] 

Julian Emmler

 I'm new to this forum so I don't know yet the most accurate way to post my
question but I hope it will be understandable and I would be greatful for
every question for clarification. My Problem with Stata is concerned with
transforming household data for the South African labour market which is
only available in SPSS format to Stata. I did this with several datasets
also for the South African labour market and used the "usespss" command in
Stata which worked just fine. However with the last dataset I encountered a
 In the dataset, to identify a household, a 14 digit number called the
Unique Household Identifier is used. However, if I transform the data
from SPSS to Stata, the values of the Household identifier are not it's
real values any more but are shortened e.g. to 1.001e+13. Thus the Unique
household identifier is not unique anymore. I try several things, e.g.
transformin the vaiable to a double variable and increasing the number of
digits displayed. This helps in that regard, that the number is now
displayed correctly in the data browser, however the value didn't change.
After searching the internet, I've come to the conclusion that this probelm
has something to do with the length of the variable, i.e. that 14 digits is
too long to be handled by Stata. Another indicator for this is that with
earlier datasets I had no problem because the Unique Household Identifier
was 12 digits long. I wanted to ask now if you know any way to
transfer the SPSS data to Stata correctly or a way to manipulate the
data afterwards so i attains its true values. 

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index