Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: Generating (simple) spatial variables (excluding the country of observation)

 From Waedlich Felix To statalist@hsphsun2.harvard.edu Subject st: Generating (simple) spatial variables (excluding the country of observation) Date Wed, 23 Feb 2011 21:49:11 +0100

```Hey Statalisters,

I have a panel data set with 140 countries over a time period if 28 years and I want to analyze determinants of capital regulation.

I want to estimate to what extent the level of regulation is influenced by the observable levels in specific reference groups (cultural, regional, etc.) Therefore I planned to generate variables based on the average restrictivness in these groups, which I will use as explanatory variable for my regression.
Practically i have a dependent variable (capital) and several dummy variables which are supposed to serve as a filter to generate specific regulation averages for each country and year. I.e. all European countries like Belgium, France, etc. will look at the same level of restrictivness in 1978.
Since, I am rather unexperienced with Stata, I could only came up with this egen code:

. bysort year: egen mean_capital=mean(capital)

So it looks like this:

+---------------------------------+
| mean_capital         country   year |
|---------------------------------|
1. | 3.848485   UNITED STATES   1978 |
2. | 3.825243   UNITED STATES   1979 |
3. | 3.847619   UNITED STATES   1980 |
4. | 3.839623   UNITED STATES   1981 |
29. | 3.848485          CANADA   1978 |
30. | 3.825243          CANADA   1979 |
31. | 3.847619          CANADA   1980 |
32. | 3.839623          CANADA   1981 |

Theoretically, I need to generate this variable excluding the regulation level of the country I am observing. Meaning if there are four countries in one region, each country will only weigh in the level of regulation of the other 3 countries, but not his own regulation level.

Does anybody has a clue?

Best regards,
Felix

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