Zang, Hailing
> I used the following code to save graphs in a loop before:
> levels t , local(levels)
> foreach l of local levels {
> graph bidprice cumq if t == `l', c(l) by(bid_qse)
> yscale(.,570) xscale
> (.,1000) saving(c:\g`l') t1(`l')
> translator query gph2wmf
> translator set gph2wmf scheme blackbg
> translator query gph2wmf
> translate c:\g`l'.gph c:\g`l'.wmf
> }
>
> But now when I type in the first line, there's a message
> saying "version 8
> not supported". So how to do such kind of saving graphs in
> the loop now?
I have to guess that
1. You are using Stata 7.
2. You downloaded -levels- from SSC soon after it was first
posted.
3. At some later point, you updated -levels- from SSC.
4. However, you overlooked the point that -levels- now
requires Stata 8. You need to use -levels7-, which is
in the same package on SSC. That should have been installed
when you updated -levels-. In any case, there is no harm in
typing
. ssc inst levels, replace
and then trying your code with -levels7-.
> Also, if I need to save graphs such as:
> by T zone: graph price quantity
>
> Is it sufficient just to change to "levels T zone, local levels"?
No; that is illegal for any version of -levels-. The
syntax includes
levels <varname> ...
A <varlist> with two or more variables is not allowed.
But if you want graphs for all combinations of two variables, you
can go
egen group = group(T zone)
levels group, local(levels)
foreach l of local levels {
...
}
although there are also other ways to do it, as
documented at
http://www.stata.com/support/faqs/data/foreach.html
Nick
[email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/