Last active
January 30, 2022 04:15
-
-
Save isaacgeng/cb701532a2dbd261c71987c024b47a9d to your computer and use it in GitHub Desktop.
code snippet to gen label weeks to let esttab know which is which
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// label all weeks so that we know which week | |
// 2020 | |
local clearall | |
cap label drop week_lab20 | |
cap label drop week_lab21 | |
local i1 = tw(2020w1) | |
local i2 = tw(2020w52) | |
local j = 1 | |
forvalues i = `i1'/`i2'{ | |
label define week_lab `i' "20week`j'", add | |
local ++j | |
} | |
// 2021 | |
local m1 = tw(2021w1) | |
local m2 = tw(2021w52) | |
local p = 1 | |
forvalues i = `m1'/`m2'{ | |
disp `i' | |
label define week_lab `i' "21week`p'", add | |
local ++p | |
} | |
label values trd_week week_lab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
format week %twCCYY_!w!e!e!k_WW_!(Mon!) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment