This is my first posting here on Statalist and it's regarding reshaping some data on store opening hours to a panel setup. As it is now I have store and weekday specific entries for different time periods (some of these overlap). I would like to arrange the data in a panel setup with the total number of hours each store is open each month during the period 2000-2018. There are 487 stores (ID).
I have tried the expand command as well as searching the web and Statalist forums but haven't been able to find a solution.
Code:
clear input int(ID FromDate) long ToDate str9 Weekday float Hours 102 20447 20447 "Friday" 0 102 21721 21721 "Friday" 0 102 20454 20454 "Friday" 0 102 21357 21357 "Friday" 0 102 14826 25200 "Friday" 9 102 20923 20923 "Friday" 0 102 21273 21273 "Friday" 0 102 20993 20993 "Friday" 0 102 21658 21658 "Friday" 0 102 20629 20629 "Friday" 0 102 20825 20825 "Friday" 0 102 20538 20538 "Friday" 0 102 21491 21491 "Saturday" 0 102 21358 21358 "Saturday" 0 102 21722 21722 "Saturday" 0 102 20994 20994 "Saturday" 0 102 20448 20448 "Saturday" 0 102 14827 25201 "Saturday" 5 102 21190 21190 "Saturday" 0 102 20763 20763 "Saturday" 0 102 22016 22016 "Saturday" 5 102 21127 21127 "Saturday" 0 102 20392 20392 "Saturday" 0 102 20630 20630 "Saturday" 0 102 21855 21855 "Saturday" 0 102 20812 20812 "Saturday" 0 102 20611 20611 "Monday" 0 102 20940 20940 "Monday" 0 102 20926 20926 "Monday" 0 102 21549 21549 "Monday" 5 102 14822 25203 "Monday" 9 102 21542 21542 "Monday" 0 102 21185 21185 "Monday" 0 102 21276 21276 "Monday" 0 102 20814 20814 "Monday" 0 102 21178 21178 "Monday" 0 102 21661 21661 "Monday" 0 102 20541 20541 "Monday" 0 102 20459 20459 "Wednesday" 0 102 21908 21908 "Wednesday" 0 102 21670 21670 "Wednesday" 0 102 21544 21544 "Wednesday" 0 102 21915 21915 "Wednesday" 0 102 14824 25198 "Wednesday" 9 102 21341 21341 "Wednesday" 0 102 20813 20813 "Sunday" 0 102 14828 25202 "Sunday" 0 102 21907 21907 "Tuesday" 0 102 21179 21179 "Tuesday" 0 102 14823 25197 "Tuesday" 9 102 21550 21550 "Tuesday" 0 102 20976 20976 "Tuesday" 0 102 21543 21543 "Tuesday" 0 102 21305 21305 "Tuesday" 0 102 21914 21914 "Tuesday" 5 102 20453 20453 "Thursday" 5 102 21314 21314 "Thursday" 0 102 22280 22280 "Thursday" 5 102 20579 20579 "Thursday" 0 102 21909 21909 "Thursday" 0 102 14825 25199 "Thursday" 9 102 20446 20446 "Thursday" 0 102 20964 20964 "Thursday" 0 102 21699 21699 "Thursday" 0 102 21706 21706 "Thursday" 0 103 21721 21721 "Friday" 0 103 20538 20538 "Friday" 0 103 19530 19530 "Friday" 0 103 20209 20209 "Friday" 0 103 20447 20447 "Friday" 0 103 20083 20083 "Friday" 0 103 20454 20454 "Friday" 0 103 20181 20181 "Friday" 0 103 21273 21273 "Friday" 0 103 21658 21658 "Friday" 0 103 21357 21357 "Friday" 0 103 19894 19894 "Friday" 0 103 20629 20629 "Friday" 0 103 19880 19880 "Friday" 0 103 20258 20258 "Friday" 0 103 20825 20825 "Friday" 0 103 19831 19831 "Friday" 0 103 20923 20923 "Friday" 0 103 19446 19446 "Friday" 0 103 20993 20993 "Friday" 0 103 19895 19895 "Saturday" 0 103 20994 20994 "Saturday" 0 103 20245 20245 "Saturday" 0 103 19664 19664 "Saturday" 0 103 20392 20392 "Saturday" 0 103 21190 21190 "Saturday" 0 103 20448 20448 "Saturday" 0 103 20812 20812 "Saturday" 0 103 20028 20028 "Saturday" 0 103 20763 20763 "Saturday" 0 103 19531 19531 "Saturday" 0 103 20630 20630 "Saturday" 0 103 21491 21491 "Saturday" 0 103 21855 21855 "Saturday" 0 103 21722 21722 "Saturday" 0 end format %tdnn/dd/CCYY FromDate format %tdnn/dd/CCYY ToDate
0 Response to Creating panel data from weekday data
Post a Comment