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

st: Re: string variables


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: string variables
Date   Thu, 5 Dec 2002 11:16:24 -0000

Katsuhide Isa

> I have a problem with string variables.
> While converting CSV data into dta data using Stata 
> Transfer, several integer variables were accidentally 
> converted into string ones(as they happen to contain 
> no response, it might be a cause)
> These string variables can't be used with such 
> commands as -generate-, -rename-, or -forvalues-, 
> which causes some trouble in the subsequent data 
> manipulation. 
> So, my questions are following:

> 1.Why does this kind of phenomenon occur in Stata 
> Transfer?

I guess it is trying to justice to your data 
as presented to it. 

> 2. Is it possible to convert the type of the string 
> variables without changing the original order of variables?
> Creating new variables in the last columns using -real( )- 
> function could be a second best solution. 
> But I'd like to, if possible, avoid this method.
> I'd like to retain the whole variables(even if some of them 
> contain no response) for some reason.

Absolutely. Check out -destring-. Empty 
strings will map to missings, if that is what 
you mean by "no response". 

There is a general discussion of numbers and 
strings at  

On numbers and strings. The Stata Journal 2, 314-329
(2002) 

wherein the use of -real()- is characterised 
as a brute force solution. 

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