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

st: Re: Loop syntax

From   Janet Hill <>
Subject   st: Re: Loop syntax
Date   Wed, 26 Mar 2008 15:49:44 +0000 (GMT)

I have some results on 236 patients and each patient has 57 recordings stored in a single variable t. I am trying to count how many of these patients have a score of t>0. I tried the following code:

gen tcount=0
forvalues i=1/236{
    forvalues j=1/57{
    if patient==`i' & t>0 {
    then tcount==tcount+1 

but the value of tcount never changes from 0.

Could somebody please explain the correct syntax.

Rise to the challenge for Sport Relief with Yahoo! For Good

*   For searches and help try:

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