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

[no subject]

It appears unclear why you want to -destring- 
in this circumstance, as your variables are not 
really numeric in content and you just run the 
risk of losing information. 

If, however, you need a numeric categorical variable 
for some purpose, e.g. -anova-, then -encode- 
not -destring- is the appropriate way to do it. 

[email protected] 

> I have a number of string variables in my dataset. Within 
> these string 
> variables are observations that are coded with either  numeric 
> categorical values coded like this: (4010, 40120) or with 
> dashes (4010-, 
> 4012-) meaning that these four codes represent four different things. 
> Each string variable has hundreds of different categories 
> that are coded 
> in this manner.  I'm trying to convert  the string variables 
> to numeric 
> and  also be able to retain analysing the observations that 
> the contain 
> dashes.
> I've tried various destringing options such as these listed 
> below with 
> the following STATA response.:
> .destring dxcode1, generate(dxcode1num)
> dxcode1 contains non-numeric characters; no generate
> .destring dxcode1, replace
> dxcode1 contains non-numeric characters; no replace
> I've e-mailed once before on this topic, so I apologize in 
> advance for 
> the redundant question, but I'm still having trouble and I'm not 
> computer/STATA savvy. If anyone has some beginner 
> user-friendly advice with explicit coding, it would be much appreciated.

*   For searches and help try:

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