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

Re: st: SPSS to Stata using DBMS/Copy


From   Roger Newson <[email protected]>
To   [email protected]
Subject   Re: st: SPSS to Stata using DBMS/Copy
Date   Wed, 04 Aug 2004 12:31:48 +0100

At 22:54 03/08/2004, Dan Blanchette wrote:
Is there a Stata tool to convert the string variables created by DBMS/Copy
that contain the value label information back to value labels after
transferring data from SPSS to Stata?

When I have an SPSS datafile that contains variables with value labels
and I use DBMS/Copy to create a Stata datafile, DBMS/Copy asks if I want
string variables created for each variable that has a value label.  The
downside to this is that it nearly doubles the number of variables in
my dataset and it more than doubles the size of the datafile.

I wrote a Stata program to convert these variables back to value labels
because -encode- does not necessarily generate the same numeric values
as the original numeric variables.  I spent quite a bit of time Googling
around for such a tool and didn't find one.  Stat/Transfer seems to just
make value labels in the Stata datafile, which is great.  I don't have
SPSS available to me.

I'm wondering how or if people deal with this problem and if my program
would be of interest to others.
This looks like one reason why I developed -sencode- (downloadable from SSC). -sencode- ("super -encode-") encodes string variables to labelled numeric variables in an order defined by the user, which defaults to the order of appearance of the string value in the dataset, but which can be set to some other order using the -gsort()- option. There is also a -manyto1- option, allowing the mapping from numeric values to string labels to be many-to-one, and a -replace- option, allowing the output labelled numeric variable to replace the input string variable, taking its name, variable label, characteristics and position in the data set. More about the use of -sencode- can be found in Newson (2003) and Newson (2004), both downloadable from my website, which can be found in Stata by typing

findit enduser

in the first case and

findit resultsset

in the second case.

-sencode- of course is not psychic, and cannot infer, just by looking at the labels, what the original order was in the original SPSS file. It is the responsibility of the user to supply that information. I would definitely like to know more about your program, and to find out how it deals with that problem.

Best wishes

Roger


--
Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
or 020 7848 6605 International +44 20 7848 6605
Email: [email protected]
Website: http://www.kcl-phs.org.uk/rogernewson

Opinions expressed are those of the author, not the institution.

*
* 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