Statalist


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

Re: st: using postfile in a loops


From   Maarten buis <maartenbuis@yahoo.co.uk>
To   stata list <statalist@hsphsun2.harvard.edu>
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

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

http://www.maartenbuis.nl
--------------------------


      

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index