Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: forvalues and scalar: easy question


From   "Surajit Das" <[email protected]>
To   [email protected]
Subject   Re: st: forvalues and scalar: easy question
Date   Thu, 27 May 2004 16:45:43 +0530

On Thu, 27 May 2004 12:48:20 +0200, [email protected] said:
> 
> 
> 
> 
> 
> Dear StataListers,
> 
> 
> since I have already disturbed a colleague who could not help me out I am
> going to confront you with my small problem:
> I want Stata to run a loop from 1 to the maximum of observations in my
> dataset.
> I tried:
> 
> gen obs2 = _n
> 
> sum obs2
> 


> scalar m = r(max)


local m = _N


> 
> forvalues i=1/`m'{
> ....
> }
> 
> 
> Which did not work. There is probably a very easy way to do that but I
> just
> do not know it.
> 
> Any suggestions are greatly appreciated.
> 
> 
> Yours,
> 
> Justina Fischer
> 
> 
> Dipl.Vw. Justina A.V. Fischer,
> Research Associate
> SIAW - University of St. Gallen
> Bodanstr. 8
> CH-9000 St. Gallen
> Tel.:++41-71-224 2345
> Fax: ++41-71-224 2298
> www.siaw.unisg.ch

-- 
http://www.fastmail.fm - Email service worth paying for. Try it for free
*
*   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