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
Number of firms by different countriesHi STATA experts, I am try to generate a descriptive statistics table that showing the number of fi…
ArdlHello everyone, I would like to know in which case we use the ARDL model? Is there a difference betw…
model with endogenous dichotomous predictor of continuous dependent variableWhich Stata (v15.1) command should I use to estimate the following linear model: y = b0 + b1z + b2x…
cox proportional hazard ratio with time varying covariateDear Stata community, I am struggling with cox proportional hazard ratio. I was wondering if you c…
Stata 15 v 16 for latent class analysis (aka profile analysis)I want to identify discrete personality profiles for parenting styles. For example: I have 5 persona…
Subscribe to:
Post Comments (Atom)
0 Response to Generating variable based on two groups
Post a Comment