[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: difference from the mean
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.
+49 (030) 25491-361
* For searches and help try: