Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Scott Merryman <scott.merryman@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Graph editor: Change order of subgraphs in bygraph ? |

Date |
Thu, 18 Aug 2011 09:58:01 -0500 |

I remember reading in Kit Baum's "An Introduction to Stata Programming" that *.gph files were actually programs to reproduce the graph. Looking back at section "10.5 Extracting data from graph files' sersets" shows that there is an easier way: //create original graph sysuse sp500,clear xtile g= date, n(4) twoway bar change date , by(g, rescale ) xlabel(, labsize(*.7)) graph save Graph "C:\Documents and Settings\scott.merryman\Desktop\Graph.gph",replace //extract data from graph cd "C:\Documents and Settings\scott.merryman\Desktop\" clear* serset clear graph use "Graph.gph" serset dir serset forv i = 0/`=r(id)' { serset set `i' serset use gen group = `=`i'+1' save temp`i'.dta,replace local files "`files' temp`i'.dta " } clear append using `files' clonevar gr2 = group replace gr2 = 4 if group == 1 replace gr2 = 1 if group==4 label define group 1 "4" 2 "2" 3 "3" 4 "1" label value gr2 group twoway bar change date , by(gr2, rescale ) /// xlabel(, labsize(*.7)) name(graph_new,replace) Hope this helps, Scott On Thu, Aug 18, 2011 at 1:52 AM, Jesper Lindhardsen <JESLIN01@geh.regionh.dk> wrote: > Scott, You are a lifesaver. This works perfectly. I must confess I am > intrigued as to how you came up with this solution? > On a personal note, I do think one should have this possibility > available from inside the editor, rather than hacking stata graph > files!!!!! > > Thanks, > > Jesper > * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**RE: st: Graph editor: Change order of subgraphs in bygraph ?***From:*"Jesper Lindhardsen" <JESLIN01@geh.regionh.dk>

**References**:**st: Graph editor: Change order of subgraphs in bygraph ?***From:*"Jesper Lindhardsen" <JESLIN01@geh.regionh.dk>

**Re: st: Graph editor: Change order of subgraphs in bygraph ?***From:*Scott Merryman <scott.merryman@gmail.com>

**RE: st: Graph editor: Change order of subgraphs in bygraph ?***From:*"Jesper Lindhardsen" <JESLIN01@geh.regionh.dk>

- Prev by Date:
**Re: st: RE: Percentiles with basic statistics** - Next by Date:
**st: Looping through graphs w/ foreach?** - Previous by thread:
**RE: st: Graph editor: Change order of subgraphs in bygraph ?** - Next by thread:
**RE: st: Graph editor: Change order of subgraphs in bygraph ?** - Index(es):