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: Creating a variable with a value conditional on other variables


From   Tirthankar Chakravarty <[email protected]>
To   [email protected]
Subject   Re: st: Creating a variable with a value conditional on other variables
Date   Sat, 9 Apr 2011 04:19:54 -0700

-jackknife- it:

*********************
sysuse auto, clear
jackknife r(mean), keep: su mpg
su mpg
li _jk_1 in 1/10
*********************

The variable you need is stored as "_jk_1".

T

On Sat, Apr 9, 2011 at 4:05 AM, Nick K <[email protected]> wrote:
> Hi,
>
> I'm new to Stata and am having a hard time figuring out a relatively
> simple problem. I'm experienced with other programming languages and
> SQL so pseudo code may get my point across more clearly.
>
> foreach(observation)
> {
>    variable Xi = average(Y) if A != Ai
> }
>
> Basically it would go over every observation and create a variable of
> the average of some other variable NOT INCLUDING the variable's value
> for the current row. So X is the average of Y for all observations
> EXCEPT the current one.
>
> Thanks
> *
> *   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/
>



-- 
To every ω-consistent recursive class κ of formulae there correspond
recursive class signs r, such that neither v Gen r nor Neg(v Gen r)
belongs to Flg(κ) (where v is the free variable of r).

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index