Getting ERROR:" An ARRAY index is out of bounds in statement"

279 views Asked by At

I'm getting the: "ERROR: An ARRAY index is out of bounds in statement" in the log while trying to arrays in a phreg command. I'm trying to do survival analysis using SAS.

ERROR: An ARRAY index is out of bounds in statement number 1 at line 2649 column 1.
      The statement was:
   1     (2649:1)   eud = eud_[(tid=.) + 1]
ERROR: An ARRAY index is out of bounds in statement number 2 at line 2652 column 1.
      The statement was:
   1     (2652:1)   ungdom = ungdom_[(tid=.) + 1]
ERROR: An ARRAY index is out of bounds in statement number 3 at line 2655 column 1.
      The statement was:
   1     (2655:1)   kvu = kvu_[(tid=.) + 1]
ERROR: An ARRAY index is out of bounds in statement number 4 at line 2658 column 1.
      The statement was:
   1     (2658:1)   mvu = mvu_[(tid=.) + 1]
ERROR: An ARRAY index is out of bounds in statement number 5 at line 2661 column 1.
      The statement was:
   1     (2661:1)   lvu = lvu_[(tid=.) + 1]
ERROR: An ARRAY index is out of bounds in statement number 1 at line 2649 column 1.
      The statement was:
   1     (2649:1)   eud = eud_[(tid=.) + 1]
ERROR: An ARRAY index is out of bounds in statement number 2 at line 2652 column 1.
      The statement was:
   1     (2652:1)   ungdom = ungdom_[(tid=.) + 1]
ERROR: An ARRAY index is out of bounds in statement number 3 at line 2655 column 1.
      The statement was:
   1     (2655:1)   kvu = kvu_[(tid=.) + 1]
ERROR: An ARRAY index is out of bounds in statement number 4 at line 2658 column 1.
      The statement was:
   1     (2658:1)   mvu = mvu_[(tid=.) + 1]
ERROR: An ARRAY index is out of bounds in statement number 5 at line 2661 column 1.
      The statement was:
   1     (2661:1)   lvu = lvu_[(tid=.) + 1]  ```

This is the editor input for creating the cats, which is obv. done for each of the new cats:


    array ungdomone(*)ungdom1-ungdom26;                                                                  
     do i=1 to 26;                                                                                
        if pstart=1 then ungdomone[i]=.;                                                                                                                           
        if tid+1=i then ungdomone[i]=ungdom;                                                     
        if tid=. then ungdomone[i]=.;                                                              
    end;                                                                                          

    drop i; 

This is the phreg we are trying to use:

proc phreg data=biblio.worklife;
model tid*censor(1,2,3,4) = sex eud ungdom kvu mvu lvu/* Baseline grundskole */ /ties=efron;

array eud_(*) eud1-eud26;
eud=eud_[tid+1];

array ungdom_(*) ungdom1-ungdom26;
ungdom=ungdom_[tid+1];

array kvu_(*) kvu1-kvu26;
kvu=kvu_[tid+1];

array mvu_(*) mvu1-mvu26;
mvu=mvu_[tid+1];

array lvu_(*) lvu1-lvu26;
lvu=lvu_[tid+1];

run;

If I can provide anymore useful info, let me know! Thank you in advance.

0

There are 0 answers