Stata to SPSS conversion

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Stata to SPSS conversion

Justin Blehar
Dear List,

I'm working on a dataset with someone that only uses Stata. I'm having trouble opening the files and get the following error code:

GET
  STATA FILE='C:\Users\bleharj\Desktop\interim-dra-105 (4).dta'.

>Error # 7202.  Command name: GET STATA
>Input dictionary read error.
>Execution of this command stops.
Your new version of Stata is not supported
DATASET NAME DataSet1 WINDOW=FRONT.

I've found old posts (2010) that state SPSS can open files up to Stata Version 9? Has this been upgraded yet? (I'm running SPSS version 22 and they have Stata Version 13).

Thanks,

Justin
Reply | Threaded
Open this post in threaded view
|

Re: Stata to SPSS conversion

Rick Oliver-3
SPSS Statistics does not currently support reading Stata 13 files. Officially, it only supports Stata through release 8, but you may be able to open versions 9-11 as well (although I don't know what problems might arise, such as handling of very long Stata value labels). There were some significant changes in Stata 13. Can the Stata user save the file in an earlier version format?

Rick Oliver
Senior Information Developer
IBM Business Analytics (SPSS)
E-mail: [hidden email]




From:        Justin Blehar <[hidden email]>
To:        [hidden email],
Date:        10/08/2013 09:04 AM
Subject:        Stata to SPSS conversion
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Dear List,

I'm working on a dataset with someone that only uses Stata. I'm having
trouble opening the files and get the following error code:

GET
 STATA FILE='C:\Users\bleharj\Desktop\interim-dra-105 (4).dta'.

>Error # 7202.  Command name: GET STATA
>Input dictionary read error.
>Execution of this command stops.
Your new version of Stata is not supported
DATASET NAME DataSet1 WINDOW=FRONT.

I've found old posts (2010) that state SPSS can open files up to Stata
Version 9? Has this been upgraded yet? (I'm running SPSS version 22 and they
have Stata Version 13).

Thanks,

Justin



--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Stata-to-SPSS-conversion-tp5722443.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD


Reply | Threaded
Open this post in threaded view
|

Re: Stata to SPSS conversion

Marta Garcia-Granero
In reply to this post by Justin Blehar
Hi Justin:

The only free solution I can think of is asking the other user to save
the file under a different name using -saveold- command instead
of-save-. If this exchange Stata <---> SPSS will happen often, then you
should consider buying a license of Stat/Transfer 12 (the demo will not
work, BTW, it's crippleware).

Welcome to my world (I'm constantly moving datasets between Stata 12 and
SPSS, using SAVE TRANSLATE in SPSS, -usespss- and -saveold- in Stata).

HTH,
Marta GG
(trapped between Stata & SPSS)

El 08/10/2013 16:01, Justin Blehar escribió:

> Dear List,
>
> I'm working on a dataset with someone that only uses Stata. I'm having
> trouble opening the files and get the following error code:
>
> GET
>    STATA FILE='C:\Users\bleharj\Desktop\interim-dra-105 (4).dta'.
>
>> Error # 7202.  Command name: GET STATA
>> Input dictionary read error.
>> Execution of this command stops.
> Your new version of Stata is not supported
> DATASET NAME DataSet1 WINDOW=FRONT.
>
> I've found old posts (2010) that state SPSS can open files up to Stata
> Version 9? Has this been upgraded yet? (I'm running SPSS version 22 and they
> have Stata Version 13).
>
> Thanks,
>
> Justin
>
>
>
> --
> View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Stata-to-SPSS-conversion-tp5722443.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
> .
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Stata to SPSS conversion

Marta Garcia-Granero
In reply to this post by Justin Blehar
Hi Justin:

I recently realized that my suggestion of using -saveold- in Stata 13
will not work. This will save the dataset in Stata 12 format, and SPSS
is only able to read Stata 11/older versions. I'm afraid Stat/Transfer
is your only solution, unless you can find someone around you who uses
Stata 12/older, installs -use13- ado, reads the Stata 13 file into the
older version (some long strings and other fancy new items might get
"lost in translation"), and uses then -saveold-. The Stata 13 user might
also export the dataset to Excel, and send it to you with a report of
the codebook. You should have you re-label everything.

Good luck.
Marta GG


El 08/10/2013 16:01, Justin Blehar escribió:

> Dear List,
>
> I'm working on a dataset with someone that only uses Stata. I'm having
> trouble opening the files and get the following error code:
>
> GET
>    STATA FILE='C:\Users\bleharj\Desktop\interim-dra-105 (4).dta'.
>
>> Error # 7202.  Command name: GET STATA
>> Input dictionary read error.
>> Execution of this command stops.
> Your new version of Stata is not supported
> DATASET NAME DataSet1 WINDOW=FRONT.
>
> I've found old posts (2010) that state SPSS can open files up to Stata
> Version 9? Has this been upgraded yet? (I'm running SPSS version 22 and they
> have Stata Version 13).
>
> Thanks,
>
> Justin
>
>
>
> --
> View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Stata-to-SPSS-conversion-tp5722443.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
> .
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Stata to SPSS conversion

Enzmann
In reply to this post by Justin Blehar
As a last resort, it may be worth a try to import a Stata dataset saved
in Stata 13 using -saveold- (which will convert it to a Stata 12 (format
115) dataset) using -read.dta()- in R (see http://cran.r-project.org/ -
you have to use -library(foreign)- before calling -read.dta()-). Take
care to check whether you want to use the default option
"convert.factors=T" of the -read.dta()- command. Subsequently you can
save it as a Stata 8/9 (format 113) dataset using -write.data(...,
version=9)-, and ultimately import this file into SPSS. Of course, as
Marta wrote, some things specific to Stata 13 and Stata 12 might get
lost in translation.

See also -?read.dta()- in R, there it says: "... Possible versions are
5, 6, 7, -7 (Stata 7SE, ‘format-111’), 8 (Stata 8 and 9, ‘format-113’)
and 10 (Stata 10 and 11, ‘format-114’). Stata 12 by default uses
‘format-115’, which is read as ‘format-114’ (the Stata documentation
says its structure is identical)."

If it works it would be nice to report this back to us.

Dirk

Am 12.10.2013 06:00, schrieb Automatic digest processor:

> Betreff:
> Re: Stata to SPSS conversion
> Von:
> Marta Garcia-Granero <[hidden email]>
> Datum:
> 11.10.2013 09:01
>
> MIME-Version:
> 1.0
> Content-Type:
> text/plain; charset=ISO-8859-1; format=flowed
> Content-Transfer-Encoding:
> 8bit
>
>
> Hi Justin:
>
> I recently realized that my suggestion of using -saveold- in Stata 13
> will not work. This will save the dataset in Stata 12 format, and SPSS
> is only able to read Stata 11/older versions. I'm afraid Stat/Transfer
> is your only solution, unless you can find someone around you who uses
> Stata 12/older, installs -use13- ado, reads the Stata 13 file into the
> older version (some long strings and other fancy new items might get
> "lost in translation"), and uses then -saveold-. The Stata 13 user might
> also export the dataset to Excel, and send it to you with a report of
> the codebook. You should have you re-label everything.
>
> Good luck.
> Marta GG
>
>
> El 08/10/2013 16:01, Justin Blehar escribió:
>> Dear List,
>>
>> I'm working on a dataset with someone that only uses Stata. I'm having
>> trouble opening the files and get the following error code:
>>
>> GET
>>    STATA FILE='C:\Users\bleharj\Desktop\interim-dra-105 (4).dta'.
>>
>>> Error # 7202.  Command name: GET STATA
>>> Input dictionary read error.
>>> Execution of this command stops.
>> Your new version of Stata is not supported
>> DATASET NAME DataSet1 WINDOW=FRONT.
>>
>> I've found old posts (2010) that state SPSS can open files up to Stata
>> Version 9? Has this been upgraded yet? (I'm running SPSS version 22
>> and they
>> have Stata Version 13).
>>
>> Thanks,
>>
>> Justin

--
========================================
Dr. Dirk Enzmann
Institute of Criminal Sciences
Dept. of Criminology
Rothenbaumchaussee 33
D-20148 Hamburg
Germany

phone: +49-(0)40-42838.7498 (office)
        +49-(0)40-42838.4591 (Mrs Billon)
fax:   +49-(0)40-42838.2344
email: [hidden email]
http://www2.jura.uni-hamburg.de/instkrim/kriminologie/Mitarbeiter/Enzmann/Enzmann.html
========================================

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Stata to SPSS conversion

Enzmann
Sorry, it should have been "using -write.dta(..., version=9)-".

Dirk

Am 12.10.2013 12:28, schrieb Dirk Enzmann:
> using -write.data(..., version=9)-

--
========================================
Dr. Dirk Enzmann
Institute of Criminal Sciences
Dept. of Criminology
Rothenbaumchaussee 33
D-20148 Hamburg
Germany

phone: +49-(0)40-42838.7498 (office)
        +49-(0)40-42838.4591 (Mrs Billon)
fax:   +49-(0)40-42838.2344
email: [hidden email]
http://www2.jura.uni-hamburg.de/instkrim/kriminologie/Mitarbeiter/Enzmann/Enzmann.html
========================================

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Stata to SPSS conversion

Enzmann
An experiment using Stata's notorious auto dataset was successful. After
saving this data set using Stata 13 (format 117) with the -saveold-
command into a Stata 12 (format 115) dataset, e.g.

* --- Start Stata commands: ---------------------

sysuse auto
saveold "d:/temp/auto115.dta"

* --- End Stata commands. -----------------------

you can use the following R (see http://cran.r-project.org/ ) commands
to convert the Stata 12 (format 115) dataset into a Stata 8/9 (format
113) dataset (note that even Windows users must use / instead of \ to
separate folder names!):

# --- Start R commands: -------------------------

library(foreign)

data115 = read.dta("d:/Temp/auto115.dta")
write.dta(data115,"d:/temp/auto113.dta",version=8)

# --- End R commands. ---------------------------

Subsequently, you can use SPSS to import the Stata 8/9 dataset:

* --- Start SPSS commands: --------------------- .

GET STATA FILE="D:/temp/auto113.dta".

* --- End SPSS commands. ----------------------- .

HTH,
Dirk

========================================
Dr. Dirk Enzmann
Institute of Criminal Sciences
Dept. of Criminology
Rothenbaumchaussee 33
D-20148 Hamburg
Germany

phone: +49-(0)40-42838.7498 (office)
        +49-(0)40-42838.4591 (Mrs Billon)
fax:   +49-(0)40-42838.2344
email: [hidden email]
http://www2.jura.uni-hamburg.de/instkrim/kriminologie/Mitarbeiter/Enzmann/Enzmann.html
========================================

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Stata to SPSS conversion

Marta Garcia-Granero
Thanks Dirk

That was really helpful. I had not thought of R with -foreign- as a free
alternative to Stat/Transfer.

Best regards,
Marta GG

El 14/10/2013 2:14, Dirk Enzmann escribió:

> An experiment using Stata's notorious auto dataset was successful. After
> saving this data set using Stata 13 (format 117) with the -saveold-
> command into a Stata 12 (format 115) dataset, e.g.
>
> * --- Start Stata commands: ---------------------
>
> sysuse auto
> saveold "d:/temp/auto115.dta"
>
> * --- End Stata commands. -----------------------
>
> you can use the following R (see http://cran.r-project.org/ ) commands
> to convert the Stata 12 (format 115) dataset into a Stata 8/9 (format
> 113) dataset (note that even Windows users must use / instead of \ to
> separate folder names!):
>
> # --- Start R commands: -------------------------
>
> library(foreign)
>
> data115 = read.dta("d:/Temp/auto115.dta")
> write.dta(data115,"d:/temp/auto113.dta",version=8)
>
> # --- End R commands. ---------------------------
>
> Subsequently, you can use SPSS to import the Stata 8/9 dataset:
>
> * --- Start SPSS commands: --------------------- .
>
> GET STATA FILE="D:/temp/auto113.dta".
>
> * --- End SPSS commands. ----------------------- .
>
> HTH,
> Dirk
>
> ========================================
> Dr. Dirk Enzmann
> Institute of Criminal Sciences
> Dept. of Criminology
> Rothenbaumchaussee 33
> D-20148 Hamburg
> Germany
>
> phone: +49-(0)40-42838.7498 (office)
>        +49-(0)40-42838.4591 (Mrs Billon)
> fax:   +49-(0)40-42838.2344
> email: [hidden email]
> http://www2.jura.uni-hamburg.de/instkrim/kriminologie/Mitarbeiter/Enzmann/Enzmann.html
>
> ========================================
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Stata to SPSS conversion

Enzmann
In reply to this post by Justin Blehar
Marta,

You said that your are constantly moving datasets between Stata 12 and
SPSS, using SAVE TRANSLATE in SPSS, -usespss- and -saveold- in Stata.

Note that there is a Stata .ado-program -dta2sav- (see: -ssc describe
dta2sav- in Stata) which allows to preserve labels of user defined
missings (.a, .b, ...) as used in Stata for subsequent use in SPSS (it
automatically saves Stata files using -saveold-).

Unfortunately, however, this will not work directly using Stata 13. Also
the solution using the function -foreign- of R will not help because
labels of missings only are not supported by -foreign-.

However, if you can use Stata version 10, 11, or 12, the problem can be
solved by combining the use of -use13- and -dta2sav- as follows. To
reproduce my example, first you have to create an example data set
(auto117.dta) using Stata 13 (format 117):


* --- Begin Stata 13 commands: ---------

version 13
sysuse auto


recode rep78 (.=.a), gen(rep78m) // note: no label of .a
recode price (10000/max = .a ">= 10,000"), gen(pricem)

save "d:/temp/auto117.dta", replace

* --- End Stata 13 commands. -----------


Here is how to move the Stata 13 data set (format 117) to SPSS using
Stata version 10, 11, or 12:


* --- Begin Stata commands: ----------

* Install -use13- if necessary:
cap which use13
if _rc ssc install use13

* Install -dta2sav- if necessary:
cap which dta2sav
if _rc ssc install dta2sav

/* First read (import) the Stata 13 file, subsequently save it as
    Stata 10/11 (format 114 - if using Stata 12) or as Stata 8/9
   (format13 - if using Stata 10 or 11) file (name: auto114.dts)
    and create SPSS syntax to read the data and define missings: */

use13 "d:/temp/auto117.dta"
dta2sav, nod v name("d:/temp/auto114")

* --- End Stata commands. ------------


Now you can open the file "d:/temp/auto114.sps" created by -dta2sav- in
SPSS and run all commands - it will save the data as the SPSS data file
"d:/temp/auto114.sav", preserving the labels of missing values as
defined in Stata.

HTH,
Dirk


14.10.2013 11:40, Marta Garcia-Granero <[hidden email]> wrote:
> Thanks Dirk
>
> That was really helpful. I had not thought of R with -foreign- as a free
> alternative to Stat/Transfer.
>
> Best regards,
> Marta GG

========================================
Dr. Dirk Enzmann
Institute of Criminal Sciences
Dept. of Criminology
Rothenbaumchaussee 33
D-20148 Hamburg
Germany

phone: +49-(0)40-42838.7498 (office)
        +49-(0)40-42838.4591 (Mrs Billon)
fax:   +49-(0)40-42838.2344
email: [hidden email]
http://www2.jura.uni-hamburg.de/instkrim/kriminologie/Mitarbeiter/Enzmann/Enzmann.html
========================================

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Stata to SPSS conversion

Sergiy Radyakin
In reply to this post by Justin Blehar
On Tue, 8 Oct 2013 07:01:01 -0700, Justin Blehar <[hidden email]> wrote:

>Dear List,
>
>I'm working on a dataset with someone that only uses Stata. I'm having
>trouble opening the files and get the following error code:
>
>GET
>  STATA FILE='C:\Users\bleharj\Desktop\interim-dra-105 (4).dta'.
>
>>Error # 7202.  Command name: GET STATA
>>Input dictionary read error.
>>Execution of this command stops.
>Your new version of Stata is not supported
>DATASET NAME DataSet1 WINDOW=FRONT.
>
>I've found old posts (2010) that state SPSS can open files up to Stata
>Version 9? Has this been upgraded yet? (I'm running SPSS version 22 and they
>have Stata Version 13).
>
>Thanks,
>
>Justin

Dear Justin, as the author of the -use13- program mentioned in this thread,
may I suggest two more alternatives (in addition to the helpful advices you
received from other list members).

Firstly, you can ask your colleagues running Stata 13 to install the new
command -savespss- which is available from my site:
http://www.radyakin.org/transfer/savespss/savespss.htm
With this command they can write SPSS system files (*.sav) directly, without
having to use any additional software. Specifically neither SPSS itself, nor
Stat/Transfer are required.

Secondly, if you are only receiving datasets and no software can be added to
the producing side, ask your colleagues to -saveold- the data from Stata (in
Stata 13 you will obtain the Stata 12 file). Then you can use the SaveTo9
program on your side.

SaveTo9 is available here:
http://www.radyakin.org/transfer/saveto9/cs/index.htm

This command will produce dataset in Stata 9 format that SPSS can import
itself. SaveTo9 does not require Stata, SPSS, or Stat/Transfer to be
installed on your system. It is completely standalone.

Should you have more questions to these programs, do not hesitate to contact
me either through Statalist, or using the contact info located in the
program home pages.

Hope this helps,
    Sergiy Radyakin, PhD Economics,
    Research Department, The World Bank



>
>
>
>--
>View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Stata-to-SPSS-conversion-tp5722443.html
>Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
>=====================
>To manage your subscription to SPSSX-L, send a message to
>[hidden email] (not to SPSSX-L), with no body text except the
>command. To leave the list, send the command
>SIGNOFF SPSSX-L
>For a list of commands to manage subscriptions, send the command
>INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Stata to SPSS conversion

xenia
In reply to this post by Justin Blehar
Another solution would be to export your stata file as Excel and import this Excel file to SPSS.