The problem that how to calculate the summation of a numeric variable

http://en.wikipedia.org/wiki/Herfindahl_index

I did this

egen var1=sum( sales^2)

Now I need to apply this equation in stata 8 but it reply in invalid syntax

egen var2=(var1-1/N)/1-1/N where N is number of companies(observations)

http://en.wikipedia.org/wiki/Herfindahl_index

I did this

egen var1=sum( sales^2)

Now I need to apply this equation in stata 8 but it reply in invalid syntax

egen var2=(var1-1/N)/1-1/N where N is number of companies(observations)

Last edited: