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
Heat maps according to datesDear friends, I am interested in build the attached graph. I was exploring in stata with several com…
query about stata codeHello, I would like to confirm whether I generate a variable in a proper way. The definition is as f…
xtaond2Hello, Would someone please tell me why the estimation results of the following two xtabond2 comman…
Fixed Effects Model with Time Invariant Independent VariablesI am working with a panel data set in Stata 16.1 that has 14,690 observations and 19 variables. I am…
Two - step dynamic panel GMM estimator weight Matrix returning blank value after Mata loopHey guys, I am running a two-step joint dynamic panel GMM estimator on Mata, with the stacked formu…
Subscribe to:
Post Comments (Atom)
0 Response to Creating a new dummy based on 4 conditions
Post a Comment