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

From |
"Martin Weiss" <martin.weiss1@gmx.de> |

To |
<statalist@hsphsun2.harvard.edu> |

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 mandatory... HTH Martin -----Ursprüngliche Nachricht----- Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Nick Cox Gesendet: Freitag, 13. Februar 2009 13:54 An: statalist@hsphsun2.harvard.edu 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 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 n.j.cox@durham.ac.uk 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/ * * 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/

**Follow-Ups**:**st: RE: AW: RE: encode question***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**References**:**st: encode question***From:*Arina Viseth <arina@UDel.Edu>

**st: RE: encode question***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

- Prev by Date:
**Re: st: how to remove axis margin from plot** - Next by Date:
**st: RE: time trend in a panel with very SHORT time dimension** - Previous by thread:
**st: RE: encode question** - Next by thread:
**st: RE: AW: RE: encode question** - Index(es):

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