Hello all,
I am stuck on how to code a loop that will essentially execute the following for the multiple time periods:
corr x y if year>=1983 & year<1990
corr x y if year>=1990 & year<2000
corr x y if year>=2000 & year<2012
Since I'm producing more than just simple correlations, including different scenarios each time period and graphs with the time period coded in the title, the code is quite lengthy. Ideally, I'd run a loop that looks something like that below, but am not sure how to call a second set of values for the end of the time period
foreach y in 1980 1992 2000 2011 {
corr x y if year>=`y' & year < [???]
}
I've searched online and on Statalist, but seems to be a complicated search and not yielding any results. Any pointers is much appreciated!
Nabeela
I am stuck on how to code a loop that will essentially execute the following for the multiple time periods:
corr x y if year>=1983 & year<1990
corr x y if year>=1990 & year<2000
corr x y if year>=2000 & year<2012
Since I'm producing more than just simple correlations, including different scenarios each time period and graphs with the time period coded in the title, the code is quite lengthy. Ideally, I'd run a loop that looks something like that below, but am not sure how to call a second set of values for the end of the time period
foreach y in 1980 1992 2000 2011 {
corr x y if year>=`y' & year < [???]
}
I've searched online and on Statalist, but seems to be a complicated search and not yielding any results. Any pointers is much appreciated!
Nabeela
Comment