Statalist


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

st: RE: xtline by subgroups within panel


From   "Nick Cox" <[email protected]>
To   <[email protected]>
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' 

Nick 
[email protected] 

Johanna Vogel

I have a panel of European regions over time. I would like to plot a
variable
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
countries
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
using
the "if" option. But I have not found a way to get all the
country-specific
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
same
number to all regions of a country, and then run "xtline ...,
by(country)".


*
*   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/



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