Statistical programming, matrix languages, and more

I am trying to multiply this two matrices. I want to delete the columns with zeros in INVERSCE

Accepted Solution Solved
Reply
Super Contributor
Posts: 292
Accepted Solution

I am trying to multiply this two matrices. I want to delete the columns with zeros in INVERSCE

    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;


Accepted Solutions
Solution
‎02-02-2013 05:20 PM
SAS Super FREQ
Posts: 3,418

Re: I am trying to multiply this two matrices. I want to delete the columns with zeros in INVERSCE

s =InverseC;

print s;

View solution in original post


All Replies
Solution
‎02-02-2013 05:20 PM
SAS Super FREQ
Posts: 3,418

Re: I am trying to multiply this two matrices. I want to delete the columns with zeros in INVERSCE

s =InverseC;

print s;

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 213 views
  • 0 likes
  • 2 in conversation