I am trying to reshape wide the dataset below. Basically i would like the months (January through December) to be individual columns. However, some of the months are missing within "year" (ranges from 2013-2020) and within "ori". I would just like the missing months to show up either as 0 or blank.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str9 ori int year float month double n_incidents "AL0011200" 2013 1 339 "AL0011200" 2013 2 351 "AL0011200" 2013 3 334 "AL0011200" 2013 4 327 "AL0011200" 2013 5 385 "AL0011200" 2013 6 434 "AL0011200" 2013 7 391 "AL0011200" 2013 8 343 "AL0011200" 2013 9 388 "AL0011200" 2013 10 425 "AL0011200" 2013 11 337 "AL0011200" 2013 12 375 end label values month month1 label def month1 1 "January", modify label def month1 2 "February", modify label def month1 3 "March", modify label def month1 4 "April", modify label def month1 5 "May", modify label def month1 6 "June", modify label def month1 7 "July", modify label def month1 8 "August", modify label def month1 9 "September", modify label def month1 10 "October", modify label def month1 11 "November", modify label def month1 12 "December", modify
Any help with the syntax would be greatly appreciated!
0 Response to Reshape wide with missing observations
Post a Comment