I have a sample data and want to match values between different variables. Here are the first 50 rows of sample data. There are three variables, conm (supplier name), gvkey (supplier identifier), and cnms (customer name). I want to check whether some customers are listed in the suppliers so I want to create a logic that can check if values of cnms appear in the conm. I understand that cnms is in the proper case and conm is in the upper case so I have to unify the cases first. After matching between conm and cnms, I want to extract the gvkey for those cnms values appearing in the conm variable.
I am new to Stata so I need help with this programming.
Thanks in advance.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str58 conm str6 gvkey str50 cnms "111 INC -ADR" "034066" "3 Customers" "21VIANET GROUP INC" "186876" "4 Customers" "21VIANET GROUP INC" "186876" "Not Reported" "21VIANET GROUP INC" "186876" "4 Customers" "21VIANET GROUP INC" "186876" "Not Reported" "21VIANET GROUP INC" "186876" "Not Reported" "21VIANET GROUP INC" "186876" "4 Customers" "2U INC" "019881" "Georgetown University School of Nursing and Health" "2U INC" "019881" "University of Southern California" "2U INC" "019881" "University of Southern California" "2U INC" "019881" "Georgetown University School of Nursing and Health" "2U INC" "019881" "Not Reported" "2U INC" "019881" "University of Southern California" "2U INC" "019881" "Georgetown University School of Nursing and Health" "2U INC" "019881" "Simmons College" "2U INC" "019881" "University of Southern California" "2U INC" "019881" "University of North Carolin" "2U INC" "019881" "Simmons College" "2U INC" "019881" "University of Southern California" "2U INC" "019881" "University of North Carolin" "2U INC" "019881" "Simmons University" "2U INC" "019881" "University of Southern California" "2U INC" "019881" "3 Customers" "2U INC" "019881" "Syracuse University" "360 SECURITY TECHNOLOGY INC" "186717" "Not Reported" "360 SECURITY TECHNOLOGY INC" "186717" "3 Customers" "360 SECURITY TECHNOLOGY INC" "186717" "Not Reported" "360 SECURITY TECHNOLOGY INC" "186717" "3 Customers" "360 SECURITY TECHNOLOGY INC" "186717" "Not Reported" "360 SECURITY TECHNOLOGY INC" "186717" "5 Customers" "3D SYSTEMS CORP" "014898" "Not Reported" "500.COM LTD -ADR" "019042" "Not Reported" "500.COM LTD -ADR" "019042" "Not Reported" "500.COM LTD -ADR" "019042" "Not Reported" "500.COM LTD -ADR" "019042" "Not Reported" "500.COM LTD -ADR" "019042" "Not Reported" "58.COM INC -ADR" "019026" "Not Reported" "6D GLOBAL TECHNOLOGIES" "181445" "Shenyang Xinxingjia Bellows Company" "6D GLOBAL TECHNOLOGIES" "181445" "Fuxin Nationality Industrial Park Construction Dev" "6D GLOBAL TECHNOLOGIES" "181445" "Liaoning Shenmei Hongyang Thermoelectric Co., Ltd" "6D GLOBAL TECHNOLOGIES" "181445" "Henan Pinggao Electric Co., Ltd" "6D GLOBAL TECHNOLOGIES" "181445" "Huaneng Tongyu Wind Power Co. Ltd." "6D GLOBAL TECHNOLOGIES" "181445" "Guodian Hefeng Wind Power Development Co. Ltd" "6D GLOBAL TECHNOLOGIES" "181445" "Beijing Guodian North China Power Engineering Co." "6D GLOBAL TECHNOLOGIES" "181445" "Shenyang Air Blower Group" "6D GLOBAL TECHNOLOGIES" "181445" "Not Reported" "6D GLOBAL TECHNOLOGIES" "181445" "Shenyang Air Blower Group" "6D GLOBAL TECHNOLOGIES" "181445" "4 Customers" "6D GLOBAL TECHNOLOGIES" "181445" "Not Reported" "6D GLOBAL TECHNOLOGIES" "181445" "Not Reported" end
0 Response to Match common values between different variables
Post a Comment