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   <>
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

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 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

*   For searches and help try:

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