Hello everyone, I am new to SAS (using SAS 9.4) and I need some help with one variable I use for my research. I need to generate a variable (let's call it variable A for simplicity), which is the sum of variable B over a five-year horizon, from the current year back to four years ago (i.e. from year t-4 to year t). I also needs to use BY Group command for variable A to make sure the sum is with respect to each firm. On top of this, variable B needs to have at least three consecutive years of non-missing data for computing variable A. I looked at the SUM function and I couldn't figure out how to do the sum for an interval with BY command, and also considering non-missing value. I really appreciate any help. Thanks a lot in advance. Best regards, Jiaxin
... View more