Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
re: st: understanding the -asis()- option in -stsplit-
From
"Jesper Lindhardsen" <[email protected]>
To
<[email protected]>
Subject
re: st: understanding the -asis()- option in -stsplit-
Date
Thu, 24 Nov 2011 09:00:37 +0100
Hi there,
Even though it seems that I am alone in my troubles with understanding the -asis()- option in -stsplit-, I thought others may have the same difficulties in the future. In the essence, I confused spells and individuals. Here is an extract of my Statatech correspondence:
--→
I understand your concern. Actually, the command -stsplit- is not intended to split on a variable that varies within individual. The option -asis()- works like more -force- options, just bypassing the checkings that the variable should be constant within individual. Notice that splitting is always performed within individual, not within spell. That is, -stsplit- will go back to the spell where the time to split is, within individual. I realize that our documentation could be more clear on this aspect, and I'll make a note about this.
The solution we provided (me: use -stset- on spells, split and then stset on individuals again) would work for your particular case, and it could be generalized to many cases by using -stset- with copies of your "underscore" variables. Let me know if you want more examples on that.
<-----
HTH (someone),
Jesper
Jesper Lindhardsen
MD, PhD candidate
Department of Cardiovascular Research
Copenhagen University Hospital, Gentofte
Denmark
--------------------------
Original post:
Hi All,
This may be simple, but I am having a hard time with a futher split (-stsplit-) of multiepisode survival data (Stata 11.2/MP on windows server).
Basically I want to split some of the observations within an individual, if exposed, into several new observations. However, this (I figure) causes the offset (-after()- option) to vary within individuals, which forces the use of the -asis()- option-. But I cannot figure out the proper use, and the documentation on this option is scarse.
In the below very simplified example, I want to split the episodes with changevar==1 to be further divided in two, however, this does not work (only one of two episode is splitted).
I’ve tried several other stsplit commands, but no succes.
clear all
input time id changevar event
30 1 . 0
40 1 1 0
50 1 . 0
60 1 1 0
end
stset time, id(id) f(event)
stsplit hej if changevar==1,at(2) after(time=asis(_t0))
sort time
Hope you can help,
Jesper
Jesper Lindhardsen
MD, PhD candidate
Department of Cardiovascular Research
Copenhagen University Hospital, Gentofte Denmark
*
* 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/