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

st: re: destring

From   Marcello Pagano <[email protected]>
To   [email protected]
Subject   st: re: destring
Date   Mon, 30 Aug 2004 09:09:54 -0400

Marcello Pagano wrote:

For Kit:

Suzy said

Since the majority of the datapoints are actually numeric rather than there a way for me to modify the 11 variable (dxcodes
and procodes) from string to numeric and then modify the alpha-numeric
datapoints within that variable to be read as either a string or numeric
(I don't care which as long as it can be read)... and as the other
gentlemen had stated - it's probably best to retain the code as is
rather than drop the dashes and alphabets.

Per my previous message, if you look closely at what encode is doing, you will see that it does what you need. encode makes a string variable into a numeric variable with string value labels. Thus the variable can be displayed by its original contents, just as the variable foreign in auto.dta appears to have string content--but it also can be used in routines which require a numeric representation (such as anova or regress). So read the variables that have both pure numeric and alphanumeric values as strings--that is the only way that all of their contents can possibly be retained within Stata--and encode them. That's all it takes. They cannot be 'modified from string to numeric' without destroying the alphanumeric content.


* For searches and help try:
*   For searches and help try:

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