Bookmark and Share

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: snapsan command


From   Steve Samuels <[email protected]>
To   [email protected]
Subject   Re: st: snapsan command
Date   Mon, 21 May 2012 12:27:14 -0400

Sara Bonafonti:

The explanation for the missing values is given in the Manual:

"In fact, the varlist specifies the variables that apply to the time span ending
at the time of the current snapshot. The other variables are assumed to be
measured at the time of the snapshot and thus apply from the time of the snapshot forward. Thus varlist should include retrospective variables."

Elaborating on Kieran's examples:
*****************************
//1
webuse snapspan, clear
snapspan id time  x1 x2 event
stset time, f(event) id(id)
list, sepby(id)
//2
webuse snapspan, clear
snapspan x1 id time event
stset time, f(event) id(id)
list, sepby(id)

//3
webuse snapspan, clear
snapspan id time event
stset time, f(event) id(id)
list, sepby(id)
******************************
In the second version, x2 is not specified in the -snapspan- statement, so is assumed
to become known only at the end of the first interval. Therefore x2 is not available
(and hence missing)  for the first interval. In the third version, you are telling
 Stata that neither x1 nor x2 was known at the start of the first interval.

Aside: If, in this data, x1 and x2 were known at the start of the first interval , then there is no need to run -snapspan- before -stset-.


Steve
[email protected]





On May 21, 2012, at 3:41 AM, sara bonfanti wrote:

I will try to formulate my problem in a clearer way...

I have no problem in running the snapsan  and the stcox command and I
have understood their purpose.

Still,after running the snapsan command I get an output I don't
exepct, namely the missing values.

My question is why such missing are generated?  The manual says
nothing about it (it just shows a picture of the dataset converted to
a time-span form which contains missing values in the first row) and
the other Stata users I've talked to couldn't explain it either.

Furthermore, If I run the stcox command and Stata ignores the missing
value created after running the snapsan command, can I consider the
output of my cox regression reliable?

Thanks

Sara

2012/5/19 Nick Cox <[email protected]>:
The command is -snapspan-, not -snapsan-. I think you didn't get an
answer to this previously because it's hard to work out what you want.
The tenor of your posting is "I don't understand" and that evokes
sympathy, but it is hard to know what explanation could make it
clearer than that in the manual.

The answer to 1) is that it depends what you mean "when I work on my
variables". Depending on that, the possibilities include nothing (the
Stata command will ignore missing values), using -if- to exclude
observations with missing values, and using -drop- to drop them.

The answer to 2) is No. -generate()- is genuinely optional.

For "STATA" read "Stata". For "cox" read "Cox".

Nick

On Sat, May 19, 2012 at 10:05 AM, sara bonfanti <[email protected]> wrote:

I'm stuck with my work beacuse of these problems.

I'm using STATA 12.1. In order to run a cox regression (stcox) I have
reshaped my dataset form wide to long and, then, I have run the
command
"snapsan".

I wonder:

1) why, after running the command "snapsan", I get for each individual
a first row (corresponding to the first year of my longitudinal
database,
i.e. 1997) of missing values except for the event variable. Reading
the stata manual it seems a correct output but I don愒 know how to
deal with these missing values later on, when I work on my variables.


2) if it愀 necessary to specify the option "generate(newt0var)". I
have found it on manuals, but still I don愒 understand how it works,
and why I should use it.


*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index