Statalist


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

Re: st:simple way to count how many variables' value is uner 10 for a case


From   Svend Juul <[email protected]>
To   <[email protected]>
Subject   Re: st:simple way to count how many variables' value is uner 10 for a case
Date   Mon, 16 Jun 2008 08:45:57 +0200

Man Jia wrote:

....

I want to find out for each case totally how many times the values for 
var1,var 2....var20 are under 10.

....

===============================================================

Hope this helps:

    generate sum_var=0
    foreach V of varlist var1-var20 {
       replace sum_var=sum_var+1 if `V'<10
    }

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:  [email protected]
__________________________________________ 

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index