--- Nachbar, Dirk
> I want to run some regressions and have problems with the local and
> global variables. I think Stata doesn't like the forval loop. How should
> I refer to min and max?
>
> local max=999999999999999999
> sum avgunitprice if id==5, detail
> global min=r(p5)
> global max=r(p95)
> forval i= min min+(max-min)/100 to max {
<snip>
Have a look at -help macro- to see how you can refer to locals and
globals. If you want to refer to a global max you type $max, if you
want to refer to a local max you type `max'. Anyhow I would not put
computation inside a -forval- statement, so I would first create a
local with the minimum value and feed that into the -forval-
statement.
Hope this helps,
Maarten
-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands
visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434
+31 20 5986715
http://home.fsw.vu.nl/m.buis/
-----------------------------------------
*
* 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/