Dear All,
I have a dataset structured as follows. It is actually an Input Output (IO) matrix. So you have flows from country-sectors on the observation side and each variable represent the sector from which the inputs are actually taken in that given sector. So basically there are a lot of countries named with the three letter names (e.g. AUS for Australia and so on) and for each one 56 sectors at the NACE 2 level. I have already collapsed observations to sum them up at the NACE 1 and as you can see i have 10 sectors for each country. I want to do the same with variables. So it should be something like generating a new variable called "name_of_the_country"_A which is the sum of "name_of_the_country"1,2,3; a variable called "name_of_the_country"_B which is the sum of "name_of_the_country"4; a variable called "name_of_the_country"_C which is the sum of "name_of_the_country"5 to 19; and so on, so that i can have country and sectors at the NACE 1 level also on the variable side.
What is the best way to achieve this. Thank you all for the help.
**dataset attached Array
Related Posts with For-each loop to sum across groups of observation
Different time series within the same variable.I have been having an issue graphing one of my variables in a time series database. My data set cont…
How to create a loop to select 2 variables from a list?Hello! I would like to create a loop that allows me to select all the possible combinations of 2 va…
Embedding asdoc tables in putdocxHi everyone, I am trying to produce publication-style tables in a dynamic word document. For my cas…
How to do Summations?Hello, I'm very new to stata and am having trouble figuring this out. If have have 2 variable lists,…
Copying Variable Names That Are Missing within a RangeHi, all. I have dataset where country names (variable: Country) are missing rather randomly. I have…
Subscribe to:
Post Comments (Atom)
0 Response to For-each loop to sum across groups of observation
Post a Comment