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]

Re: st: Listing var1 if var* equals X


From   Lars Folkestad <lfolkestad@health.sdu.dk>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Listing var1 if var* equals X
Date   Tue, 31 Jan 2012 14:51:59 +0100

Thank you Maarten
This helps, but i have 147 hospitals.
Is it possible without having to write them all down?
lars

Den 31/01/12 14.48 skrev "Maarten Buis" <maartenlbuis@gmail.com>:

>On Tue, Jan 31, 2012 at 2:32 PM, Lars Folkestad
><lfolkestad@health.sdu.dk> 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.
><http://www.stata-journal.com/article.html?article=dm0026>
>
>Hope this helps,
>Maarten
>
>--------------------------
>Maarten L. Buis
>Institut fuer Soziologie
>Universitaet Tuebingen
>Wilhelmstrasse 36
>72074 Tuebingen
>Germany
>
>
>http://www.maartenbuis.nl
>--------------------------
>
>*
>*   For searches and help try:
>*   http://www.stata.com/help.cgi?search
>*   http://www.stata.com/support/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/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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