I have a dataset on weekly hours that individuals worked for each week of the years. For example, the dataset looks like below:
ID | hours_1_1997 | hours_2_1997 | ... | hours_52_1997 | hours_1_1998 | hours_2_1998 | ... | hours_52_1998 |
1 | 10 | 40 | ... | 30 | 30 | 50 | ... | 30 |
I can manually type all the variables that I want to sum(i.e. hours_36_1997, hours_19_1997, ..., hours_52_1997, hours_1_1998, hours_2_1998, ..., hours_17_1998), where 36 indicates the first week of September and 17 refers to the last week of April. However, I was wondering if there is a smart way to specify such range of variables so that I can save the lines and time.
Thank you very much for your help!!!
0 Response to Summing the values over specific range of variables
Post a Comment