Hello everyone,

I'm trying to add observations in different lines into one line by ID.


Below is the simple version of my data. (I also attached Excel file)


PID year1 year2 year3 year4 year5 year6 year7
21 0 10 10 0 0 0 0
21 0 0 0 12 12 0 0
21 0 0 0 0 0 11 11


I want to make a format of one PID takes up one line and summing all the observations in each yearx into one line.


PID year1 year2 year3 year4 year5 year6 year7
21 0 10 10 12 12 11 11



Thank you very much!