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, is already up and running.

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

st: Using regex to identify strings with capital letters

From   "Beecroft, Erik (VDSS)" <>
To   <>
Subject   st: Using regex to identify strings with capital letters
Date   Wed, 26 May 2010 14:03:23 -0400

I need to extract certain observations from a series of text files.
Each file contains only one variable, which is string.  The
observations I want all begin with two capital letters. (They are state
abbreviations, such as VA or AK).  The other observations do not begin
with two capital letters.

Is there a way to tell Stata to keep only observations for which the
variable begins with two capital letters?

It seems like the regex function might work, but I have never worked
with regular expression syntax before.  

For example, a portion of a text file might look like:
	VA department of Social Services

I want to keep only the third observation above.

I am using Stata for Windows 10.1.


*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index