Seite 1 von 1

Sum of a var over all j's (if j does not equal i)

BeitragVerfasst: Mi 12. Mär 2014, 12:31
von dzejna
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.

Re: Sum of a var over all j's (if j does not equal i)

BeitragVerfasst: Mi 12. Mär 2014, 13:52
von daniel

Re: Sum of a var over all j's (if j does not equal i)

BeitragVerfasst: Mi 12. Mär 2014, 17:12
von dzejna
Thank you for the link, but I read this before and do not think it is the same principle...or maybe I just can't to apply it to my formula.