Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Loop: matching variables (in order)
From
Nick Bornschein <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: Loop: matching variables (in order)
Date
Wed, 20 Nov 2013 16:12:25 +0100
Hello,
I have written the following loop, but there is a mistake when
creating the graphs I cannot solve.
First of all, I have an ordered list of x variables and an ordered
list of y variables. I want to create an graph (tsline) with 2 lines,
where I want use the first variable of the x variables and the first
variable of the y variables, then I want to create the next graph with
2 lines with the second variable of the x variables and the second
variable of the y variables. How can I write that into the loop?
foreach x of varlist apple-biorad {
foreach y of varlist apple_m30-biorad_m30 {
tsline `x' if datum >= `=date("01jan2010", "DMY")' || tsline `y'
if datum >= `=date("01jan2010", "DMY")'
graph export Grafiken/`x'_m30.png, replace
}
}
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/