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

Solved
Super Contributor
Posts: 324

# 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.873529 0.847059 0.794118 0.741177 0.688235 0.635294 0.582353 0.529412 0.476471 0.423529 0.370588 0.317647 0.264706 0.231618 0.198529 0.132353 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.14478 0 0 0 0 0 0 0 0 0 0 0 0 4.31746 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: 4,171

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

s =InverseC;

print s;

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

## 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 and locked.