Hello
I have data for more than 1000 municipalities in Colombia, and for each, 20 years of observations. I was wondering how I could group the years. I mean, instead of having 1990, 1991, 1992... 2018 to have 1990-1992, 1993-1995, 1996-1998 and so on. Then I want to add the values of the variables in each group of years. The code I am using is
gen group=.
replace group=19901992 if year>=1990 & year<=1992
replace group=19931995 if year>=1993 & year<=1995
replace group=19951998 if year>=1996 & year<=1998
replace group=19982001 if year>=1990 & year<=2001
bysort group: egen sum_var=sum(var)
for each of the variables, but in the end i get all my results the same rather than grouped by each year group.
Thank you
Related Posts with Grouping individual years into year groups in panel data
iroc does not workDear all, I am running a small logistic regression but I am not getting any value when I type "iroc…
Stata manual for -ml- does not explain what -gtol()- refers toDear Statalisters, I have seen commands in -ml- that use as an option -gtol()-. For example, in thi…
ML command could not find feasible valuesDear STATA experts: I’m learning STATA's maximize likelihood syntax by building my own ordered prob…
How to export variable labels using outreg2 - label option not working?Hi all I want to export my regression tables, showing variable labels instead of names, using the o…
Use global macro to call do-file not errorDear All, I'm trying to use the following code to set up global macro and then call do file based o…
Subscribe to:
Post Comments (Atom)
0 Response to Grouping individual years into year groups in panel data
Post a Comment