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
Plotting result of table functionSorry a very basic question. To get a table I run: table year city [pw=E], c(mean W) and get the …
Creating two groups based on a continuous variable OK, for the sake of transparency, this is not a work issue... I am a clinician-scientist and just c…
Continuous or discrete variable?Hello. I have a question regarding a variable I have constructed. For a number of countries, I have…
Descriptive statistic in panel analysis multiple ifsHello to all, I’m using STATA 16. I have a panel data frame with 2 waves. Before and while the Coron…
Formatting Local with Date in Graph NoteHello everyone, I want to include the date of last data actualization in the notes of a graph. Ther…
Subscribe to:
Post Comments (Atom)
0 Response to Using foreach to graph many variables vs one dependent variable on separate graphs
Post a Comment