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)
Problem with displaced coefficients using -coefplot-Dear Statalisters, I want to plot regression coefficients using the Stata journal command -coefplot-…
Danish MP's political responsiveness - help with statistical significanceHello everyone Me and a fellow student are currently working on an assignment investigating politic…
sample size for test accuracyIs there a preferred method for estimating the required sample size for testing the accuracy of a go…
How to view the SE of autocorrelation in xtregarI'm estimating a model using xtregar, fe. The results include an estimate of rho (rho_ar), but I can…
Stata Command "myqreg2" exists?I found a do file online where a very renowned economist used "myqreg2" command while estimating qua…
Subscribe to:
Post Comments (Atom)
0 Response to Sum of a variable over all observations except one (loop)
Post a Comment