Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: alt to inlist?

From   Danielle H Ferry <>
Subject   Re: st: alt to inlist?
Date   Mon, 23 Jan 2006 18:06:05 -0500

Nick, Joseph - Thank you for your helpful comments. I stupidly did not put quotes around my strings. So that is why it was barking at me that they didn't exist. The suggestion below is good - I will try this.

As for whether there is a better way to do what I want ... probably. I welcome any suggestions: I am reading in several datasets, each containing different economic series at the metropolitan level, but I want to keep data for only the top X metro areas. Metro areas are defined differently for different series' (i.e., Los Angeles could be represented as LAS or LAX depending on whether we are talking about MSA or CMSA). Rather than figure out which datasets use which definition for each metro area, I want it to be flexible - keep if msa==LAS | msa==LAX (except that I have a list of about 145 MSA names is list). Is there a better way of doing this?

Danielle H Ferry

On Jan 23, 2006, at 5:39 PM, Joseph Coveney wrote:

You can use multiple instances
of -inlist()-:

keep if inlist(Z, a, b, c, d, e, f, g, h, i, k) | ///
 inlist(z, l, m, n, o, p, q, r, s, t, u) | ///
 inlist(z, . . . .)
*   For searches and help try:

© Copyright 1996–2021 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index