Bookmark and Share

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: AW: Extract parts of a string variable


From   "Seliger Florian" <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: AW: Extract parts of a string variable
Date   Mon, 5 Nov 2012 11:10:51 +0000

I suggest reading through the folling FAQs:

http://www.ats.ucla.edu/stat/stata/faq/regex.htm

Then: trial and error.

Good luck.

Florian



-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]] Im Auftrag von Kuma Raj
Gesendet: Montag, 5. November 2012 12:05
An: [email protected]
Betreff: st: Extract parts of a string variable

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/

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


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index