Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: How to get rid of leading and trailing letters and symbols?
From
Ekaterina Hertog <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: How to get rid of leading and trailing letters and symbols?
Date
Wed, 26 Oct 2011 10:37:29 +0100
Dear All,
I have got a dataset where the id variable is a part of a web-link. It
can contain letters followed by the id number: (e.g.
/profile/?id=9596986) or it can contain the id number in the middle
(e.g. /profile/?id=9591886&reftype=detail). I need to create a variable
which will only contain the number that is part of the id variable. I
also need to be able to distinguish between the cases where the number
is trailing vs. cases where it is in the middle. I looked at the advice
available on removing leading or trailing 0s in Stata 11
(http://www.stata.com/support/faqs/data/leadingzeros.html), but in my
case I cannot actually specify the letters and symbols that lead or
trail so I am stuck. I use Stata 11.
Any advice will be very much appreciated,
Ekaterina
*
* 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/