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

Fragen zu Stata Syntax und Do-Files.

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

Beitragvon dzejna » Mi 12. Mär 2014, 12:31

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.
dzejna
 
Beiträge: 3
Registriert: Sa 1. Mär 2014, 22:36
Danke gegeben: 0
Danke bekommen: 0 mal in 0 Post

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

Beitragvon daniel » Mi 12. Mär 2014, 13:52

Stata is an invented word, not an acronym, and should not appear with all letters capitalized: please write “Stata”, not “STATA”.
daniel
 
Beiträge: 1060
Registriert: Sa 1. Okt 2011, 17:20
Danke gegeben: 0
Danke bekommen: 0 mal in 0 Post

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

Beitragvon dzejna » Mi 12. Mär 2014, 17:12

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.
dzejna
 
Beiträge: 3
Registriert: Sa 1. Mär 2014, 22:36
Danke gegeben: 0
Danke bekommen: 0 mal in 0 Post


Zurück zu Stata Syntax

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 0 Gäste

cron