Hello,
Let's say I have a .dta file with 4 variables. Three of them are dichotomic and the last one contains a string that refers to the other variables' names; something like:
I'm trying to run a set of multiple logistic regressions. Is it possible to use C4 in some way to run the regressions instead of typing each variable separately? I tried as follows:
(Note that I need C1 to always be the indep. var. and put C4 always afterwards so it "inputs" the other dep. vars.).
Stata doesn't seem to recognize it though. I tried changing C4 [i] and S' syntax and the following errors appear in some cases: "S invalid name or 1 unknown weight type. The rest of the cases, Stata seems to run the logistic regressions, but only "_cons" is shown so I believe it's not doing it properly.
Thanks in advance!
Let's say I have a .dta file with 4 variables. Three of them are dichotomic and the last one contains a string that refers to the other variables' names; something like:
C1 | C2 | C3 | C4 |
1 | 0 | 0 | C1 C2 |
1 | 1 | 0 | C3 C1 |
0 | 1 | 1 | C3 C2 |
0 | 1 | 1 | C1 C2 C3 |
(Note that I need C1 to always be the indep. var. and put C4 always afterwards so it "inputs" the other dep. vars.).
Code:
forval i=1/4{ local S C4[`i'] logistic C1 `"S"'
Thanks in advance!
Comment