Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[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 <>
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).


On Tue, Feb 26, 2013 at 7:19 AM, James Bernard <> 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:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index