I am trying to run the following code and it does not seem to be working. I want to change the reference category for houseExp_pp_cat4 and youngChildAge_cat3.
foreach x of varlist edu_cat2 employmentType_n workingHourPerWeek_cat3 opdVisit_noDep medicalExam sleep_cat2 drink_cat2 smoke_cat2 homeType_cat2 nuclear_cat2 houseExp_pp_cat4
youngChildAge_cat3 totalChild18_cat2 {
if `x' != houseExp_pp_cat4 | `x' != youngChildAge_cat3 {
logistic k6cat2v2 i.`x'
}
else {
logistic k6cat2v2 ib2.`x'
}
}
Could anyone please help me figure out what the problem is?
0 Response to If else inside for each loop
Post a Comment