Bookmark and Share

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: How to put max and min values in a loop


From   Xixi Lin <[email protected]>
To   [email protected]
Subject   Re: st: How to put max and min values in a loop
Date   Wed, 27 Mar 2013 11:26:46 -0400

Thanks Nick,

The min and max are all I need.

Best,
Xixi Lin

On Wed, Mar 27, 2013 at 10:23 AM, Nick Cox <[email protected]> wrote:
> This is likely to be wrong for several reasons.
>
> -min()- and -max()- in this context can only be Stata functions and
> each requires two or more arguments. This is not quite explicit in the
> help.
>
> Also, even when legal, statements including -min()- or -max()- will
> only evaluate within observations.
>
> You assume that we know what you want to do, which is not true.
> However, we can guess that you want minimum and maximum of some
> variable, in which case -summarize- first will give you r(min) and
> r(max), which you can use within -inrange()-. -summarize, meanonly- is
> sufficient if min and max are all you need.
>
> But, but, but: it is vacuous that any variable lies between its
> minimum and maximum, so there is no point to doing this unless the
> calculation of -summarize- refers to something different, e.g. a
> different subset or a different variable.
>
> Nick
>
> On Wed, Mar 27, 2013 at 2:11 PM, Xixi Lin <[email protected]> wrote:
>
>> I am trying to use inlist(var, min(var), max(var)) in a loop; however,
>> min(var) and max(var) seems to be wrong codes, does anyone know how to
>> code it in a right way?
> *
> *   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/
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index