Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: AW: Extract parts of a string variable


From   "Seliger Florian" <seliger@kof.ethz.ch>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
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: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Kuma Raj
Gesendet: Montag, 5. November 2012 12:05
An: statalist@hsphsun2.harvard.edu
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index