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

st: RE: stat-transfer question


From   "Marks, Jim" <[email protected]>
To   <[email protected]>
Subject   st: RE: stat-transfer question
Date   Thu, 30 Jan 2003 14:38:09 -0600

Hi Lee:

I recommend adding value labels to the converted variable in SPSS. A
list of labels can be concatenated into SPSS syntax using Excel or some
other spreadsheet program.

Here is a procedure for Excel. Copy the value labels into the
spreadsheet. With values in column A and labels in column B, create this
formula in C1:

	="   "&A1&" '"&B1&"' "

Copy the formula down the list of values. This will generate results
like:
	   1 'No Comment'
	   2 'Thanks'
	   3 'Next'

(Notice that each line begins with 3 spaces-- necessary to wrap lines in
SPSS.)

Copy and paste the range of formulas into a SPSS syntax window. The
values will be copied, not the Excel formulas. You will need to make
minor edits to conform to SPSS syntax. Type in the SPSS command

	VALUE LABELS varname

in front of the first label, and insert a period after the last label.

This is a bit kludgy, but it should work for you. If you have numerous
strings to convert and relabel, you might need a more efficient
solution.

Jim Marks
Senior Market Analyst
LodgeNet Entertainment Corporation



-----Original Message-----
From: Lee Sieswerda [mailto:[email protected]]
Sent: Wednesday, January 29, 2003 11:15 AM
To: Statalist (E-mail)
Subject: st: stat-transfer question


I'm using the latest update of Stat-Transfer 7 and notice in the manual
supplement that value labels for strings (SPSS and SAS) are now
supported.
I'm trying to convert a large file in SPSS format to Stata 8 format.

For numeric variables in the SPSS input file, the transfer to Stata
format
works perfectly; all of the value and variable labels transfer nicely.
Now
here's the challenge: I have some variables in the SPSS file that are,
in
fact, numbers but which are stored as strings with value labels. Because
they are strings in SPSS, they are transferred as strings to Stata.
Therein
lies the problem. Stata doesn't support value labels on strings and so I
lose the large list of value labels in the transfer. I tried to work
around
the problem by recasting the SPSS variable from string to numeric but,
alas,
SPSS insists on dropping the value labels during the conversion. I was
thinking that in an ideal world, Stat-Transfer would offer me the
flexibility of being able to choose the storage type in the output Stata
file. That is, I'd like to convert (SPSS string with value labels) to
(Stata
float with value labels).

Any ideas on how to accomplish this?

Thanks,
Lee

Lee Sieswerda, Epidemiologist
Thunder Bay District Health Unit
999 Balmoral Street
Thunder Bay, Ontario
Canada  P7B 6E7
Tel: +1 (807) 625-5957
Fax: +1 (807) 623-2369
[email protected]
www.tbdhu.com

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