Hi how do I create a shock variable? Suppose I want to create a variable for each year ( for this variable- vc_body_out)which is an indicator of that variable being above or below a threshold of the standard deviation for all the years considered. Kind of similar to how rainfall shocks are created (sd from a historical mean).
[/CODE]
[/CODE]
[/CODE]
Code:
input int year byte(State_code_census Dist_code_census) float vc_body_out 2005 1 1 211 2006 1 1 187 2007 1 1 186 2008 1 1 122 2009 1 1 116 2010 1 1 148 2011 1 1 136 2012 1 1 135 2013 1 1 128 2014 1 1 117 2015 1 1 126 2016 1 1 118 2017 1 1 139 2018 1 1 125 2005 1 2 284 2006 1 2 292 2007 1 2 231 2008 1 2 172 2009 1 2 223 2010 1 2 286 2011 1 2 268 2012 1 2 258 2013 1 2 258 2014 1 2 214 2015 1 2 223 2016 1 2 160 2017 1 2 190 2018 1 2 236 2005 1 3 361 2006 1 3 336 2007 1 3 233 2008 1 3 205 2009 1 3 239 2010 1 3 291 2011 1 3 236 2012 1 3 204 2013 1 3 190 2014 1 3 150 2015 1 3 193 2016 1 3 136 2017 1 3 196 2018 1 3 234 2005 1 4 122 2006 1 4 100 2007 1 4 96 2008 1 4 100 2009 1 4 109 2010 1 4 98 2011 1 4 119 2012 1 4 93 2013 1 4 102 2014 1 4 87 2015 1 4 95 2016 1 4 133 2017 1 4 83 2018 1 4 96 2005 1 5 197 2006 1 5 178 2007 1 5 156 2008 1 5 71 2009 1 5 63 2010 1 5 70 2011 1 5 94 2012 1 5 66 2013 1 5 70 2014 1 5 73 2015 1 5 80 2016 1 5 84 2017 1 5 104 2018 1 5 134 2005 1 6 264 2006 1 6 239 2007 1 6 182 2008 1 6 196 2009 1 6 247 2010 1 6 236 2011 1 6 254 2012 1 6 277 2013 1 6 268 2014 1 6 227 2015 1 6 224 2016 1 6 286 2017 1 6 204 2018 1 6 236 2005 1 7 6 2006 1 7 13 2007 1 7 10 2008 1 7 6 2009 1 7 6 2010 1 7 6 2011 1 7 2 2012 1 7 5 2013 1 7 1 2014 1 7 2 2015 1 7 5 2016 1 7 5 2017 1 7 9 2018 1 7 6 2005 1 8 2 2006 1 8 5 end
Comment