[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Re: string variables
> 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
> So, my questions are following:
> 1.Why does this kind of phenomenon occur in Stata
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
On numbers and strings. The Stata Journal 2, 314-329
wherein the use of -real()- is characterised
as a brute force solution.
* For searches and help try: