Hi all,
I am not familiar with the foreach command and have been trying to loop a twoway scatterplot command to create many scatterplots at once of different variables against the same dependent variable (and also graph a linear fit over each scatterplot) in separate graphs.
My code is as below:
foreach var of varlist v1-v127 {graph twoway (scatter `var' dependentvar) (lfit `var' dependentvar)}
The error it gives me is:
program error: code follows on the same line as open brace
I'm not really sure what I'm doing wrong- any insight would be greatly appreciated.
Related Posts with Using foreach to graph many variables vs one dependent variable on separate graphs
Help for nonlinear dynamic panel models with fixed effects (count data)Hi, I recently suffered from confusion about dynamic panel models with fixed effects for count data…
To NAME: excel export using value of variable.input forvalues i=1(1)300 { display `i' clear all display Area[1] use "data (`i').dta" export excel …
Choosing the order of polynomial in -rdplotHello, I'm using the rdrobust package and I want to plot the output of my rdd, how do I decide which…
Keeping specific observations within groupsHi everyone, I am having difficulties wrapping my head around the following problem: I have a pane…
replacing the missing values with the other variable setHi, I am concerned with how to convert missing values with the values of the other variable set. For…
Subscribe to:
Post Comments (Atom)
0 Response to Using foreach to graph many variables vs one dependent variable on separate graphs
Post a Comment