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
traffic accident analyze by logistic regression or binomial regression with didhi everyone, I want to use annual road traffic accident data for analysis. Since the people who caus…
Error r(900) - no room to add variables, up to 2048 variables are allowed, but I'm only using 340 variablesHello, I'm trying to add 9 variables (w_racel) for each wave of data (waves a to i) to a large data…
Time-series regression loop (approximately 250 regressions) and saving their coefficientsHi all, I've performed a time-series regression loop by using the following code (approximately 250…
Loops within loopsDear everyone, I have trouble when create a loop to generate a new variable for my dataset. My data…
dummy variable in the two-way fixed effect modelI want to regress two-way fixed effect model with dummy variable using difference . the model look l…
Subscribe to:
Post Comments (Atom)
0 Response to For-each loop to sum across groups of observation
Post a Comment