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
twoway bar option over() not allowedHello, I am trying to combine a clustered-type bar chart with a scatter plot (I know it's an odd co…
Display gamma distribution and normal curve on a histogramHello all, I am trying to create a twoway bar that will display the mean temperature per month for …
The first stage outcome estimated by "ivreg2 savefirst" different from its OLS estimationI use two specifications to estimate the first stage for the relationship between the endogenous var…
Replace the value of one variable with the value of different variableHi all, I am trying to code used to replace values of one variable with other values from different…
nested logit - all constraints invalid messageHi I am reposting this because i did not get any replies before. I am trying to model migration wi…
Subscribe to:
Post Comments (Atom)
0 Response to Creating a new dummy based on 4 conditions
Post a Comment