Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Counter [was: various digressive and meandering threads]


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: Counter [was: various digressive and meandering threads]
Date   Thu, 30 Oct 2008 13:49:20 -0000

A counter is implemented like this:  

1. Initialisation before code that loops 

	local count = 0 

2. Incrementation within code that loops 

	local count = `count' + 1 

OR 

	local ++count 

3. Display when you want it -- _either_ within the loop _or_ after it, depending on what 
you want. 

	di `count' 

OR 

	di "optional text " `count' 

Nick 
[email protected] 

Katia Bobulova

could you please explain me how to put a counter? If it is not too
complicated of course.


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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