When programming in Stata I often find myself using the loop index in the programming. For example, I\'ll loop over a list of the variables nominalprice and realprice:
As other people have intimated, this would be easier if you had a dataframe with columns named nominalprice
and realprice
. If you do not, you could always use get
. You shouldn't need parse
at all here.
clist <- c("nominalprice", "realprice")
for (i in clist) {
png(paste("c:/TimePlot-",i,".png"), sep="")
plot(time, get(i))
dev.off()
}