Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

Re: st: Graphing longitudinal profiles

 From Thomas Speidel To Subject Re: st: Graphing longitudinal profiles Date Thu, 01 Dec 2011 11:03:56 -0700

```Thank you Maarten, that solved my problem.

Thomas

On Thu, 1 Dec 2011 17:40:34 +0100, Maarten Buis wrote:

```
```On Thu, Dec 1, 2011 at 5:26 PM, Thomas Speidel wrote:

```
```I am having difficulties creating a connected line graph for a
longitudinal dataset.Notice the vertical line going from 13 to 19 on
the y-axis. Why?
```
```
```
The problem are the missing values. The conect(L) starts a new line if t[_n+1] < t[_n]. So for id 88 to id 93 there will be a line going from
```19 to 14 at t=0, which is not what you want. One solution is in the
example below:

*------------ begin example ------------
drop _all
input id time value
84 0 15
84 1 18
84 2 17
88 0 19
88 1 .
88 2 .
93 0 14
93 1 19
93 2 19
94 0 16
94 1 20
94 2 20
97 0 13
97 1 .
97 2 .
98 0 17
98 1 19
98 2 20
99 0 17
99 1 18
99 2 20
end
sort id time
gen byte notmiss = !missing(value)
bys id : egen Nnotmist = total(notmiss)
twoway line value time if Nnotmist >=2 , connect(L)
*---------------- end example -----------------

Hope this helps,
Maarten

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://www.maartenbuis.nl [2]
--------------------------
*
* For searches and help try:
* http://www.stata.com/help.cgi?search [3]
* http://www.stata.com/support/statalist/faq [4]
* http://www.ats.ucla.edu/stat/stata/ [5]
```
```

------
[1] mailto:thomas@tmbx.com
[2] http://www.maartenbuis.nl
[3] http://www.stata.com/help.cgi?search
[4] http://www.stata.com/support/statalist/faq
[5] http://www.ats.ucla.edu/stat/stata/

--
Thomas Speidel
*
*   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/
```