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

st: forvalues and scalar: easy question


From   [email protected]
To   [email protected]
Subject   st: forvalues and scalar: easy question
Date   Thu, 27 May 2004 12:48:20 +0200

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)

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




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