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

st: RE: xtline by subgroups within panel

From   "Nick Cox" <>
To   <>
Subject   st: RE: xtline by subgroups within panel
Date   Thu, 19 Mar 2009 15:48:03 -0000

I think you need to loop over countries and then use -graph combine-.
Here is a code sketch: 

egen country2 = group(country) 
sum country2, meanonly 

forval i = 1/`r(mean)' { 
	xtline response time if country2 == `i' , overlay name(gr`i') 
	local graphs `graphs' gr`i'

graph combine `graphs' 


Johanna Vogel

I have a panel of European regions over time. I would like to plot a
against time for these regions grouped by countries - that is, I would
like to
have all the regions of one country in one plot, and the plots of all
together on the same overall graph.

I can create one single graph containing all regions of a particular
country by
using "xtline ... , overlay" and specifying all regions of that country
the "if" option. But I have not found a way to get all the
plots together on one graph.

I've tried "addplot xtline" which does not work. Also, the "by" option
is not
allowed, so that I cannot define a variable "country" which assigns the
number to all regions of a country, and then run "xtline ...,

*   For searches and help try:

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