Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

Re: st: Listing var1 if var* equals X

From   Maarten Buis <>
Subject   Re: st: Listing var1 if var* equals X
Date   Tue, 31 Jan 2012 14:48:58 +0100

On Tue, Jan 31, 2012 at 2:32 PM, Lars Folkestad
<> wrote:
> i have my data in a wide format and have the following data
> Id hospital1 hospital2 hospital3 … hospitalN
> I would like to list the id if any of the hospital* equals a given code fx X2

list if inlist("X2", hospital1, hospital2, hospital3)

Also see -help inlist- and Nicholas J. Cox (2006) Stata tip 39: In a
list or out? In a range or out? The Stata Journal, 6(4):593-595.

Hope this helps,

Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen

*   For searches and help try:

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