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/