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

Re: st: difference from the mean


From   Ulrich Kohler <[email protected]>
To   [email protected]
Subject   Re: st: difference from the mean
Date   Tue, 7 Dec 2004 09:10:59 +0100

Naceur Khraief wrote:
> First, I have a variable x_i for each six country (i = 1,...,6) and I want
> to calculate the difference x_i - xbar_i. Or the xbar_i  is the mean of the
> variable of x_i for each country. Did you have an idea about the command
> that I should do? 

. by country, sort: egen xbar = mean(xi)
. gen xi_c  = xi - xbar

In addition Ben Jann's -center- from SSC is useful for tasks like this.

many regards
uli


-- 
[email protected]
+49 (030) 25491-361


*
*   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