Hi everyone,
It seems like STATA skips over test1 and test2 observations as my new variables maxtest1 and maxtest2 are test3 observations. It seems like my forvalues m=1/3 is right. Please tell me what's wrong in the code. Thank you in advance.
local maxtest maxtest1 maxtest2 maxtest3
local i=1
foreach value of local maxtest {
gen `value'=.
forvalues m=1/3 {
replace `value'=test`m' if test1effort==`i'&test2effort==`i'&test3effort==`i'
}
}
It seems like STATA skips over test1 and test2 observations as my new variables maxtest1 and maxtest2 are test3 observations. It seems like my forvalues m=1/3 is right. Please tell me what's wrong in the code. Thank you in advance.
local maxtest maxtest1 maxtest2 maxtest3
local i=1
foreach value of local maxtest {
gen `value'=.
forvalues m=1/3 {
replace `value'=test`m' if test1effort==`i'&test2effort==`i'&test3effort==`i'
}
}