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

st: AW: RE: encode question

From   "Martin Weiss" <>
To   <>
Subject   st: AW: RE: encode question
Date   Fri, 13 Feb 2009 15:01:17 +0100


" 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. And her subject line made -encode- an enticing option... Austin`s
solution can be made shorter to -destring, replace- as the varlist is not


-----Ursprüngliche Nachricht-----
[] Im Auftrag von Nick Cox
Gesendet: Freitag, 13. Februar 2009 13:54
Betreff: st: RE: encode question

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
        . . . . . . . . . . . . . . . . . .  UCLA Academic Technology
        7/08    <>

FAQ     . . . . . . . . . . . . . . . . . .  Numeric variables input as
        2/02    Stata is reading in my variables as string, whereas
                they should be numeric. What should I do?

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. 


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:

*   For searches and help try:

© Copyright 1996–2022 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index