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 import tabstat results to data editor?Hello, I want to know to import the tabstat results to a stata data editor. I am using the followin…
-order(c.(A C B)#c.X) option does not work with esttab?Dear all, I use the following commands to make a table: eststo: reg Y c.(A B C)#c.X esttab, order(…
grmap without shapefileDear Statalist members, Under the framework of spatial analysis, I have a dataset with coordinates …
how to systemmatically change data entry 200thousand alike into 200000many thanks! …
How to loop over columns of 70 to get the categorical counts based on a particular observation?Hi all, I've a hospital cases dataset having 30 columns and 70 observations. Based on the types of …
Subscribe to:
Post Comments (Atom)
0 Response to If else inside for each loop
Post a Comment