Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: destring


From   P chrisman <peggyc@u.washington.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: destring
Date   Wed, 01 Aug 2007 21:38:22 -0700

A HUGE thanks to Nick to his help!!!!
Peggy

Nick Cox wrote:
I posted a quasi-tutorial on this general area a short while back. It may help understanding of the numeric <-> string conversion problems (and they are problems, not a single
problem).
<http://www.hsph.harvard.edu/cgi-bin/lwgate/STATALIST/archives/statalist.0707/Author/article-469.html>

There is no reason why -encode- should not be used. String variables can have embedded numeric characters. That's absolutely no reason against using -encode-. It may not help much but it is legal and a practical
possibility.
Otherwise, I think you need to look for substrings like "200 MG/ML" using -strpos()- (-index()- in old Stata versions). The string functions are
your friend here.
strpos(drug_1, "200 MG/ML")
will be positive if "200 MG/ML" is included and
zero otherwise.
-destring- is no use to you at all.
I don't understand what an "explore variable" is. Explanatory?
Nick n.j.cox@durham.ac.uk
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index