gen dummy = 0
foreach v of var a b c d e f {
replace dummy = dummy + (`v' != 0)
}
replace dummy = dummy >= 5
Alternatively, with -egenmore- installed
egen dummy = rcount(a b c d e f), cond(@ != 0)
replace dummy = dummy >= 5
Nick
[email protected]
R.E. De Hoyos
> how can I create a dummy=1 when at least 5 out of 6 variables
> are different from zero?
*
* 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/