Statistical programming, matrix languages, and more

ERROR: (execution) Matrices do not conform to the operation.

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

ERROR: (execution) Matrices do not conform to the operation.

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!


Accepted Solutions
Solution
‎04-21-2015 01:32 PM
SAS Super FREQ
Posts: 3,630

Re: ERROR: (execution) Matrices do not conform to the operation.

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

View solution in original post


All Replies
SAS Employee
Posts: 340

Re: ERROR: (execution) Matrices do not conform to the operation.

# is elementwise multiplication.

* is matrix multiplication

New Contributor
Posts: 4

Re: ERROR: (execution) Matrices do not conform to the operation.

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)

Solution
‎04-21-2015 01:32 PM
SAS Super FREQ
Posts: 3,630

Re: ERROR: (execution) Matrices do not conform to the operation.

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

SAS Super FREQ
Posts: 3,630

Re: ERROR: (execution) Matrices do not conform to the operation.

🔒 This topic is solved and locked.

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

Discussion stats
  • 4 replies
  • 1019 views
  • 3 likes
  • 3 in conversation