Hello everyone!
We are stuck with a problem creating a new dummy variable from a data with many dummy variables. Our dataset is taken from CEPII and there, trade statistics of many countries is saved. What we want to create is a dummy variable in which there is =1 when EU countries trade with South Africa, and when South Africa trade with EU countries.
The four conditions that we want to include from our dataset is when following variables are =1:
EU_o =1
EU_d =1
ZAF_o =1
ZAF_d =1
The idea here is to exclude all other countries from this dummy variable. We have tried by doing: gen ZAFFTA_n= 1 if ID1 == 87 & EU_o == 1 & id3 == 189 & EU_d == 1
and by trying to make it individually by gen onlyEU=1 if EU_o==1 & id3==189.
In these cases, no changes are made. Is it possible to do this based on these conditions?
Thank you very much,
best regards
Related Posts with Creating a new dummy based on 4 conditions
Calculate shares by variable and a conditionHi Stata Users, I have household data and would like to calculate age specific enrollment rates i.e…
Stata 17 - how to get forest plots with risk ratio and not log risk ratioHi I am new to Stata 17 meta analysis forest plots. I am analysing binary data for treatment(Yes/No)…
reshaping long-long (?) data (all variables and observations in the single column)Dear all, I have data from the IEA that looks like this: Code: * Example generated by -dataex-. To…
Plotting the slopeGood day Statalisters! Is there a command in Stata where I can plot a curve using the lower bound a…
Regression with propensity scoreDear all I am trying to estimates the dynamic treatment effect while using propensity scores. I woul…
Subscribe to:
Post Comments (Atom)
0 Response to Creating a new dummy based on 4 conditions
Post a Comment