BookmarkSubscribeRSS Feed
ejay0503
Obsidian | Level 7

Dear all, 

 

I am trying to create a time-dependent variable in a cox proportional hazard model, using the counting process, which is guided by http://support.sas.com/resources/papers/proceedings12/168-2012.pdf

 

Unfortunately, I keep seeing this error message below. 

ERROR 161-185: No matching DO/SELECT statement.

 

579  data perm.habc_cox10;
580      set perm.habc_cox9;
581
582      array symptotal_(*) symptotal_1 - symptotal_12;
583      array chng (11);
584      t= 1;
585      do i = 2 TO 12;
586          if symptotal_(i) NE symptotal_(i-1) THEN DO; /*NE = not equal to */
587             chng(t) = i-1;
588             t = t+1;
589      end;
590  end;
591  run;

592  data perm.habc_cox11;
593      set perm.habc_cox10;
594
595      array symptotal_(*) symptotal_1 - symptotal_12;
596      array chng (*) chng1 - chng11;
597      start = 0;
598      censor2 = 0;
599      t = 1;
600
601      do i = 1 to time_event;
602
603      if chng(t) >. and (chng(t) < time_event) or i=time_event then;
604
605      if chng(t)>. then burden = symptotal_(chng(t));
606      else burden = symptotal_(time_event);
607
608      stop = min(chng(t), time_event);
609
610      if i = time_event then censor2 = censor;
611
612      if t>1 then start = chng(t-1);
613
614      t = t+1;
615      output;
616      end;
617  end;
     ---
     161
ERROR 161-185: No matching DO/SELECT statement.

618  run;

I would really appreciate your help. 

 

Thank you, 

 

 

6 REPLIES 6
Rick_SAS
SAS Super FREQ

You have two END statement but only one DO statement, so these statements are unmatched. I don't understand your logic, but from your indenting I am going to guess that you meant to say

if chng(t) >. and (chng(t) < time_event) or i=time_event then do;

 

 

ejay0503
Obsidian | Level 7

Thank you very much for looking into it. As suggested, I added "do" in the statement, but unfortunately, I got another error message:

 

ERROR: Invalid DO loop control information, either the INITIAL or TO expression is missing or the BY expression is missing,
zero, or invalid.

 

Will there be another solution? 

 

Thank you, 

Reeza
Super User

You need to include your full code and log again.

 


@ejay0503 wrote:

Thank you very much for looking into it. As suggested, I added "do" in the statement, but unfortunately, I got another error message:

 

ERROR: Invalid DO loop control information, either the INITIAL or TO expression is missing or the BY expression is missing,
zero, or invalid.

 

Will there be another solution? 

 

Thank you, 


 

ballardw
Super User

In this code follow the highlighted comment:

579  data perm.habc_cox10;
580      set perm.habc_cox9;
581
582      array symptotal_(*) symptotal_1 - symptotal_12;
583      array chng (11);
584      t= 1;
585      do i = 2 TO 12;
586          if symptotal_(i) NE symptotal_(i-1) THEN DO; /*NE = not equal to */
587             chng(t) = i-1;
588             t = t+1;
589      end;
590  end; <= Remove this End for this code
591  run;

 

This error can occur in a number of ways. You will have to examine your code to see if you are missing a needed DO or other statement that uses End or if a specific End is extra or just in the wrong place.

ejay0503
Obsidian | Level 7

I have tried all the suggestions, but unfortunately, I wasn't able to run the code. Still error messages appear. Still, I really appreciate all the suggestions and help. Thank you very much. 

Rick_SAS
SAS Super FREQ

 If you post the log, we can help identify the source of the error. It might be that the indenting in the code is confusing you. If you paste the code into an Enterprise Guide or SAS Studio program, those interfaces can auto-indent your code so that you will see the nesting levels as SAS sees them. 

 

In EG, select the entire program (CTRL+A) and then CRTL+I to indent.

 

In SAS Studio, select the entire program (CTRL+A) and then click the "Format Code" icon. I don't seem able to attach an image right now, but it is the second-to-last icon on the right side of the toolbar.

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 1619 views
  • 0 likes
  • 4 in conversation