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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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