BookmarkSubscribeRSS Feed
desireatem
Pyrite | Level 9

proc iml;

use kaplan;

read all  var{time Survival survival1};

close;

Survival1 = DM[,3]; Survival = DM[,2]; time = DM[,1];

n = nrow(DM);

   

segment = J(nrow(DM),1,1); print segment;

do i = 3 to nrow(DM);

if Survival1=Survival then SS=Survival1;

else if Survival1<Survival then SS=survival1-survival1[i+1];

end;

do i = 2 to nrow(DM);

if time=time then TT=time;

else if time<time then TT=time[i+1]-time;

end;

create kaplann var{time Survival survival1 TT DX DX};

append;

quit;

ERROR: (execution) Matrix has not been set to a value.

operation : [ at line 1985 column 16

operands  : DM, , *LIT1002

DM      0 row       0 col     (type ?, size 0)

*LIT1002      1 row       1 col     (numeric)

         3

statement : ASSIGN at line 1985 column 2

ERROR: (execution) Matrix has not been set to a value.

operation : [ at line 1985 column 35

operands  : DM, , *LIT1003

DM      0 row       0 col     (type ?, size 0)

*LIT1003      1 row       1 col     (numeric)

         2

statement : ASSIGN at line 1985 column 22

ERROR: (execution) Matrix has not been set to a value.

operation : [ at line 1985 column 50

operands  : DM, , *LIT1004

DM      0 row       0 col     (type ?, size 0)

*LIT1004      1 row       1 col     (numeric)

         1

statement : ASSIGN at line 1985 column 41

ERROR: (execution) Invalid operand to operation.

operation : J at line 1988 column 12

operands  : _TEM1001, *LIT1005, *LIT1006

_TEM1001      1 row       1 col     (numeric)

         0

*LIT1005      1 row       1 col     (numeric)

         1

*LIT1006      1 row       1 col     (numeric)

         1

statement : ASSIGN at line 1988 column 1

ERROR: Matrix segment has not been set to a value.

statement : PRINT at line 1988 column 28

WARNING: Variable DX already exists on file WORK.KAPLANN.

1 REPLY 1
desireatem
Pyrite | Level 9

proc iml;

use kaplan;

read all  var{TIME SURVIVAL SURVIVAL1} into DM;

close;

SURVIVAL1 = DM[,3]; SURVIVAL = DM[,2]; TIME = DM[,1];

n = nrow(DM);

   

segment = J(nrow(DM),1,1); *print segment;

SS=J(nrow(survival1),1,1);

do i = 1 to n ;

if i=n then SS=0;

else if i<n then SS=SURVIVAL1-SURVIVAL1[i+1];

end;

TT=J(nrow(time),1,1);

do i = 1 to n;

if i = n then TT=0;

else if i < n then TT=time[i+1]-time;

end;

create kaplann var{time Survival survival1 SS TT };

append;

quit;

proc print data=kaplann;

run;

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 1 reply
  • 1773 views
  • 0 likes
  • 1 in conversation