Hi all,
I have a panel data set and for variable Title I want to keep certain observations and remove the other ones. I used the following code:
keep if Title == "CEO, President & Chairman of the Board" | Title == "President, CEO & Director" | Title == "CEO, President & Director" | Title == "Chairman,President & CEO" | Title == "CEO & Director"| Title == "President, CEO & Non-Independent Director"|Title == "Chairman & CEO" | Title == "Chairman, CEO & President" | Title == "Co-Founder, Chairman, CEO & Secretary"| Title == "President, CEO & Chairman" | Title == "Chairman of the Board, President & CEO" |Title == "Chairman of the Board & CEO" | Title == "CEO, President, Director, CEO of Manitowoc Cranes and President of Manitowoc Cranes" | Title == "Executive Chairman & CEO" | Title == "CEO & Chairman of the Board"| Title == "Chairman, CEO, President & Member of Scientific Advisory Committee" | Title == "Chairman & CEO (Leave of Absence)" | Title == "Chief Executive Officer, President and Director" | Title == "CEO, President & Executive Director" | Title == "Founder, Chairman of the Board, President & CEO" | Title == "President, CEO,Member of National First Executive Advisory Board & Director" | Title == "Co-Founder, CEO, President & Director"|Title == "Chief Executive Officer and Director" | Title == "Founder, President, CEO & Chairman of the Board of Directors" | Title == "Founder, Chairman, CEO & President" | Title == "President, CEO, COO & Director" | Title == "ChiefExecutive Officer, President and Director" | Title == "President, Chief Executive Officer & Director" | Title == "ChiefExecutive Officer, President and Executive Director" | Title == "Chairman of the Board, Chief Executive Officer and President" | Title == "Co-Founder, Chairman & Co-CEO" | Title == "CEO,President, CFO & Director" | Title == "Co-Founder, Chairman, President & CEO" | Title == "CEO & Executive Director" | Title == "Chairman, Chief Executive Officer and Chairman of Executive Council" | Title =="Founder, President, CEO & Chairman of the Board" | Title == "Chairman and Chief Executive Officer" | Title == "Co-Founder, CEO, Chairman & President" |Title == "President, CEO & Executive Director" | Title == "Chairman, Chief Executive Officer and President" | Title == "Chairman of the Board of Directors, Co-Founder & CEO" | Title == "Founder, Executive Chairman, President & CEO" | Title == "Co-Founder, CEO & Director" | Title == "Interim CEO, CFO, Senior VP & Director" | Title == "Chief ExecutiveOfficer, President and Director" | Title == "Founder, Chairman, President & CEO" | Title == "Founder, President, CEO & Director" | Title == "Chief Executive Officer & Director" | Title == "Founder, Chairman & CEO" | Title == "Chairman of the Board, CEO & President" | Title == "Co-Founder, Chairman, CEO & President" | Title == "Chairman, Interim Chief Executive Officer and Interim President" | Title == "Founder, Chairman and Chief Executive Officer" | Title == "Executive Chairman and Chief Executive Officer" | Title == "Chief Executive Officer, President, Director, Interim President of Harsco Rail Group and Interim President of Harsco Metals & Minerals Segment" | Title == "Chairman, President & CEO" | Title == "Chief Executive Officer, President, Director, Chief Executive Officer of Manitowoc Cranes and President of Manitowoc Cranes" | Title == "CEO, President & Chairman" | Title == "Chairman of the Board and Chief Executive Officer" | Title == "Chief Executive Officer, President and Executive Director" | Title == "Chief Executive Officer, President, Director, Member of Executive & Finance Committee and Member of Compliance Committee" |Title == "CEO, President, COO & Director" | Title == "Founder, Chairman, Chief Executive Officer and President" | Title == "Co-Founder, Chief Executive Officer and Director" | Title == "Co-Founder, Chief Executive Officer, President and Director" |Title == "Chief Executive Officer, Director and Chairman of Strategic Planning Committee" | Title == "CEO, President, CFO & Director" | Title == "Chief Executive Officer of Nuvasive Specialized Orthopedics, Inc" | Title == "CEO" | "Chief Executive Officer, President, Director and Member of Executive Committee" | Title == "President, COO & CEO" | Title == "Chairman, Chief Executive Officer and Chairman of Executive Committee" | Title == "Chairman & Chief Executive Officer" | Title == "Chief Executive Officer, Director and Chairman of Executive Committee" | Title == "Co-Founder, President, CEO & Director" | Title == "Chairman, Chief Executive Officer, President, Member of Compensation Committee and Member of Retirement Benefits Committee" | Title == "CEO, President, CFO, Treasurer & Director" | Title == "Founder, Chairman of the Board & CEO" | Title == "Chairman of the Board, Chief Executive Officer, President and Member of Finance & Oversight Committee" | Title == "Chairman, Chief Executive Officer, President and Chairman of Executive Committee" | Title == "Executive Chairman, CEO & President" | Title == "Chairman of The Board, Interim Chief Executive Officer and Interim President" | Title == "Chairman of the Board of Directors, Chief Executive Officer and President"
However, when I use this code I get the following error code: type mismatch r(109);
I don't understand why it doesn't work because when I run:
keep if Title == "CEO, President & Chairman of the Board" | Title == "President, CEO & Director" | Title == "CEO, President & Director" | Title == "Chairman,President & CEO"
then it works perfectly.
Can someone please help me solve this problem?
I'm using Stata 17 on a macOs Catalina.
Below a sample of my data:
Thanks in advance!
I have a panel data set and for variable Title I want to keep certain observations and remove the other ones. I used the following code:
keep if Title == "CEO, President & Chairman of the Board" | Title == "President, CEO & Director" | Title == "CEO, President & Director" | Title == "Chairman,President & CEO" | Title == "CEO & Director"| Title == "President, CEO & Non-Independent Director"|Title == "Chairman & CEO" | Title == "Chairman, CEO & President" | Title == "Co-Founder, Chairman, CEO & Secretary"| Title == "President, CEO & Chairman" | Title == "Chairman of the Board, President & CEO" |Title == "Chairman of the Board & CEO" | Title == "CEO, President, Director, CEO of Manitowoc Cranes and President of Manitowoc Cranes" | Title == "Executive Chairman & CEO" | Title == "CEO & Chairman of the Board"| Title == "Chairman, CEO, President & Member of Scientific Advisory Committee" | Title == "Chairman & CEO (Leave of Absence)" | Title == "Chief Executive Officer, President and Director" | Title == "CEO, President & Executive Director" | Title == "Founder, Chairman of the Board, President & CEO" | Title == "President, CEO,Member of National First Executive Advisory Board & Director" | Title == "Co-Founder, CEO, President & Director"|Title == "Chief Executive Officer and Director" | Title == "Founder, President, CEO & Chairman of the Board of Directors" | Title == "Founder, Chairman, CEO & President" | Title == "President, CEO, COO & Director" | Title == "ChiefExecutive Officer, President and Director" | Title == "President, Chief Executive Officer & Director" | Title == "ChiefExecutive Officer, President and Executive Director" | Title == "Chairman of the Board, Chief Executive Officer and President" | Title == "Co-Founder, Chairman & Co-CEO" | Title == "CEO,President, CFO & Director" | Title == "Co-Founder, Chairman, President & CEO" | Title == "CEO & Executive Director" | Title == "Chairman, Chief Executive Officer and Chairman of Executive Council" | Title =="Founder, President, CEO & Chairman of the Board" | Title == "Chairman and Chief Executive Officer" | Title == "Co-Founder, CEO, Chairman & President" |Title == "President, CEO & Executive Director" | Title == "Chairman, Chief Executive Officer and President" | Title == "Chairman of the Board of Directors, Co-Founder & CEO" | Title == "Founder, Executive Chairman, President & CEO" | Title == "Co-Founder, CEO & Director" | Title == "Interim CEO, CFO, Senior VP & Director" | Title == "Chief ExecutiveOfficer, President and Director" | Title == "Founder, Chairman, President & CEO" | Title == "Founder, President, CEO & Director" | Title == "Chief Executive Officer & Director" | Title == "Founder, Chairman & CEO" | Title == "Chairman of the Board, CEO & President" | Title == "Co-Founder, Chairman, CEO & President" | Title == "Chairman, Interim Chief Executive Officer and Interim President" | Title == "Founder, Chairman and Chief Executive Officer" | Title == "Executive Chairman and Chief Executive Officer" | Title == "Chief Executive Officer, President, Director, Interim President of Harsco Rail Group and Interim President of Harsco Metals & Minerals Segment" | Title == "Chairman, President & CEO" | Title == "Chief Executive Officer, President, Director, Chief Executive Officer of Manitowoc Cranes and President of Manitowoc Cranes" | Title == "CEO, President & Chairman" | Title == "Chairman of the Board and Chief Executive Officer" | Title == "Chief Executive Officer, President and Executive Director" | Title == "Chief Executive Officer, President, Director, Member of Executive & Finance Committee and Member of Compliance Committee" |Title == "CEO, President, COO & Director" | Title == "Founder, Chairman, Chief Executive Officer and President" | Title == "Co-Founder, Chief Executive Officer and Director" | Title == "Co-Founder, Chief Executive Officer, President and Director" |Title == "Chief Executive Officer, Director and Chairman of Strategic Planning Committee" | Title == "CEO, President, CFO & Director" | Title == "Chief Executive Officer of Nuvasive Specialized Orthopedics, Inc" | Title == "CEO" | "Chief Executive Officer, President, Director and Member of Executive Committee" | Title == "President, COO & CEO" | Title == "Chairman, Chief Executive Officer and Chairman of Executive Committee" | Title == "Chairman & Chief Executive Officer" | Title == "Chief Executive Officer, Director and Chairman of Executive Committee" | Title == "Co-Founder, President, CEO & Director" | Title == "Chairman, Chief Executive Officer, President, Member of Compensation Committee and Member of Retirement Benefits Committee" | Title == "CEO, President, CFO, Treasurer & Director" | Title == "Founder, Chairman of the Board & CEO" | Title == "Chairman of the Board, Chief Executive Officer, President and Member of Finance & Oversight Committee" | Title == "Chairman, Chief Executive Officer, President and Chairman of Executive Committee" | Title == "Executive Chairman, CEO & President" | Title == "Chairman of The Board, Interim Chief Executive Officer and Interim President" | Title == "Chairman of the Board of Directors, Chief Executive Officer and President"
However, when I use this code I get the following error code: type mismatch r(109);
I don't understand why it doesn't work because when I run:
keep if Title == "CEO, President & Chairman of the Board" | Title == "President, CEO & Director" | Title == "CEO, President & Director" | Title == "Chairman,President & CEO"
then it works perfectly.
Can someone please help me solve this problem?
I'm using Stata 17 on a macOs Catalina.
Below a sample of my data:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input int SICCode str28 CompanyName str151 Title int FiscalYear 3533 "ENERPAC TOOL GROUP CORP" "Chairman, Interim Chief Executive Officer and Interim President" 2016 3533 "ENERPAC TOOL GROUP CORP" "Chief Financial Officer and Executive Vice President" 2016 3533 "ENERPAC TOOL GROUP CORP" "Executive Vice President of Energy Segment & China" 2016 3533 "ENERPAC TOOL GROUP CORP" "" 2016 3533 "ENERPAC TOOL GROUP CORP" "Executive Vice President of Industrial" 2016 3533 "ENERPAC TOOL GROUP CORP" "Executive Vice President of Engineered Solutions and China" 2016 3533 "ENERPAC TOOL GROUP CORP" "Executive Vice President of Human Resources" 2016 3533 "ENERPAC TOOL GROUP CORP" "Chief Executive Officer, President and Director" 2016 3533 "ENERPAC TOOL GROUP CORP" "Executive Vice President of Industrial" 2016 3533 "ENERPAC TOOL GROUP CORP" "Chief Financial Officer and Executive Vice President" 2017 3533 "ENERPAC TOOL GROUP CORP" "" 2017 3533 "ENERPAC TOOL GROUP CORP" "Executive Vice President of Engineered Solutions Segment" 2017 3533 "ENERPAC TOOL GROUP CORP" "Executive Vice President of Human Resources" 2017 3533 "ENERPAC TOOL GROUP CORP" "President, CEO & Director" 2017 3533 "ENERPAC TOOL GROUP CORP" "Executive Vice President of Industrial Segment" 2017 3533 "ENERPAC TOOL GROUP CORP" "Executive VP & CFO" 2017 3533 "ENERPAC TOOL GROUP CORP" "Executive Vice President of Corporate Development" 2018 3533 "ENERPAC TOOL GROUP CORP" "Executive Vice President of Engineered Solutions Segment" 2018 3533 "ENERPAC TOOL GROUP CORP" "President, CEO & Director" 2018 3533 "ENERPAC TOOL GROUP CORP" "Executive VP & CFO" 2018 3533 "ENERPAC TOOL GROUP CORP" "Executive Vice President of Global Human Resources" 2018 3533 "ENERPAC TOOL GROUP CORP" "" 2018 3533 "ENERPAC TOOL GROUP CORP" "Executive Vice President of Engineered Solutions Segment" 2019 3533 "ENERPAC TOOL GROUP CORP" "President, CEO & Director" 2019 3533 "ENERPAC TOOL GROUP CORP" "Executive VP & CFO" 2019 3533 "ENERPAC TOOL GROUP CORP" "" 2019 3533 "ENERPAC TOOL GROUP CORP" "" 2019 3533 "ENERPAC TOOL GROUP CORP" "Executive Vice President of Engineered Solutions Segment" 2020 3533 "ENERPAC TOOL GROUP CORP" "President, CEO & Director" 2020 3533 "ENERPAC TOOL GROUP CORP" "Executive VP & CFO" 2020 3533 "ENERPAC TOOL GROUP CORP" "Executive VP & COO" 2020 3533 "ENERPAC TOOL GROUP CORP" "Executive VP, General Counsel, Secretary & Global Human Resources" 2020 3533 "ENERPAC TOOL GROUP CORP" "Executive VP & Chief Strategy Officer" 2020 3330 "MATERION CORP" "Chairman, Chief Executive Officer and President" 2016 3330 "MATERION CORP" "Vice President, General Counsel and Corporate Secretary" 2016 3330 "MATERION CORP" "Chief Financial Officer and Vice President of Finance" 2016 3330 "MATERION CORP" "Executive Chairman" 2017 3330 "MATERION CORP" "Vice President, General Counsel and Secretary" 2017 3330 "MATERION CORP" "Chief Financial Officer and Vice President of Finance" 2017 3330 "MATERION CORP" "Chief Executive Officer, President and Director" 2017 3330 "MATERION CORP" "Vice President, General Counsel and Secretary" 2018 3330 "MATERION CORP" "Chief Financial Officer and Vice President of Finance" 2018 3330 "MATERION CORP" "Chief Executive Officer, President and Director" 2018 3330 "MATERION CORP" "VP, General Counsel & Secretary" 2019 3330 "MATERION CORP" "Chief Financial Officer and Vice President of Finance" 2019 3330 "MATERION CORP" "CEO, President & Director" 2019 3330 "MATERION CORP" "VP, General Counsel & Secretary" 2020 3330 "MATERION CORP" "Chief Financial Officer and Vice President of Finance" 2020 3330 "MATERION CORP" "CEO, President & Director" 2020 3330 "MATERION CORP" "VP of Investor Relations & Finance and Corporate Controller" 2020 3330 "MATERION CORP" "VP of Finance & CFO" 2020 3670 "CTS CORP" "Chief Financial Officer and Vice President" 2016 3670 "CTS CORP" "Chairman, Chief Executive Officer and President" 2016 3670 "CTS CORP" "Vice President, General Counsel and Secretary" 2016 3670 "CTS CORP" "Chief Financial Officer and Vice President" 2017 3670 "CTS CORP" "Chairman, Chief Executive Officer and President" 2017 3670 "CTS CORP" "Vice President, General Counsel and Secretary" 2017 3670 "CTS CORP" "Chief Financial Officer and Vice President" 2018 3670 "CTS CORP" "Chairman, Chief Executive Officer and President" 2018 3670 "CTS CORP" "Vice President, General Counsel and Secretary" 2018 3670 "CTS CORP" "VP, CFO & Principal Accounting Officer" 2019 3670 "CTS CORP" "Chairman, President & CEO" 2019 3670 "CTS CORP" "Vice President, General Counsel and Secretary" 2019 3670 "CTS CORP" "VP, CFO & Principal Accounting Officer" 2020 3670 "CTS CORP" "Chairman, President & CEO" 2020 3670 "CTS CORP" "Vice President, General Counsel and Secretary" 2020 3826 "COHERENT INC" "Chief Executive Officer, President and Director" 2016 3826 "COHERENT INC" "Special Advisor" 2016 3826 "COHERENT INC" "Executive Vice President, General Counsel and Corporate Secretary" 2016 3826 "COHERENT INC" "Executive Vice President and General Manager of Specialty Laser Systems Business Group" 2016 3826 "COHERENT INC" "Executive Vice President of Worldwide Sales & Services" 2016 3826 "COHERENT INC" "Chief Financial Officer and Executive Vice President" 2016 3826 "COHERENT INC" "President, CEO & Director" 2017 3826 "COHERENT INC" "Executive VP, General Counsel & Corporate Secretary" 2017 3826 "COHERENT INC" "Executive VP & GM of OEM Laser Sources" 2017 3826 "COHERENT INC" "Executive Vice President of Worldwide Sales & Services" 2017 3826 "COHERENT INC" "Chief Financial Officer and Executive Vice President" 2017 3826 "COHERENT INC" "President, CEO & Director" 2018 3826 "COHERENT INC" "Executive VP, General Counsel & Corporate Secretary" 2018 3826 "COHERENT INC" "Executive VP & GM of OEM Laser Sources" 2018 3826 "COHERENT INC" "Executive Vice President of Worldwide Sales & Services" 2018 3826 "COHERENT INC" "Chief Financial Officer and Executive Vice President" 2018 3826 "COHERENT INC" "President, CEO & Director" 2019 3826 "COHERENT INC" "Executive VP, General Counsel & Corporate Secretary" 2019 3826 "COHERENT INC" "Executive VP & GM of OEM Laser Sources" 2019 3826 "COHERENT INC" "Executive Vice President of Worldwide Sales & Services" 2019 3826 "COHERENT INC" "Chief Financial Officer and Executive Vice President" 2019 3826 "COHERENT INC" "Special Advisor" 2020 3826 "COHERENT INC" "Executive VP, General Counsel & Corporate Secretary" 2020 3826 "COHERENT INC" "Executive VP & COO" 2020 3826 "COHERENT INC" "Executive VP & CFO" 2020 3826 "COHERENT INC" "Executive Vice President and General Manager of Industrial Laser & Systems" 2020 3826 "COHERENT INC" "President, CEO & Director" 2020 7370 "SHUTTERSTOCK INC" "Chief Financial Officer, Chief Operating Officer and Treasurer" 2016 7370 "SHUTTERSTOCK INC" "Founder, Chairman and Chief Executive Officer" 2016 7370 "SHUTTERSTOCK INC" "Chief Marketing Officer" 2016 7370 "SHUTTERSTOCK INC" "Chief People Officer" 2016 7370 "SHUTTERSTOCK INC" "Chief Information Officer" 2016 7370 "SHUTTERSTOCK INC" "" 2016 7370 "SHUTTERSTOCK INC" "Chief Operating Officer, Chief Financial Officer and Treasurer" 2017 end
Thanks in advance!

Comment