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: Manipulations within a panel data set.
From 
 
Nick Cox <[email protected]> 
To 
 
"[email protected]" <[email protected]> 
Subject 
 
Re: st: Manipulations within a panel data set. 
Date 
 
Sat, 27 Jul 2013 09:29:41 +0100 
Yes. In principle
gen relative_income = income / income[wheretolook]
is sufficient here, where -wheretolook- is a variable -- or more
generally a placeholder for an expression -- ndicating the subscript
of the observation corresponding to each observation you want divided.
Nick
[email protected]
On 27 July 2013 03:48, George Shoukry <[email protected]> wrote:
> Hello,
>
> Say I have a panel data set with n individuals and income is one of
> the regressors. I have two indices: i,j in {1,...,n} and I would like
> to set the income of person i to be the income of person i divided by
> the income of person j, and leave everything else unchanged. Is there
> a simple way to do that?
>
> Also, I will have to do this for all individuals, but they will all be
> divided by different j's. If I have a list of the j's for i in
> {1,...,n}, is there a quick way to do what I described above in Stata
> without a for loop?
>
> Thanks!
> *
> *   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/