Bookmark and Share

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

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

Re: st: stset

From   Nick Cox <>
Subject   Re: st: stset
Date   Tue, 29 Jan 2013 20:14:10 +0000

Thanks for this, but I am still puzzled over what exactly you are seeking.

-stset- can be used in various ways, but they all centre on there
being a single time variable. So, if "wide format" means that time for
each subject is recorded, directly or indirectly, in several
variables, then you need a different data structure before you can
apply -st- commands.

I suggest that you look again at the Statalist FAQ, Questions are
easiest to answer when they include precise descriptions of the
dataset, precise commands that you used and precise results that Stata
gave in response.


On Tue, Jan 29, 2013 at 5:02 PM, Neophytos Stylianou

> I think you misunderstood me.
> I was just wondering if the stset works on both data formats, wide or long, since i did not know in which format my data was in..
> I just wanted to know that i am doing the right thing since i am new to survival data.
> Sorry for the misunderstanding.

Nick Cox []

> Manifestly I don't have any information that you have not given us.
> You told us that you had a "wide format" which I understand you to
> mean that you have several time variables and several survival
> variables. If that's wrong and -stset- works, then good, but I am left
> wondering why you posted and why you described your data in the way
> you did.

On Tue, Jan 29, 2013 at 3:56 PM, Neophytos Stylianou

>> By saying that it won't work do you mean? that the stset command would give me an error?
>> Because I am doing it and it does set the data.
>> In my dataset I have admission as well as discharge/death date per observation
>> In Statas manual the stset takes the form of:
>> stset failuretime, failure(mortality==1) id(id) enter =(admissiontime)
>> so why it would not work if my dataset as I showed an example earlier has unique observations that have the admission date as well as the discharge/death date?

Nick Cox

>> No; that won't work. You don't have a single time variable or survival variable. What makes you think that compatible with -stset-?
>> You need to -reshape- your data.

 On Tue, Jan 29, 2013 at 3:38 PM, Neophytos Stylianou

>>> I am about to perform some survival analysis and I need to set my dataset in survival data format.
>>> Will the stset command work when data is not in the correct format i.e wide instead of long?
>>> I have a dataset of many variables (550) and observations (60,000) in this format:
>>> Mortality       timeADM timeDisch           ID
>>> Survived        Jan2003 Jan2003 1
>>> Died                       Feb2004      Mar2004 2
>>> Survived        Jun2006 Aug2006 3
>>> From what is saw in the stset help file as well as Statas manual this will be ok but I am just worried it is not in the long format.
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index