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: Extract parts of a string variable
From
Kuma Raj <[email protected]>
To
[email protected]
Subject
st: Extract parts of a string variable
Date
Mon, 5 Nov 2012 12:05:23 +0100
I have a messy string variable that contains names of various air
pollutants. The contents and naming is based on the name of the
pollutant, lags, station name,
and different exposure metrics. There is no uniformity or fixed
position of the contents in the variable name. I am interested to
parse the variable and extract the names of the pollutants if they are
specific strings. How can I do that ?
A sample of the variable is found below and I am interested to extract
the following strings:- co, no2, nox, o3, pm10, and pm25
L1comeanH10
L1comeanS10
no2T10
L1no2T10
L1noxT10
L1o3maxA10
comeanS10_01
L3o3maxM10
L1o3meanM10
L1o3maxT10
L2pm10T10
L1pm25T10
Thanks in advance
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/