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

From |
Phil Schumm <pschumm@uchicago.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Extracting Numbers from Strings |

Date |
Wed, 24 Dec 2008 13:57:44 -0600 |

On Dec 24, 2008, at 1:24 PM, jasonm@ucla.edu wrote:

I'm trying to extract the first number after a hyphen. For example,from x="1234-1" I want to create y=1.

gen y = regexs(1) if regexm(x,".*-([0-9]+)")

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

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

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