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 at the end of May, and its replacement, statalist.org is already up and running.


[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 <tirthankar.chakravarty@gmail.com>
To   statalist@hsphsun2.harvard.edu
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 <nick.stata@gmail.com> 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index