Statalist The Stata Listserver


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

st: RE: string function


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: string function
Date   Wed, 8 Mar 2006 22:10:19 -0000

This is hard to do in an error-free way, 
at least without knowing more details. 

You can use -destring- with the -ignore()- 
option to get rid of alphabetic and punctuation
characters, but don't lose periods. 

Alternatively, if the number is always followed
by a space, as is good scientific practice, 
then what you want is just the numeric version of 
the first word. Look at -split-. 

Nick 
[email protected] 

Andy Choi
 
> I have a large file with patient's labs.  The lab
> variable contains the lab result (a number) with the
> units (for example mg/dl) included.  There are many
> variations to the way the units are reported: they may
> be capitalized or in parentheses or the units
> themselves may contain numbers. 
> 
> I would like to create a variable that includes only
> the lab result.  And if possible a separate variable
> with the units.

*
*   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