I need a help with redesigning a dataset. It contains information on validity of coefficient types (variable coef_type, values 1-6) during different periods (year) in different towns (id). For instance, in a particular town, there could be different coefficient types (e.g. 1, 3, 5 - not necessarily all) valid during different years.
Data excerpt for 2 towns:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float year str6 id float coef_type 2011 "500011" 1 2012 "500011" 1 2013 "500011" 1 2014 "500011" 1 2015 "500011" 1 2016 "500011" 1 2017 "500011" 1 2018 "500011" 1 2011 "500011" 2 2012 "500011" 2 2013 "500011" 2 2014 "500011" 2 2015 "500011" 2 2016 "500011" 2 2017 "500011" 2 2018 "500011" 2 2011 "500011" 6 2012 "500011" 6 2013 "500011" 6 2014 "500011" 6 2015 "500011" 6 2016 "500011" 6 2017 "500011" 6 2018 "500011" 6 1994 "500054" 1 1995 "500054" 1 1996 "500054" 1 1997 "500054" 1 1998 "500054" 1 1999 "500054" 1 2000 "500054" 1 2001 "500054" 1 2002 "500054" 1 2003 "500054" 1 2004 "500054" 1 2005 "500054" 1 2006 "500054" 1 2007 "500054" 1 2008 "500054" 1 2009 "500054" 1 2010 "500054" 1 2011 "500054" 1 2012 "500054" 1 2013 "500054" 1 2014 "500054" 1 2015 "500054" 1 2016 "500054" 1 2017 "500054" 1 2018 "500054" 1 1994 "500054" 3 1995 "500054" 3 1996 "500054" 3 1997 "500054" 3 1998 "500054" 3 1999 "500054" 3 2000 "500054" 3 2001 "500054" 3 2002 "500054" 3 2003 "500054" 3 end
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float year str6 id str1 float(coef_type_0 coef_type _1 coef_type_2 coef_type_ coef_type_4 coef_type_5 coef_type_6) 2011 "500011" 1 1 0 1 1 0 2012 "500011" 1 1 0 1 1 0 2013 "500011" 1 1 0 0 1 0 2014 "500011" 1 1 1 0 1 0 2015 "500011" 1 1 1 0 1 0 2016 "500011" 1 1 1 0 1 0 2017 "500011" 1 1 1 0 1 0 2009 "500054" 1 1 1 1 1 1 2010 "500054" 1 1 1 1 1 1 2011 "500054" 1 1 1 1 1 1 2012 "500054" 1 1 1 1 1 1 2013 "500054" 1 1 1 1 1 1 2014 "500054" 1 1 1 1 1 1 2015 "500054" 1 1 1 1 1 0 2016 "500054" 1 1 1 1 1 0 2017 "500054" 1 1 1 1 1 0 2018 "500054" 1 1 1 1 1 0 end
0 Response to Redesigning dataset with categorical variable
Post a Comment