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)
Missing values, but no gaps in the dataDear All, I have the following data: Code: * Example generated by -dataex-. To install: ssc inst…
Why logit regression and marginal effects can't generate the same z-statistics?Dear Stata experts, I've run logit regression and its marginal effect at follow. However, they shou…
Interaction between categorical and continous variable - MNLDear Stata users, I would like to generate interactions between categorical and continuous variable…
How to find best similar variables using overlaid graph or histograms or else?I have 51 variables containing 6,120 values of each variable. For example, resid1, resid2, ... resid…
SFA Trans log fuctional formHello everyone. I am doing some technical efficiency analysis using cross-sectional data.Am looking …
Subscribe to:
Post Comments (Atom)
0 Response to Sum of a variable over all observations except one (loop)
Post a Comment