Hello,
I am trying to create a weighted sum score variable – i.e., revenue-weighted sum of site-level hightech use (firm_hightech_use). Here, sites refer to a firm’s subsidiaries. site_hightech_use is a binary variable, which refers to whether a site is using hightech (1: yes, 0: no). I want to create a new firm-level variable that aggregates each site’s value of site_hightech_use. For example, for firm_id E01, the firm_hightech_use = (1564/(1564+837+706)*1) + (837/(1564+837+706))*0+(706/(/(1564+837+706))*1 = 0.731
Some sites have missing values on site_hightech_use or site_revenue. Some firms have more than 5 sites and some may have just one site. In total, the sample includes two years and more than 1,000 sites.
I have a hard time creating this new variable firm_hightech_use. I was wondering if anyone can help me? Below is my sample dataset.
Many thanks,
David
I am trying to create a weighted sum score variable – i.e., revenue-weighted sum of site-level hightech use (firm_hightech_use). Here, sites refer to a firm’s subsidiaries. site_hightech_use is a binary variable, which refers to whether a site is using hightech (1: yes, 0: no). I want to create a new firm-level variable that aggregates each site’s value of site_hightech_use. For example, for firm_id E01, the firm_hightech_use = (1564/(1564+837+706)*1) + (837/(1564+837+706))*0+(706/(/(1564+837+706))*1 = 0.731
Some sites have missing values on site_hightech_use or site_revenue. Some firms have more than 5 sites and some may have just one site. In total, the sample includes two years and more than 1,000 sites.
I have a hard time creating this new variable firm_hightech_use. I was wondering if anyone can help me? Below is my sample dataset.
Code:
clear input firm_id site_id year site_revenue site_employees site_hightech_use firm_hightech_use E01 1030 2015 1564 200 1 E01 1031 2015 837 77 0 E01 1032 2015 706 73 1 E02 1040 2015 3108 750 1 E02 1041 2015 2976 650 1 E03 1050 2015 23 19 1 E04 1060 2015 28593 1500 1 E01 1030 2014 1309 200 1 E01 1031 2014 910 77 0 E01 1032 2014 688 73 0 E02 1040 2014 3303 750 1 E02 1041 2014 2711 650 1 E03 1050 2014 7 19 1 E04 1060 2014 13 1500 0 end
David
Comment