hi,
i would like to know how do i add up values of a variable over years?
I have data from 1991 to 2014, I would like to create a variable that for 1991 takes the initial value given in 1991, then for 1992 takes the value of 1992 plus 1991, for 1993 takes the value 1991 plus 1992 plus 1993, etc
i have the variables year, words (which is the one i want to add up) and code_id (17 different categories)
year code_id words
1991 2 33134
1992 2 26410
1993 2 65184
1994 2 185471
1995 2 54097
1996 2 25953
1997 2 54249
1998 2 31665
1991 3 7012
1992 3 34918
1993 3 36356
1994 3 12202
1995 3 5024
1996 3 12674
1997 3 52485
1998 3 15931
1991 4 44621
1992 4 40430
1993 4 54055
1994 4 89413
1995 4 54109
1996 4 51612
1997 4 45979
1998 4 37916
1991 12 51038
1992 12 39969
1993 12 48485
1994 12 235801
1995 12 45539
1996 12 47991
1997 12 27825
1998 12 75286
1991 13 10788
1992 13 4576
1993 13 14237
1994 13 15108
1995 13 9705
1996 13 11645
1997 13 23008
1998 13 21860
1991 14 3874
1992 14 980
1993 14 8960
1994 14 12986
1995 14 56786
1996 14 19230
1997 14 3159
1998 14 6880
1991 15 16792
1992 15 33096
1993 15 26275
1994 15 55868
1995 15 31947
1996 15 16578
1997 15 28570
1998 15 23513
1991 16 7118
1992 16 12603
1993 16 32021
1994 16 18391
1995 16 16255
1996 16 15329
1997 16 5801
1998 16 7191
thanks for the help!
i would like to know how do i add up values of a variable over years?
I have data from 1991 to 2014, I would like to create a variable that for 1991 takes the initial value given in 1991, then for 1992 takes the value of 1992 plus 1991, for 1993 takes the value 1991 plus 1992 plus 1993, etc
i have the variables year, words (which is the one i want to add up) and code_id (17 different categories)
year code_id words
1991 2 33134
1992 2 26410
1993 2 65184
1994 2 185471
1995 2 54097
1996 2 25953
1997 2 54249
1998 2 31665
1991 3 7012
1992 3 34918
1993 3 36356
1994 3 12202
1995 3 5024
1996 3 12674
1997 3 52485
1998 3 15931
1991 4 44621
1992 4 40430
1993 4 54055
1994 4 89413
1995 4 54109
1996 4 51612
1997 4 45979
1998 4 37916
1991 12 51038
1992 12 39969
1993 12 48485
1994 12 235801
1995 12 45539
1996 12 47991
1997 12 27825
1998 12 75286
1991 13 10788
1992 13 4576
1993 13 14237
1994 13 15108
1995 13 9705
1996 13 11645
1997 13 23008
1998 13 21860
1991 14 3874
1992 14 980
1993 14 8960
1994 14 12986
1995 14 56786
1996 14 19230
1997 14 3159
1998 14 6880
1991 15 16792
1992 15 33096
1993 15 26275
1994 15 55868
1995 15 31947
1996 15 16578
1997 15 28570
1998 15 23513
1991 16 7118
1992 16 12603
1993 16 32021
1994 16 18391
1995 16 16255
1996 16 15329
1997 16 5801
1998 16 7191
thanks for the help!
Comment