Dear Suzy,
just a short answer to your follow up question:
> Since the majority of the datapoints are actually numeric rather than
> alpha-numeric...is 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.
(1) to convert the numeric variables to string variables just
use the "tostring" command. [ tostring (dxcode1), replace ]
(2) to convert the string variables to numeric ones, you have to make sure
BEFORE, that all strings in that variable do not contain any other
characters but digits. When stata tries to "destring" a string like
"V1234" or "1234-" it has no clue what to do with the "V" or "-" and
therefor puts a missing there.
If the "V" or "-" does not contain any information which is important
for you, you can just use the code which I posted earlier today and
which removes everything like non-numeric ("V"s and "-"s) before
destringing the variable. Thus, it makes "V1234" to 1234 and
"1234-" also to 1234 (even "a1b2c3d4" leads to 1234)
To use this code, you have to copy it to the dofile editor and run
it.
Best wishes,
Christian
Kind regards,
Christian Holz
Research Analyst | HBS Consulting GmbH Germany
tel: +49 341 215 4549 | Tomasiusstrasse 2, D-04109 Leipzig
fax: +49 341 215 4521 | www.hbs-consulting.com
cell +49 172 792 3672 | [email protected]
*
* 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/