Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: AW: RE: encode question


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: AW: RE: encode question
Date   Fri, 13 Feb 2009 14:37:50 -0000

mistakenly were read in as string." Thanks. 

Nick 
[email protected] 

Martin Weiss

" The question is evidently about string variables that mistakenly were
read
in as numeric."

Arina`s initial question sounded more like numeric vars being read in as
strings. 

Nick Cox

The question is evidently about string variables that mistakenly were
read in as numeric. Thus -destring-, not -encode-, is the answer. Also,
as Austin's suggestion makes plain, you don't need to code for a loop
over variables or the overwriting of existing variables, as -destring-
will do that for you. 

Arina's problem is already written up as two FAQs: 

FAQ      How can I quickly convert many string variables to numeric
variables?
        . . . . . . . . . . . . . . . . . .  UCLA Academic Technology
Services
        7/08    <http://www.ats.ucla.edu/stat/stata/faq/destring.htm>

FAQ     . . . . . . . . . . . . . . . . . .  Numeric variables input as
string
        2/02    Stata is reading in my variables as string, whereas
                they should be numeric. What should I do?
                <http://www.stata.com/support/faqs/data/allstring.html>

If you wished to -encode- several variables simultaneously -- and _also_
wanted the same set of value labels -- that is handled by -multencode-
on SSC, as discussed on this list last month. 

Nick 
[email protected] 

Austin Nichols

destring _all, replace

Arina Viseth

I have a dataset that I imported from Excel using insheet. However, many
numerical variables (I have about 200 variables) are now showed as
string variables. 
My question is the following: how can I transform each string variable
into numerical one - and also replicate their names - without having to
encode manually each one of them?

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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