I need a dummy variable that = 1 based on other observations of my dataset.
I find the following quite puzzling. Maybe one of you has got a solution. I'll try to explain my problem in the best way I can.
I am handling panel trade data between countries (location_num and partner_num in the dataset). I am interested in trade agreements, advanced economies and especially the effect of trade agreements with advanced economies and their effect of trade with third party countries
Please have a look of the following randomized extract of my data:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int(location_num partner_num) float dyad int year float(export_sum_all agreement_dummy location_is_AdvEcon partner_is_AdvEcon) 699 40 39320 1991 115443576 0 0 1 270 56 16372 1997 124999608 1 0 1 124 76 7471 2012 2702917376 0 1 0 530 156 30277 2001 0 0 0 0 188 191 10759 1994 1315904 0 0 0 340 222 19525 1994 45927740 1 0 0 52 233 3395 1995 0 0 0 1 96 324 5955 1994 0 0 0 0 780 360 44046 2015 450157 1 0 0 729 372 41633 1994 293507 1 0 1 144 470 8381 1997 312149 0 0 1 800 480 45480 2013 385009 1 0 0 410 496 23390 2009 166885136 0 1 0 894 499 48991 2010 8240 0 0 0 360 591 20533 2009 70991584 0 0 0 642 600 36223 1990 294368 0 0 0 643 612 36466 2007 0 0 0 0 659 634 37106 2014 0 0 0 0 196 686 11589 2008 270175 0 1 0 842 705 47046 2017 371594240 0 1 1 120 724 7412 1990 299151552 0 0 1 381 740 21669 2013 190907104 1 1 0 562 768 31943 2006 0 1 0 0 392 780 22370 2008 321409088 0 1 0 156 800 9091 1993 6234550 0 0 0 152 862 8875 1992 69856416 1 0 0 56 882 3795 1997 385275 1 1 0 620 891 35388 2005 1759203 0 1 0 450 894 25991 2000 0 1 0 0 152 894 8881 2016 1317956 0 0 0 end
Two dummies because I need to check separately for location_num and partner_num.
Was I able to make clear what I need? Do you have any ideas or need more precise information?
I don't know if the random data extract makes so much sense in that case. I could build an easier example dataset if that helps.
Thank you so much!
Johannes
0 Response to Generate dummy = 1 based on other observations
Post a Comment