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)
how to use regexm to analyse string variablesDear All Can anyone help me in finding an easier way to categories open ended questions. an examp…
Creating summary statistic tables with multiple variables with multiple super-columns.Hi all, I am trying to replicate the results of a paper, and I am having trouble creating nicely fo…
Difference between the two options under model two tab for three stage least squares?In stata after going to statistics-->endogenous covariates ---> Three stage least squares and …
Sample size calculation using one sided test with power commandHello all, I am trying to run a test to determine the sample size where the outcome is proportions …
Cut name variable into two variables to get casteHello I am trying to segregate the name variable into two separate name and caste variables. (The s…
Subscribe to:
Post Comments (Atom)
0 Response to Sum of a variable over all observations except one (loop)
Post a Comment