From: sas analysis on
Hi Everyone,

I want to run cox proportional hazard models using a longitudinal
dataset.
I want sas to recognize subjects that had events at baseline and that
had only baseline visits in the statement and not include them in the
analysis. I was able to solve this by simply deleting those subjects
from the dataset. but I would like an alternative to that, given that
I do not like deleting anyone.

This is an example of how my data looks (with 3 possible simulations):

ID visittime event
1 0 0
1 1 0
1 3 0
1 4.5 1
1 6 .
2 0 1
2 2 .
2 3 .
2 5 .
3 0 0
3 1 .
3 2.5 .
3 4 .
3 6 .

In this case, I want sas to only include ID1 in the phreg analysis
since subject 2 had the event at baseline and subject 3 only had visit
0. I tried using the where statement to the following code after
creating a lagtime.

proc phreg data = x covs(aggregate);
model (time0 vistime)*event(0) = gender/risklimits;
id id;
run;

any ideas?

Thanks!
From: sas analysis on
On May 2, 4:27 pm, sas analysis <sasanaly...(a)gmail.com> wrote:
> Hi Everyone,
>
> I want to run cox proportional hazard models using a longitudinal
> dataset.
> I want sas to recognize subjects that had events at baseline and that
> had only baseline visits in the statement and not include them in the
> analysis. I was able to solve this by simply deleting those subjects
> from the dataset. but I would like an alternative to that, given that
> I do not like deleting anyone.
>
> This is an example of how my data looks (with 3 possible simulations):
>
> ID    visittime        event
> 1         0                 0
> 1         1                 0
> 1         3                 0
> 1       4.5                1
> 1         6                 .
> 2         0                 1
> 2         2                 .
> 2         3                 .
> 2         5                 .
> 3         0                 0
> 3         1                 .
> 3        2.5               .
> 3         4                 .
> 3         6                 .
>
> In this case, I want sas to only include ID1 in the phreg analysis
> since subject 2 had the event at baseline and subject 3 only had visit
> 0. I tried using the where statement to the following code after
> creating a lagtime.
>
> proc phreg data = x covs(aggregate);
>   model (time0 vistime)*event(0) = gender/risklimits;
>   id id;
> run;
>
> any ideas?
>
> Thanks!

oops one more thing...subject 3 only has visit 0 so it should look
like this

ID vistime event
3 0 0