Dear all,
I'm curious if I can do something like this in Stata,
for t = 1:12 {
replace yyy = xxx*R[_n-1]*...R[_n-t] if missing(yyy)
}
Quintessentially, I want a for loop that updates yyy by xxx times product of R's lagged 1 month to t months if yyy is missing. Of course, I can do,
replace yyy = xxx*R[_n-1] if missing(yyy)
replace yyy = xxx*R[_n-1]*R[_n-2] if missing(yyy)
replace yyy = xxx*R[_n-1]*R[_n-2]*R[_n-3] if missing(yyy)
etc.
But I'm curious if there's something nicer. I'd very much appreciate your lead.
Thanks so much for your time.
Best,
John
I'm curious if I can do something like this in Stata,
for t = 1:12 {
replace yyy = xxx*R[_n-1]*...R[_n-t] if missing(yyy)
}
Quintessentially, I want a for loop that updates yyy by xxx times product of R's lagged 1 month to t months if yyy is missing. Of course, I can do,
replace yyy = xxx*R[_n-1] if missing(yyy)
replace yyy = xxx*R[_n-1]*R[_n-2] if missing(yyy)
replace yyy = xxx*R[_n-1]*R[_n-2]*R[_n-3] if missing(yyy)
etc.
But I'm curious if there's something nicer. I'd very much appreciate your lead.
Thanks so much for your time.
Best,
John