Statalist


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

Re: st: Frequency distribution using multiple loops


From   n j cox <[email protected]>
To   n j cox <[email protected]>
Subject   Re: st: Frequency distribution using multiple loops
Date   Fri, 29 Jun 2007 15:50:50 +0100

Please ignore the residual ; in the middle.

n j cox wrote:

Hugh's code can be made more transparent.

I delimit with endlines and translate to -forval-
loops. Hugh can do this too unless he is using Stata <7,
in which case he should have told us, following Statalist
FAQ advice.

Each loop is, or should be, indented one tab.

forval i = 1/4 {
    forval j = 1/6 {
        forval k = 23/26 {
            forval l = 29/32 {
                count if q`k'==`i' & q`l'==`j';
                tab q`l' q`k';
            }
        }
    }
}

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