Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Weights not allowed error with positive weights

    Hi there,

    I'm trying to get the profit margin of a certain company 1 year after and 1 year before a CEO pay cut (more than 25% cut in salary) has occurred. I have the following commands:

    Code:
    bys globalcompanykey (datayearfiscal): gen PM_level_1 = profitmargin [_n+1] if salarypercentchangeyeartoyear[_n] < -25 & _n != 1 & profitmargin !=.
    Code:
    bys globalcompanykey (datayearfiscal): gen PM_level_min1 = profitmargin[_n-1] if salarypercentchangeyeartoyear[_n] < -25 & _n != 1 & profitmargin !=.
    The command for the 1 year before ( _n-1) is working, but the command for the 1 year after gives me a "Weights not allowed" error.

    Why is this the case and how can I fix it?

    Thanks.

  • #2
    Take out the space before [_n+1]

    Comment

    Working...
    X