Hello,
I'm working with a dataset from Comtrade, which include information about import, export and their respective trade values for 3 different countries: Italy, Belgium and Israel.
The data looks like this:
tradeflow | reporter | partner | tradevalues
import | belgium | israel | 1891976735
export | belgium | israel | 2663650495
import | belgium | italy | 14696719360
export | belgium | italy | 21122317754
import | italy | belgium | 20047180815
export | italy | belgium | 15239360972
import | italy | israel | 927106045
export | italy | israel | 2942813832
Based on this, I'd like to generate a variable which shows the sum of import and export tradevalues by each combination of countries. For example, a variable which shows the sum of tradevalues for Belgium and Israel in the first two rows (say, 1891976735+2663650495) . Then, another sum for Belgium and Italy in the row 3 and row 4 (14696719360+21122317754).
Again, the idea is to generate a variable which shows import+export for each combination of reporter and partner.
Thanks!
Related Posts with Generating variable based on two groups
Multiple regression analysis bachelor thesis HelpDear Stata experts, I currently am writing my bachelor thesis regarding the topic International Joi…
summarize variable by group with max and min valuesHi, How can I summarize a variable by group including maximum and minimum value? This only calcula…
Exponentially Weighted Moving Average (EWMA) Control ChartHi Statalisters I was wondering if anyone can share example codes for graphing Exponentially Weight…
Panel data analysisHi evryone. What is wrong in may data? I cannot do xtpcse analysis. Please HELP!!!. …
Average marginal effects of the structural model using gsemHello everybody! Currently, I am fitting a structural equation model using gsem in Stata 16. My c…
Subscribe to:
Post Comments (Atom)
0 Response to Generating variable based on two groups
Post a Comment