Hello I am trying to run 11 separate regressions. One with each of the local vars as a single predictor and "bbq_trans_rc" as the outcome.

The code I have used is below but I keep getting the following error message: "{ required"

I think it has to do with my use of "local" but I have not been able to diagnose it.

Advice is appreciated!


local var ptfidelity_1_ ptfidelity_2_ ptfidelity_3_ ptfidelity_4_ ptfidelity_5_ ///
ptfidelity_6_ ptfidelity_7_ ptfidelity_8_ ptfidelity_9_ ptfidelity_10_ ptfidelity_11_
foreach var of local varlist ptfidelity_1_ ptfidelity_2_ ptfidelity_3_ ptfidelity_4_ ptfidelity_5_ ///
ptfidelity_6_ ptfidelity_7_ ptfidelity_8_ ptfidelity_9_ ptfidelity_10_ ptfidelity_11_ {
regress bbq_trans_rc `var'
}


Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input int record_id float bbq_trans_rc byte(ptfidelity_1_ ptfidelity_2_ ptfidelity_3_ ptfidelity_4_ ptfidelity_5_ ptfidelity_6_ ptfidelity_7_ ptfidelity_8_ ptfidelity_9_ ptfidelity_10_ ptfidelity_11_)
 2   27.8 1 1 1 1 0 1 1 1 0 1 0
 2 -25.02 1 1 1 1 0 1 1 1 0 1 0
 4  63.94 . . . . . . . . . . .
 5  47.26 1 1 1 0 1 1 0 1 1 1 1
 5 -25.02 1 1 1 0 1 1 0 1 1 1 1
 5  61.16 1 1 1 0 1 1 0 1 1 1 1
 5  66.72 1 1 1 0 1 1 0 1 1 1 1
 8  25.02 1 1 1 1 1 1 1 1 1 1 1
 8 -25.02 1 1 1 1 1 1 1 1 1 1 1
 8  33.36 1 1 1 1 1 1 1 1 1 1 1
 9  44.48 1 1 1 0 1 1 1 1 1 1 1
 9 -25.02 1 1 1 0 1 1 1 1 1 1 1
 9  88.96 1 1 1 0 1 1 1 1 1 1 1
 9   69.5 1 1 1 0 1 1 1 1 1 1 1
13  38.92 1 1 1 0 0 1 1 1 0 1 1
13 -25.02 1 1 1 0 0 1 1 1 0 1 1
13  77.84 1 1 1 0 0 1 1 1 0 1 1
13  88.96 1 1 1 0 0 1 1 1 0 1 1
14  38.92 1 1 1 1 1 1 1 1 1 1 1
14 -25.02 1 1 1 1 1 1 1 1 1 1 1
14  36.14 1 1 1 1 1 1 1 1 1 1 1
14  36.14 1 1 1 1 1 1 1 1 1 1 1
16   69.5 1 1 1 0 1 1 1 1 1 1 1
16 -25.02 1 1 1 0 1 1 1 1 1 1 1
16  86.18 1 1 1 0 1 1 1 1 1 1 1
17  38.92 . . . . . . . . . . .
19  63.94 1 1 1 0 1 1 0 0 1 1 1
19 -25.02 1 1 1 0 1 1 0 0 1 1 1
19   69.5 1 1 1 0 1 1 0 0 1 1 1
19  61.16 1 1 1 0 1 1 0 0 1 1 1
21  77.84 1 1 1 1 1 1 0 1 0 1 0
21 -25.02 1 1 1 1 1 1 0 1 0 1 0
21  66.72 1 1 1 1 1 1 0 1 0 1 0
21  75.06 1 1 1 1 1 1 0 1 0 1 0
22  50.04 1 1 1 0 1 1 1 1 1 1 1
22 -25.02 1 1 1 0 1 1 1 1 1 1 1
22  61.16 1 1 1 0 1 1 1 1 1 1 1
22   55.6 1 1 1 0 1 1 1 1 1 1 1
23  75.06 1 1 1 0 1 1 0 1 0 1 1
23 -25.02 1 1 1 0 1 1 0 1 0 1 1
23  75.06 1 1 1 0 1 1 0 1 0 1 1
23   83.4 1 1 1 0 1 1 0 1 0 1 1
25   69.5 1 1 1 0 1 1 0 0 0 1 0
25 -25.02 1 1 1 0 1 1 0 0 0 1 0
25  61.16 1 1 1 0 1 1 0 0 0 1 0
25  61.16 1 1 1 0 1 1 0 0 0 1 0
26   41.7 1 0 0 0 0 0 0 0 1 0 0
26 -25.02 1 0 0 0 0 0 0 0 1 0 0
26  52.82 1 0 0 0 0 0 0 0 1 0 0
26   69.5 1 0 0 0 0 0 0 0 1 0 0
27   69.5 1 1 1 1 1 1 1 1 1 1 1
27 -25.02 1 1 1 1 1 1 1 1 1 1 1
27  58.38 1 1 1 1 1 1 1 1 1 1 1
27  63.94 1 1 1 1 1 1 1 1 1 1 1
28  58.38 1 0 1 0 1 1 1 1 1 1 1
28 -25.02 1 0 1 0 1 1 1 1 1 1 1
28  33.36 1 0 1 0 1 1 1 1 1 1 1
28  44.48 1 0 1 0 1 1 1 1 1 1 1
29   55.6 1 0 1 0 0 1 0 0 0 1 1
29 -25.02 1 0 1 0 0 1 0 0 0 1 1
29   69.5 1 0 1 0 0 1 0 0 0 1 1
29  75.06 1 0 1 0 0 1 0 0 0 1 1
32  22.24 1 1 1 1 0 0 0 0 1 0 1
32 -25.02 1 1 1 1 0 0 0 0 1 0 1
32   27.8 1 1 1 1 0 0 0 0 1 0 1
32  19.46 1 1 1 1 0 0 0 0 1 0 1
33   41.7 1 1 1 1 1 1 1 1 0 1 1
33 -25.02 1 1 1 1 1 1 1 1 0 1 1
33  61.16 1 1 1 1 1 1 1 1 0 1 1
34  86.18 1 0 0 0 1 1 1 1 1 1 1
34 -25.02 1 0 0 0 1 1 1 1 1 1 1
34  86.18 1 0 0 0 1 1 1 1 1 1 1
34 100.08 1 0 0 0 1 1 1 1 1 1 1
36  50.04 1 1 1 1 1 1 1 1 1 1 1
36 -25.02 1 1 1 1 1 1 1 1 1 1 1
36  61.16 1 1 1 1 1 1 1 1 1 1 1
36  61.16 1 1 1 1 1 1 1 1 1 1 1
38  47.26 0 0 0 0 0 1 0 0 0 0 0
38 -25.02 0 0 0 0 0 1 0 0 0 0 0
38  47.26 0 0 0 0 0 1 0 0 0 0 0
38  30.58 0 0 0 0 0 1 0 0 0 0 0
42   55.6 1 1 0 0 1 1 1 1 1 1 1
42 -25.02 1 1 0 0 1 1 1 1 1 1 1
42  66.72 1 1 0 0 1 1 1 1 1 1 1
42  80.62 1 1 0 0 1 1 1 1 1 1 1
43  58.38 1 0 0 1 1 1 0 1 0 1 1
43 -25.02 1 0 0 1 1 1 0 1 0 1 1
43  66.72 1 0 0 1 1 1 0 1 0 1 1
43  77.84 1 0 0 1 1 1 0 1 0 1 1
45  66.72 1 0 0 0 0 0 0 0 1 1 0
45 -25.02 1 0 0 0 0 0 0 0 1 1 0
45  72.28 1 0 0 0 0 0 0 0 1 1 0
45  72.28 1 0 0 0 0 0 0 0 1 1 0
47  50.04 1 1 1 1 0 0 0 0 1 1 1
47 -25.02 1 1 1 1 0 0 0 0 1 1 1
47  50.04 1 1 1 1 0 0 0 0 1 1 1
47  50.04 1 1 1 1 0 0 0 0 1 1 1
49  63.94 . . . . . . . . . . .
51  36.14 1 1 1 1 1 1 1 1 1 1 1
51 -25.02 1 1 1 1 1 1 1 1 1 1 1
end
label values ptfidelity_1_ pt_fidelity_1_
label def pt_fidelity_1_ 0 "No", modify
label def pt_fidelity_1_ 1 "Yes", modify
label values ptfidelity_2_ pt_fidelity_2_
label def pt_fidelity_2_ 0 "No", modify
label def pt_fidelity_2_ 1 "Yes", modify
label values ptfidelity_3_ pt_fidelity_3_
label def pt_fidelity_3_ 0 "No", modify
label def pt_fidelity_3_ 1 "Yes", modify
label values ptfidelity_4_ pt_fidelity_4_
label def pt_fidelity_4_ 0 "No", modify
label def pt_fidelity_4_ 1 "Yes", modify
label values ptfidelity_5_ pt_fidelity_5_
label def pt_fidelity_5_ 0 "No", modify
label def pt_fidelity_5_ 1 "Yes", modify
label values ptfidelity_6_ pt_fidelity_6_
label def pt_fidelity_6_ 0 "No", modify
label def pt_fidelity_6_ 1 "Yes", modify
label values ptfidelity_7_ pt_fidelity_7_
label def pt_fidelity_7_ 0 "No", modify
label def pt_fidelity_7_ 1 "Yes", modify
label values ptfidelity_8_ pt_fidelity_8_
label def pt_fidelity_8_ 0 "No", modify
label def pt_fidelity_8_ 1 "Yes", modify
label values ptfidelity_9_ pt_fidelity_9_
label def pt_fidelity_9_ 0 "No", modify
label def pt_fidelity_9_ 1 "Yes", modify
label values ptfidelity_10_ pt_fidelity_10_
label def pt_fidelity_10_ 0 "No", modify
label def pt_fidelity_10_ 1 "Yes", modify
label values ptfidelity_11_ pt_fidelity_11_
label def pt_fidelity_11_ 0 "No", modify
label def pt_fidelity_11_ 1 "Yes", modify
​​​​​​