[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Richard Goldstein <richgold@ix.netcom.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Extracting Numbers from Strings |

Date |
Wed, 24 Dec 2008 14:54:44 -0500 |

Rich Robert A Yaffee wrote:

Jason, gen y = substr(x,1,1) destring y, replace should do it. Robert Robert A. Yaffee, Ph.D. Research Professor Silver School of Social Work New York University Biosketch: http://homepages.nyu.edu/~ray1/Biosketch2008.pdf CV: http://homepages.nyu.edu/~ray1/vita.pdf ----- Original Message ----- From: jasonm@ucla.edu Date: Wednesday, December 24, 2008 2:27 pm Subject: st: Extracting Numbers from Strings To: "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>I'm trying to extract the first number after a hyphen. For example, from x="1234-1" I want to create y=1. Thanks.

* * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: Extracting Numbers from Strings***From:*jasonm@ucla.edu

**Re: st: Extracting Numbers from Strings***From:*Robert A Yaffee <bob.yaffee@nyu.edu>

- Prev by Date:
**Re: st: Extracting Numbers from Strings** - Next by Date:
**Re: st: data management - string function** - Previous by thread:
**Re: st: Extracting Numbers from Strings** - Next by thread:
**Re: st: Extracting Numbers from Strings** - Index(es):

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