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?
Related Posts with If else inside for each loop
How to loop over a merge of inconsistent variables over timeDear StataList. I need to merge two sets of data (partner + respondent) per wave for many waves. Th…
PPML indexHi, I am using PPML for my gravity model. One of my independent variables is an index. How can I i…
Plotting confidence intervals for simple exponential smoothing forecast resultsHello, everyone! I am currently trying to visualise the results of a simple exponential smoothing f…
Error with levelsof but not levels commandHi everyone, Has anyone experienced errors with levelsof not present with levels commands? This curi…
spatial autoregression (SAR) rho coefficientHi everyone, I am running a spatial autoregressive model (SAR) with stata commands spregress and sp…
Subscribe to:
Post Comments (Atom)
0 Response to If else inside for each loop
Post a Comment