Here is part of my dataset:
gvkey(firm_id) fyear(year) qarter asset_growth(variable value)
001004 1995 1
001004 1995 2
001004 1995 3
001004 1995 4
001004 1996 1
001004 1996 2
001004 1996 3
001004 1996 4
001004 1997 1
001004 1997 2
001004 1997 3
001004 1997 4
001004 1998 1
001004 1998 2
001004 1998 3
001004 1998 4
......... ...... .
........ ....... .
001009 1995 1
001009 1995 2
001009 1995 3
001009 1995 4
001009 1996 1
001009 1996 2
001009 1996 3
001009 1996 4
001009 1997 1
001009 1997 2
001009 1997 3
001009 1997 4
001009 1998 1
001009 1998 2
001009 1998 3
001009 1998 4
......... ...... .
........ ....... .
What I need do is to use stata to calculate the mean of asset_growth in the respective quarters over the past three years for each firm. However, I don't know how to do it? Is there anyone can help me with this problem? Thank you so much in advance!
gvkey(firm_id) fyear(year) qarter asset_growth(variable value)
001004 1995 1
001004 1995 2
001004 1995 3
001004 1995 4
001004 1996 1
001004 1996 2
001004 1996 3
001004 1996 4
001004 1997 1
001004 1997 2
001004 1997 3
001004 1997 4
001004 1998 1
001004 1998 2
001004 1998 3
001004 1998 4
......... ...... .
........ ....... .
001009 1995 1
001009 1995 2
001009 1995 3
001009 1995 4
001009 1996 1
001009 1996 2
001009 1996 3
001009 1996 4
001009 1997 1
001009 1997 2
001009 1997 3
001009 1997 4
001009 1998 1
001009 1998 2
001009 1998 3
001009 1998 4
......... ...... .
........ ....... .
What I need do is to use stata to calculate the mean of asset_growth in the respective quarters over the past three years for each firm. However, I don't know how to do it? Is there anyone can help me with this problem? Thank you so much in advance!
Comment