help with proc phreg where statment

  • Follow


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!
0
Reply sasanalysis (11) 5/2/2010 9:27:47 PM

On May 2, 4:27=A0pm, sas analysis <sasanaly...@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 =A0 =A0visittime =A0 =A0 =A0 =A0event
> 1 =A0 =A0 =A0 =A0 0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 0
> 1 =A0 =A0 =A0 =A0 1 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 0
> 1 =A0 =A0 =A0 =A0 3 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 0
> 1 =A0 =A0 =A0 4.5 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A01
> 1 =A0 =A0 =A0 =A0 6 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 .
> 2 =A0 =A0 =A0 =A0 0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 1
> 2 =A0 =A0 =A0 =A0 2 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 .
> 2 =A0 =A0 =A0 =A0 3 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 .
> 2 =A0 =A0 =A0 =A0 5 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 .
> 3 =A0 =A0 =A0 =A0 0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 0
> 3 =A0 =A0 =A0 =A0 1 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 .
> 3 =A0 =A0 =A0 =A02.5 =A0 =A0 =A0 =A0 =A0 =A0 =A0 .
> 3 =A0 =A0 =A0 =A0 4 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 .
> 3 =A0 =A0 =A0 =A0 6 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 .
>
> 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 =3D x covs(aggregate);
> =A0 model (time0 vistime)*event(0) =3D gender/risklimits;
> =A0 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
0
Reply sas 5/2/2010 9:29:53 PM


1 Replies
525 Views

(page loaded in 0.057 seconds)

Similiar Articles:













7/25/2012 11:54:38 PM


Reply: