Statistical programming, matrix languages, and more

statement not valid or used out of proper order

Reply
Super Contributor
Posts: 271

statement not valid or used out of proper order

NOTE: Line generated by the invoked macro "SURV".

26    (InverseC^=0))]; print t;  tt=t(t); *print tt;

26  ! Big[(k-1)*10+(1:10),1Smiley Sadsum(censored=1)+1)]=survival1*t(t); end;   create GIB_&p from

26  ! BIG[colname={COL1}]; append from BIG; quit;            ;          end; *print InverseC;

                                                                        ---

                                                                        180

ERROR 180-322: Statement is not valid or it is used out of proper order.

proc iml;

use man;

read all var{ Replicate time censored obs y Frequency SURVIVAL1 SurvivalM InverseC } into DM;

close;                                                                                     /*close the link between the dataset and IML*/

  InverseC=DM[,9];SurvivalM=DM[,8];survival1=DM[,7]; frequency=DM[,6]; y=DM[,5];obs =DM[,4]; censored=DM[,3]; time= DM[,2]; replicate = DM[,1];   /*Survivalival is second column*/  /*time is first column*/

n = nrow(byGroup);

u = unique(Replicate);

BIG=J(20,10,-1) ;

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

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

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

do k = 1 to nrow(byGroup);

     byGroup = DM[loc(replicate=u),];

    InverseC=byGroup[,9];SurvivalM=byGroup[,8]; survival1=byGroup[,7];frequency=byGroup[,6];y=byGroup[,10];obs =byGroup[,4]; censored =byGroup[,3]; time= byGroup[,2]; replicate= byGroup[,1];  

t=InverseC[(loc(InverseC^=0))]; print t;

tt=t(t); print tt;

Big[(k-1)*10+(1:10),1Smiley Sadsum(censored=1)+1)]=survival1*(tt);

end;

create GIB_1 from BIG[colname={COL1}];                              

append from BIG;

quit;

Grand Advisor
Posts: 9,748

Re: statement not valid or used out of proper order

Looks like end of comment without a starting /*

Super Contributor
Posts: 271

Re: statement not valid or used out of proper order

I start with a do...

                  end;

see below;

do k = 1 to nrow(byGroup);

     byGroup = DM[loc(replicate=u),];

    InverseC=byGroup[,9];SurvivalM=byGroup[,8]; survival1=byGroup[,7];frequency=byGroup[,6];y=byGroup[,10];obs =byGroup[,4]; censored =byGroup[,3]; time= byGroup[,2]; replicate= byGroup[,1];   

t=InverseC[(loc(InverseC^=0))]; print t;

tt=t(t); print tt;

Big[(k-1)*10+(1:10),1Smiley Sadsum(censored=1)+1)]=survival1*(tt);

end;

Grand Advisor
Posts: 16,366

Re: statement not valid or used out of proper order

The log shows append and quit, which I don't see in your code, so that's strange.

Can you post the whole log/code.

Super Contributor
Posts: 271

Re: statement not valid or used out of proper order

This is within a simulation, I run it for just one iteration, that is &p=1. The code has append and quit.  Your help is highly need Sir

Here is the log file:

data KMM_&p;

570  set testt_&p;

571  set KM_&p;

572  if censored=1 then SurvivalM=Survival1; else SurvivalM=Survival1;

573  if censored=1 then InverseC=1/survival1; else InverseC=0;

574  keep time  censored  y frequency survival1 obs replicate SurvivalM InverseC;

575  run;

576

577

578  proc iml;

579  use KMM_&p;

580  read all var{ Replicate time censored obs y Frequency SURVIVAL1 SurvivalM InverseC } into

580! DM;

581  close;

581!  /*close the link between the dataset and IML*/

582    InverseC=DM[,9];SurvivalM=DM[,8];survival1=DM[,7]; frequency=DM[,6]; y=DM[,5];obs

582! =DM[,4]; censored=DM[,3]; time= DM[,2]; replicate = DM[,1];   /*Survivalival is second

582! column*/  /*time is first column*/

583

584  n = nrow(byGroup);

585  u = unique(Replicate);

586  BIG=J(20,10,-1) ;

587  InverseC=J(nrow(survival1),1,1);

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

589  t=J(nrow(survival1),1,1);

590  do k = 1 to nrow(byGroup);

591       byGroup = DM[loc(replicate=u),];

592         *byIdx = loc(Replicate=u); /* the UNIQUE-LOC trick */

593          *byGroup = DM[byIdx,];           /* extract BY group */        /* extract BY group

593!  */

594      InverseC=byGroup[,9];SurvivalM=byGroup[,8]; survival1=byGroup[,7];

594! frequency=byGroup[,6];y=byGroup[,10];obs =byGroup[,4]; censored =byGroup[,3]; time=

594! byGroup[,2]; replicate= byGroup[,1];

595   t=InverseC[(loc(InverseC^=0))]; print t;

596   tt=t(t); *print tt;

597  Big[(k-1)*10+(1:10),1Smiley Sadsum(censored=1)+1)]=survival1*t(t);

598  end;

599

600

601  create GIB_&p from BIG[colname={COL1}];

602  append from BIG;

603  quit;

604

605

606

OTE: There were 20 observations read from the data set WORK.TESTT_1.

NOTE: There were 20 observations read from the data set WORK.KM_1.

NOTE: The data set WORK.KMM_1 has 20 observations and 9 variables.

NOTE: DATA statement used (Total process time):

      real time           0.00 seconds

      cpu time            0.00 seconds

NOTE: IML Ready

NOTE: Closing WORK.KMM_1

NOTE: Exiting IML.

NOTE: The data set WORK.GIB_1 has 20 observations and 10 variables.

NOTE: PROCEDURE IML used (Total process time):

      real time           0.01 seconds

      cpu time            0.01 seconds

NOTE: Line generated by the invoked macro "SURV".

26   (InverseC^=0))]; print t;  tt=t(t); *print tt;

26 ! Big[(k-1)*10+(1:10),1Smiley Sadsum(censored=1)+1)]=survival1*t(t); end;   create GIB_&p from

26 ! BIG[colname={COL1}]; append from BIG; quit;            ;          end; *print InverseC;

                                                                       ---

                                                                       180

ERROR 180-322: Statement is not valid or it is used out of proper order.

Post a Question
Discussion Stats
  • 4 replies
  • 762 views
  • 0 likes
  • 3 in conversation