Hi everyone. I have a question regarding multiplying matrices. I already read Interpreting PROC IML error messages: Matrices do not conform to the operation suggested in other boards and I still do not understand why I get this message. I understand that if I want to multiply xbeta = x # beta; the number of columns in X have to be equal to the rows in beta, right? I am running SAS 9.4
This is part of my code:
xbeta = x#beta;
se= sqrt (vecdiag(x#cov#x`));
lower =xbeta - (1.96 # se);
upper =xbeta + (1.96 # se);
When I run the operation I get this on the log:
ERROR: (execution) Matrices do not conform to the operation.
operation : # at line 15164 column 14
operands : X, BETA
X 502 rows 6 cols (numeric)
BETA 6 rows 1 col (numeric)
And also when I try to perform this operation x#cov
operation : # at line 15164 column 80
operands : X, COV
X 502 rows 6 cols (numeric)
COV 6 rows 6 cols (numeric)
What am I doing wrong? Thanks!
Matrix multiplication does not support missing values. If you are trying to mimic the usual OLS regression, you should remove the rows with missing values. This article might be useful:http://blogs.sas.com/content/iml/2015/02/23/complete-cases.html
# is elementwise multiplication.
* is matrix multiplication
When I change # to * I get the following error.
ERROR: (execution) Invalid argument or operand; contains missing values.
operation : * at line 15164 column 14
operands : X, BETA
X 502 rows 6 cols (numeric)
BETA 6 rows 1 col (numeric)
Matrix multiplication does not support missing values. If you are trying to mimic the usual OLS regression, you should remove the rows with missing values. This article might be useful:http://blogs.sas.com/content/iml/2015/02/23/complete-cases.html
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.