BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
desireatem
Pyrite | Level 9

    I am tring to multiply this two matrices, I also want to delete all the cases where InverseC=0. How ever, it giving me their locations as a matrix not the matrix;

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

             do i = 1 to n;

                if censored=1 then SurvivalM=survival1; else if censored[1]=0 then SurvivalM=survival1/*****Create a 1 by N -matrix of Survival ****/;

            end;

   

      print SurvivalM;

0.95
0.9
0.8735294
0.8470588
0.7941176
0.7411765
0.6882353
0.6352941
0.5823529
0.5294118
0.4764706
0.4235294
0.3705882
0.3176471
0.2647059
0.2316176
0.1985294
0.1323529
0.0661765
0

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

          do i = 1 to n;

      if censored=1 then InverseC=1/survival1; else if censored[1]=0 then InverseC=0/*****survivalC is the imputed censored survival and set the real Survivalval to 1**/;

   

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

end;

      print InverseC;

0
0
1.1447811
0
0
0
0
0
0
0
0
0
0
0
0
4.3174603
0
0
0
0

      m=frequency[1];

   *Big=J(nrow(DM),m,value);

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

      tt=t(t); print tt;                      THIS IS WRONG, SUPPOSE TO BE 1.14478 and 4.3174603 as in Inverce above not 3 and 16 which is the location.

tt 2 rows 1 col (numeric)

 

3
16

 

3
16

      reset print;

    Big=SurvivalM*t(tt);  

     print Big;

1 ACCEPTED SOLUTION
1 REPLY 1

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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