Statalist


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

st: AW: AW: xtline with missing data


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: AW: xtline with missing data
Date   Tue, 6 Oct 2009 23:55:02 +0200

<> 

Strangely, though, -xtline- seems to disregard the option -cmissing-
although I obtained it from the dialog box... 

When I recreate the -xtline- graph with repeated calls to -line-, I can get
it to respect the option, although it is a little cumbersome...



*************
clear*
set obs 4
gen id=_n
expand 10
bys id: gen time=_n
gen x=runiform()
xtset id time
replace x=. if runiform()<.3

forv i=1/4{
	tw (line x time if id==`i', /* 
	*/ cmiss(n)), name(gr`i', replace) /* 
	*/ nodraw title("`i'") xti("") /* 
	*/ yti("") yla(0 .5 1)
}

graph combine gr1 gr2 gr3 gr4,  /* 
*/ name(comb, replace) /* 
*/ note("Graphs by id")


xtline x, cmissing(y) name(wo, replace)
xtline x, cmissing(n)  /* 
*/ name(miss, replace)
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Martin Weiss
Gesendet: Dienstag, 6. Oktober 2009 23:31
An: [email protected]
Betreff: st: AW: xtline with missing data


<> 


Add the option -cmissing(n)- to -xtline-



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von John McAdams
Gesendet: Dienstag, 6. Oktober 2009 23:23
An: [email protected]
Betreff: st: xtline with missing data

Hi all,

I have a panel data set, and am trying to use "xtline" to graph a variable
over time for each panel unit.  However, the variable is missing for some
observations in some time periods.

When I run "xtline", it does not leave gaps during the periods with
missing data (it connects all the dots).  This leaves one with the
impression that there is in fact no missing data, which is not
satisfactory.

Is there a workaround to tell Stata not to connect dots when there is a
missing data point in between?  I tried adding an if statement to the
xtline call (i.e., xtline variable if variable != .), but that didn't
work.

I'm running Stata 10/SE.

Cheers,
John


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


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


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