Hi all,
I'm trying to produce a few scatterplots with the foreach command. The idea is to have the first variable of varlist1 plotted against the first variable of varlist2, then the second variable of varlist1 against the second element of varlist2, and so on ... So I would like to end up with 4 plots (not 16).
I couldn't find any hints on how to do this and tried it like this:
local varlist1 A1 A2 A3 A4
local varlist2 B1 B2 B3 B4
foreach var of varlist1 & var2 of varlist2 {
scatter `var' `var2'
}
Stata returns "invalid syntax". Any ideas on how to do this would be highly appreciated!
Thanks, Tobias
I'm trying to produce a few scatterplots with the foreach command. The idea is to have the first variable of varlist1 plotted against the first variable of varlist2, then the second variable of varlist1 against the second element of varlist2, and so on ... So I would like to end up with 4 plots (not 16).
I couldn't find any hints on how to do this and tried it like this:
local varlist1 A1 A2 A3 A4
local varlist2 B1 B2 B3 B4
foreach var of varlist1 & var2 of varlist2 {
scatter `var' `var2'
}
Stata returns "invalid syntax". Any ideas on how to do this would be highly appreciated!
Thanks, Tobias
Comment