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

st: Re: destringing


From   Christopher F Baum <[email protected]>
To   [email protected]
Subject   st: Re: destringing
Date   Sat, 28 Aug 2004 07:56:34 -0400

On Aug 28, 2004, at 2:33 AM, Suzy wrote:

I don't know if this matters but I'm not starting with purely string
variables. I have variables that have datapoints of which some are
string and some are numeric.
Such variables do not exist in Stata. If a variable contains string contents, it is string. There is nothing wrong with the string "1234". But unlike Excel, where columns may contain both data types, Stata variables are one or the other. If you want to preserve contents which are part alpha string and part numeric string, you must use string variables to store them. encode (or Roger Newson's sencode) is the answer, and will preserve and display the existing contents while allowing the variables to be used numerically. For example see the variable foreign in auto.dta: one could say that it was the string "domestic" or 'foreign" but was encoded (and made into a dummy).

Kit

*
* 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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index