Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: saving graphs

From   "Nick Cox" <>
To   <>
Subject   st: RE: saving graphs
Date   Sat, 16 Aug 2003 16:21:44 +0100

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 

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 

. 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


*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index