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 = 2 to nrow(DM);

SS=survival1-survival1[i-1];

TT=time[i+1]-time;

DX = SS*TT;

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 1545 column 34

operands  : DM, , *LIT1003

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

*LIT1003      1 row       1 col     (numeric)

         2

statement : ASSIGN at line 1545 column 21

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

operation : [ at line 1545 column 49

operands  : DM, , *LIT1004

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

*LIT1004      1 row       1 col     (numeric)

         1

statement : ASSIGN at line 1545 column 40

ERROR: (execution) Invalid operand to operation.

operation : J at line 1547 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 1547 column 1

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

statement : PRINT at line 1547 column 28

1 REPLY 1
Vince28_Statcan
Quartz | Level 8

Pretty sure you have figured that out in 5 days but you simply forgot to read your data INTO DM

so

proc iml;

use kaplan;

read all var{time survival survival1} into DM;

close;

Your DO loop will also crash as you will eventually  try to get time[dim(DM)+1] which is out of bounds. I don't know if it was intended that the time used differed from the survival columns used so I'll let you figure out how you change it, either change SS= and loop from 1 to dim(dm)-1 or change TT=

Vincent

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2051 views
  • 0 likes
  • 2 in conversation