I have a panel data, it includes Stock ID (Stkcd), fiscal year (Year), Background of members (Funback) which includes directors and CEO, age of members (Age) and academic degree (Degree). The other two variables are dummies if they are directors (Indep) or CEO (isCEO).
Based on the panel data below, may you aid me to calculate the following variables?
1) I want to calculate a variable V1= is a dummy variable equals 1 if Funback of Indep includes any value of isCEO. For example, if isCEO contains 7,8,5 and Indep includes 8, V1=1
2) I want to calculate a variable V2= is a dummy variable equals 1 if Degree of Indep is the same as isCEO.
3) I want to calculate a variable V3= is a dummy variable equals 1 if Age of Indep is within 10 years of isCEO. In other words If the difference between the age of an Indep and the age of isCEO is within 10 years, the value is 1, otherwise the value is 0.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str10 Stkcd int Year str23 Funback str7(Age Degree) float(isCEO Indep) "000001" 2011 "7" "55" "4" 0 0 "000001" 2011 "7" "55" "3" 0 0 "000001" 2011 "7,8" "40" "4" 0 0 "000001" 2011 "7,8,2" "47" "5" 0 1 "000001" 2011 "7" "55" "" 1 0 "000001" 2011 "7,2" "64" "4" 0 1 "000001" 2011 "7,5" "58" "3" 0 1 "000001" 2011 "5,7" "37" "3" 0 0 "000001" 2011 "7,5" "62" "5" 0 1 "000001" 2011 "7,9" "47" "4" 0 1 "000001" 2011 "4,7,8" "49" "4" 0 0 "000001" 2011 "7,4,5" "62" "3" 0 1 "000001" 2011 "7,8,5" "50" "5" 0 1 "000001" 2011 "7,5" "56" "4" 0 0 "000001" 2011 "7,5" "53" "5" 0 0 "000001" 2011 "7,8,5" "52" "5" 0 0 "000001" 2011 "2,4,5,7,8" "63" "2" 0 0 "000001" 2011 "7,5" "60" "5" 0 1 "000001" 2012 "7,8,5" "53" "5" 0 0 "000001" 2012 "7,8" "41" "4" 0 0 "000001" 2012 "4,7,8" "50" "4" 0 0 "000001" 2012 "7" "56" "4" 0 0 "000001" 2012 "7,9" "48" "4" 0 1 "000001" 2012 "7,5" "61" "5" 0 1 "000001" 2012 "7,4,5" "63" "3" 0 1 "000001" 2012 "7,5" "54" "5" 0 0 "000001" 2012 "7,8,5" "51" "5" 0 1 "000001" 2012 "7,5" "59" "2" 0 0 "000001" 2012 "7,5" "63" "5" 0 1 "000001" 2012 "7,5" "59" "3" 0 1 "000001" 2012 "7" "55" "5" 1 0 "000001" 2012 "2,7,8" "48" "5" 0 1 "000001" 2012 "5,7" "38" "3" 0 0 "000001" 2012 "7" "56" "3" 0 0 "000001" 2012 "7,2" "65" "4" 0 1 "000001" 2012 "7,5" "57" "4" 0 0 "000001" 2013 "7,5" "55" "5" 0 0 "000001" 2013 "5,7" "58" "4" 0 0 "000001" 2013 "7" "57" "3" 0 0 "000001" 2013 "7" "57" "4" 0 0 "000001" 2013 "7,8,5" "54" "5" 0 0 "000001" 2013 "7,5" "60" "3" 0 1 "000001" 2013 "7,2" "66" "4" 0 1 "000001" 2013 "7,5" "64" "5" 0 1 "000001" 2013 "7" "56" "5" 1 0 "000001" 2013 "5,7" "39" "3" 0 0 "000001" 2013 "2,7,8" "49" "5" 0 1 "000001" 2013 "7,8" "42" "4" 0 0 "000001" 2013 "7,9" "49" "4" 0 1 "000001" 2013 "4,7,8" "51" "4" 0 0 "000001" 2013 "7,5" "60" "2" 0 0 "000001" 2013 "7,5" "62" "5" 0 1 "000001" 2013 "7,8,5" "52" "5" 0 1 "000001" 2013 "7,4,5" "64" "3" 0 1 "000001" 2014 "5,7" "63" "2" 0 1 "000001" 2014 "5,7,8" "55" "5" 0 0 "000001" 2014 "5,7" "61" "2" 0 0 "000001" 2014 "5,7" "61" "3" 0 1 "000001" 2014 "7,9" "59" "4" 0 1 "000001" 2014 "5,7,8" "43" "4" 0 0 "000001" 2014 "5,7,8" "58" "3" 0 0 "000001" 2014 "5,6,7" "59" "4" 0 0 "000001" 2014 "2,5,7,8" "50" "5" 0 1 "000001" 2014 "5,7" "57" "5" 1 0 "000001" 2014 "5,6,7" "51" "4" 0 0 "000001" 2014 "5,7" "37" "4" 0 0 "000001" 2014 "2,7" "62" "5" 0 1 "000001" 2014 "4,5,7,8" "52" "4" 0 0 "000001" 2014 "4,5,7" "40" "4" 0 0 "000001" 2015 "5,7,8" "44" "4" 0 0 "000001" 2015 "5,7" "58" "5" 1 0 "000001" 2015 "4,5,7,8" "41" "4" 0 0 "000001" 2015 "5,7" "62" "2" 0 0 "000001" 2015 "5,6,7" "52" "5" 0 0 "000001" 2015 "4,5,6,7,8" "53" "4" 0 0 "000001" 2015 "5,7,8" "59" "3" 0 0 "000001" 2015 "5,7" "38" "4" 0 0 "000001" 2015 "5,6,7" "60" "4" 0 0 "000001" 2015 "7,9" "60" "4" 0 1 "000001" 2015 "2,5,7,8" "51" "5" 0 1 "000001" 2015 "5,7" "62" "3" 0 1 "000001" 2015 "2,7" "63" "5" 0 1 "000001" 2015 "5,7,8" "64" "2" 0 1 "000001" 2016 "2,5,7" "64" "5" 0 1 "000001" 2016 "5,7,8" "45" "4" 0 0 "000001" 2016 "5,7" "39" "4" 0 0 "000001" 2016 "5,7,8" "65" "2" 0 1 "000001" 2016 "7" "48" "5" 0 1 "000001" 2016 "4,5,6,7" "48" "5" 0 0 "000001" 2016 "4,5,7,8" "42" "4" 0 0 "000001" 2016 "7,9" "61" "4" 0 1 "000001" 2016 "5,7,8" "60" "3" 0 0 "000001" 2016 "4,5,6,7,8" "54" "4" 0 0 "000001" 2016 "5,6,7" "53" "5" 0 0 "000001" 2017 "5,6,7" "53" "4" 0 0 "000001" 2017 "5,7,8" "61" "3" 0 0 "000001" 2017 "5,7,8" "49" "4" 0 1 "000001" 2017 "5,7,8" "46" "4" 0 0 "000001" 2017 "7,9" "62" "4" 0 1 "000001" 2017 "4,5,6,7,8" "55" "4" 1 0 end
Hope you help me in this, and thanks in advance.
0 Response to Calculating dummies based on other variables
Post a Comment