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

Re: st: destring with embedded blanks


From   "Neil Shephard" <[email protected]>
To   [email protected]
Subject   Re: st: destring with embedded blanks
Date   Thu, 03 Mar 2005 14:20:24 +0100

> Dear list members,
> Could someone help me with converting string variables
> with embedded  blanks.
> 
>  Let say I have:
>  ID
>  1 02 16
>  1121 16
> 
>  Where ID is a string variable and I want to convert
>  it  in numeric.  How do I proceed?

Perhaps something like the following....

gen new_id = real(subinstr(ID, " ","", . )

HTH's

Neil
Neil Shephard
Genetics Statistician
ARC Epidemiology Unit, University of Manchester
[email protected]
[email protected]

"If your result needs a statistician then you should design a better experiment" - 
Ernest Rutherford

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