I have a dataset of the following form:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(uniqueid year month) 1001 2000 3 1001 2000 4 1001 2000 5 1001 2000 6 1001 2000 7 1001 2000 8 1001 2000 9 1001 2000 10 1001 2000 11 1001 2001 1 1001 2001 2 1001 2001 4 1001 2001 5 1001 2001 6 1001 2001 7 1001 2001 8 1001 2001 9 1001 2001 11 1001 2001 12 1001 2002 1 1001 2002 2 1001 2002 4 1001 2002 5 1001 2002 6 1001 2002 7 1001 2002 8 1001 2002 9 1001 2002 10 1001 2002 11 1001 2002 12 1001 2003 1 1001 2003 2 1001 2003 3 1001 2003 4 1001 2003 5 1001 2003 6 1001 2003 7 1001 2003 10 1001 2003 11 1001 2003 12 1001 2004 1 1001 2004 4 1001 2004 5 1001 2004 6 1001 2004 7 1001 2004 9 1001 2004 10 1001 2004 11 1001 2005 1 1001 2005 3 1001 2005 5 1001 2005 6 1001 2005 8 1001 2005 9 1001 2005 10 1001 2005 11 1001 2005 12 1001 2006 1 1001 2006 2 1001 2006 3 1001 2006 4 1001 2006 5 1001 2006 6 1001 2006 7 1001 2006 8 1001 2006 9 1001 2006 11 1001 2006 12 1001 2007 1 1001 2007 2 1001 2007 3 1001 2007 5 1001 2007 6 1001 2007 7 1001 2007 8 1001 2007 9 1001 2007 10 1001 2007 11 1001 2007 12 1001 2008 1 1001 2008 2 1001 2008 3 1001 2008 4 1001 2008 5 1001 2008 6 1001 2008 7 1001 2008 8 1001 2008 9 1001 2008 10 1001 2008 11 1001 2008 12 1001 2009 1 1001 2009 2 1001 2009 3 1001 2009 4 1001 2009 5 1001 2009 6 1001 2009 7 1001 2009 8 1001 2009 9 end
with multiple unique id's (not listed beyond 1001 in the example) and year observations ranging from 2000-2010. I'm trying to overcome the problem of each unique id not having all years within this interval, and I'm wondering what the easiest way of generating 12 values of each year for each unique ID would be (so I could then fill in values 1-12 for each unique Id year group to represent months).
Thank you.
0 Response to Filling in years by group
Post a Comment