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

st: RE: Stat-Transfer Ver.6


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Stat-Transfer Ver.6
Date   Wed, 28 Aug 2002 10:23:15 +0100

Amani Siyam
> 
> I have a dta-file version 7 that I need to provide to my 
> colleague as an SPSS file- I have realised our current 
> version of Stat-transfer can not read Stata 7 files.  
> 
> I have tried saving the file as version 6 by "save, replace 
> old" after the hassle of having to reduce all variable 
> names to 8-characters or less.
> 
> My query comes in two parts:
> 
> 1.	I still have a problem with labels - Stata is telling 
> me "value label name ..  too long"
> 	What can I do about that...

The specific problem is that the limit for value label 
names in Stata 6 was 8 characters. 

So one solution is to rename the value label. 

If you have one long label name defining 
a few labels, just create a new set of value 
labels by hand with a shorter name, drop the set with 
a too long name, and attach the new set to the variable(s) 
in question. 

However, you may have lots of such long label names. 
It may be that you should write a program to save the 
labels to a file and then edit the names
to shorter and reattach to the original variales. That 
would seem rather awkward. Perhaps easier is 
to -decode- variables with long labels; here 
I am assuming in ignorance that between them 
Stat-Transfer and SPSS can handle the resulting
string variables. 

Something like this code in Stata 7.0 will -decode- the
variables. It seems that you have already 
fixed any variable names which are too long. 
However, be warned that I did not test the code. 
Also, omit the comments which are there largely 
to protect the "{" against a possible mailer bug which 
sometimes strips "{" when it is the last character
on a line. 

foreach v of var * { /* for every variable */ 
	local lbl : value label `v' 
	if length("`lbl'") > 8 { /* label name is too long */ 
		tempvar decoded 
		decode `v', gen(`decoded') 
		drop `v' 
		rename `decoded' `v' 
	} 
} 
		
> 2. 	If I manage to update  Stat - Transfer Ver 6.0, and 
> transfer my original Ver 7.0 files to SPSS , will I still 
> face the same 	problem  (a variable name which is 
> more than 8 characters) this time with  SPSS.

Steve Dubnoff has already replied to this. 

Nick 
n.j.cox@durham.ac.uk 
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index