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

Re: st: using postfile in a loops

From   Maarten buis <[email protected]>
To   stata list <[email protected]>
Subject   Re: st: using postfile in a loops
Date   Mon, 9 Nov 2009 15:20:22 -0800 (PST)

--- Kushan Thakkar wrote:
> When I am using r-class results (such as r(max) ) is there a
> way to store this value into a constant variable and then use
> that variable instead ?

You can store a number either in a local macro or in a scalar.
The difference is that numbers are stored more precisely in
scalars. Storing a constant in a variable is bad style: it 
wastes a lot of memory.

*--------- begin example ------------
sysuse auto, clear
sum mpg
local max = r(max)
di `max'

tempname scmax
scalar `scmax' = r(max)
di `scmax'
*-------- end example ---------------

Hope this helps,

Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen


*   For searches and help try:

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