Dear all,
Let's suppose I have a variable displaying the amount of input in a given industry for each country: X_AUSTRALIA, ..., X_JAPAN, ..., X_USA, etc.
My goal is to create a new variable for each country which would be the sum of X excluding the country I am interested in. For instance, for Australia, I want the sum of X over all countries except Australia, and so on for each country.
Ideally, I would like to do that in a loop since I have a lot of countries. I have already created a global containing all the countries.
Anyone has an idea about how to produce theses variables within a loop ? That would be very appreciated. Thank you.
Related Posts with Sum of a variable over all observations except one (loop)
Computing confidence intervals for meta-analysisHi there, I am currently attempting to run a meta-analysis on the effects of debt on economic growt…
Reshape LongDear all, I am using this code to reshape data. It does reshape but the date order of the original …
Only keep newest observationsHey everyone, Code: * Example generated by -dataex-. To install: ssc install dataex clear input lo…
2SLS using "ivreg2 , first" command (where is reduced form esitmates?)Dear STATA Intellectuals, I am estimating the causal effect of mothers' education on children's hea…
Help to correctly reduce instrument count with xtabond2 commandHello everyone, I am estimating a model where my dependent variable is economic growth and all my i…
Subscribe to:
Post Comments (Atom)
0 Response to Sum of a variable over all observations except one (loop)
Post a Comment