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
Estimating ARDL with Structural Break Hi.... My data is stored in a panel data format. I want to estimate the ARDL with a structural brea…
Compare similarity of structure (percentage distribution) for one conditionHello guys, I hope someone here can help me with my stata problem. I want to find out if the structu…
Compare betas of two different models while using asdoc and reghefe Code: asdoc reghdfe pm rc l.pm interaction1 l.asse /// l.lev if dummy ==0, absorb(cc industry_year_…
stack/unstack?Dear All, Suppose that I use -stack- command in the following. Code: webuse stackxmpl, clear . li…
Multiple "lincoms" after "margins" with "at"?Goal: I want to subtract the results of "margins" from a constant. My approach: Use margins with "a…
Subscribe to:
Post Comments (Atom)
0 Response to Creating a new dummy based on 4 conditions
Post a Comment