Created
February 10, 2012 01:36
-
-
Save robinkraft/1785225 to your computer and use it in GitHub Desktop.
Replacing monthly values in Stata
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
forvalues year = 2005/2011 { | |
forvalues month = 1/12 { | |
if `month' < 10 { | |
local mo_str = "0`month'" | |
} | |
else { | |
local mo_str = "`month'" | |
} | |
local yearmo = "`year'`mo_str'" | |
di "`yearmo'" | |
capture confirm variable prob`yearmo' | |
if !_rc { | |
replace prob`yearmo' = 103 if prob`yearmo' == 101 | |
replace prob`yearmo' = 101 if prob`yearmo' == 111 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment