Hi all,

I am using Stata 17 and would need some help in my loops. Below is an example of my dataset:

Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input byte(korea uk germany Four_WD) double engine_sizeL byte(turbo_premium full_manual full_airbags tire_pressure_monitor parking_aid transmission_warranty) int(person_1 person_2)
0 0 0 0 3.5 0 0 0 1 0  6 .  30
0 0 1 1   3 0 0 0 1 1  4 .  45
0 0 0 1 3.5 0 0 0 1 1  5 .  40
0 1 0 1   2 0 0 0 1 0  4 .  60
0 0 0 0 2.7 1 0 0 1 0  5 .  50
1 0 0 0 1.6 0 0 0 1 0 10 .  50
0 0 0 1 4.6 0 0 1 1 0  6 .  90
0 0 0 0 3.6 0 0 1 1 1  6 .  50
0 0 0 1   2 0 0 0 1 0  5 .  45
0 0 0 1 3.6 0 1 0 1 0  5 .  50
0 1 0 1   2 0 0 0 1 0  5 . 100
0 0 0 1 5.7 0 0 0 1 1  5 .  40
0 0 0 1 3.5 1 0 0 1 1  5 .  40
0 0 0 0 6.2 0 1 0 0 1  5 .  45
0 0 0 1 2.4 0 0 0 1 0  4 .  40
1 0 0 0 1.6 0 0 0 1 0 10 .  40
0 0 0 1 5.7 0 0 1 1 1  6 .  90
0 0 1 1 2.9 1 0 1 1 1  4 .  90
0 0 1 1   4 1 0 1 1 1  4 .  60
0 0 0 0 2.5 0 0 0 1 0  5 .  55
0 0 0 0 2.4 0 0 0 1 0  5 .  45
0 0 0 1   2 0 0 0 1 0 10 .  40
0 0 1 1   3 1 0 0 1 0  4 .  70
0 0 0 1 3.5 1 0 0 1 0  5 .  55
0 0 0 0 1.4 0 1 0 1 1  4 .  40
0 0 1 1 3.6 0 0 1 1 1  4 .  75
0 0 0 0   2 0 0 0 1 1  6 .  55
0 1 0 1   3 0 0 0 1 1  5 .  80
1 0 0 1 2.4 0 0 0 1 0 10 .  60
0 0 1 1   4 1 0 1 1 1  4 .  50
0 0 0 1 2.4 0 1 0 1 0  5 .  50
1 0 0 0 3.3 1 0 1 1 1 10 .  75
0 0 0 0 1.6 0 1 0 1 0  5 .  45
0 0 0 0   2 0 0 0 1 0  6 .  65
1 0 0 0   2 0 0 0 1 1 10 .  40
0 0 0 1 4.2 0 0 0 0 1  6 .  65
1 0 0 0 3.3 0 0 0 1 0 10 .  45
0 1 0 1   3 0 0 0 1 1  5 .  85
0 0 0 1 2.5 0 0 0 1 1  5 .  50
0 0 0 1 3.5 1 0 0 1 0  5 .  50
end

I want to run a loop running regressions using this code:

Code:
foreach y of varlist person_* {
    reg `y' korea uk germany engine_sizeL turbo_premium full_manual Four_WD full_airbags tire_pressure_monitor parking_aid transmission_warranty  if  auto_id>40, robust
}
But as you can see, person_1 has no values at all. I need to know how do I make sure the loop ignores variables that have missing values? I got a "no observations" error message whenever I run the loop. What I want the loop to do is to ignore the missing values and continue to run on other variables.

Any help in this area would be appreciated. Thanks!