Statalist The Stata Listserver


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

Re: st: two STATA questions


From   "Svend Juul" <SJ@SOCI.AU.DK>
To   <statalist@hsphsun2.harvard.edu>
Subject   Re: st: two STATA questions
Date   Tue, 27 Feb 2007 14:04:07 +0100

Ni Frank wrote:

1) There are 50 varialbes, w05100, w05200,....,w10000. We want to DROP
those obversations for which at least one of the above variables takes
value of 0.

2) Now, if we want to KEEP those obersvations for which at least one of
the variables w05100, w05200, ....,w09900 takes value of 0. How to do
that? 
-----------------------------------------------------------

Nick Cox gave a suggestion and some comments. Here is another
suggestion. I assume that the variables w05000-w10000 are in sequence in
the dataset (no intervening variables):

   egen x=anymatch(w05100-w10000) , values(0)
   drop if x==1

and (2):

   keep if x==1

Svend
__________________________________________

Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000  Aarhus C, Denmark
Phone: +45 8942 6090
Home:  +45 8693 7796
Email: sj@soci.au.dk
__________________________________________ 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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