Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: local .... if


From   Edwin Leuven <[email protected]>
To   [email protected]
Subject   Re: st: local .... if
Date   Fri, 26 Mar 2004 16:45:09 +0100 (CET)

why not

sum x if id==124, mean
local val = r(mean)

?

On Fri, 26 Mar 2004, Lars Korsholm wrote:

> Hi
> 
> Can anyone help me with the following
> what I would like to do is something like
> local val= x if id==124
> 
> I know one dirty way:
> preserve
>  keep if id==124
>  local val=x
> restore
> 
> but that do not seem efficient :-)
> can anyone do this more elegantly?
> 
> best
> 
> 
> 
> ..............................................
> : Lars Korsholm Ph.D.,                       :
> :  Department of Statistics                  :
> :  University of Southern Denmark            :
> :  Sdr. Boulevard 23A, 2.                    :
> :  DK-5000 Odense C                          :
> : Phone +45 6550 3608 (or 3868)              :
> : Mobil +45 3033 3617                        :
> : Fax   +45 6595 7766                        :
> : Mail  [email protected]                 :
> : Web   http://www.biostat.sdu.dk/~korsholm  :
> :............................................:
> 
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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