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
What kind of a binary regression model should I choose if I work with pool or panel data?Hello! I have a longitudinal dataset, which contains observations of individuals between 2008-2017.…
Combining a newly constructed dummy variables to one categorical variable for analysis/refcatDear Statalist, I have currently created four variables about family status: 1) Parents living toge…
Difference between quietly gen, quietly test and quietly regress?Hi guys, I'm trying to replicate a paper but could not understand the meaning of the following comma…
Margins for Interaction TermI have run the following regression and am trying to analyse whether the initial level of Income of …
Computing IPW estimator by handHello everyone, For my project, I try to know if a certain type of policy ("pol", which is a dummy)…
Subscribe to:
Post Comments (Atom)
0 Response to For-each loop to sum across groups of observation
Post a Comment