Hello everybody,
I am currently experiencing a problem with creating the sum of a variable over all observations j not equal i.
Please consider the following: The observations in my panel data set are at the firm level and there is a variable indicating the sector to which each firm belongs.
I have to create a sum of a variable by year and sector (if j does not equal i). The result should show the backward linkages of a firm operating in sector i with all other sectors j. Thus, the sector i should be excluded from the sum formula to eliminate the intrasectoral flows.
bysort sector year: egen v1= sum(v2_sector_j) EXCEPT sector i
How could I restrict this command on only summing up all observations except the sector the firm is belonging to??
Thank you for all your help in advance.