Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: assigning the value of a function to a amcro
From 
 
Nick Cox <[email protected]> 
To 
 
[email protected] 
Subject 
 
Re: st: assigning the value of a function to a amcro 
Date 
 
Tue, 26 Feb 2013 07:39:21 +0000 
I can't comment on your invisible case, but here is an example:
local bigger = max(7, 42)
di `bigger'
If your case involves one or more variables, then it can't be done,
except like this
tempvar bigger
gen `bigger' = max(42, somevar)
This is not really an exception, as the macro is holding the name of a
variable holding a maximum in each observation, not holding those
maximums (maxima).
Nick
On Tue, Feb 26, 2013 at 7:19 AM, James Bernard <[email protected]> wrote:
> I am trying to use the max()function and assign the outcome of the
> this to a a macro. But it seems impossible, no matter how I write it.
> I recall that, in general, macros can receive value of a function, but
> it just doesn't work in this case.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/