Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 07-20-2021 06:05 PM
(268 views)

Hello

I am writing a code in order to find an initial value for my optimization. For some reason, SAS keeps on giving me the following error

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

I checked every single step, but can't find the error.

Please help!!!

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

It is always a good idea to post the log near the error, not just the error. In your case, the log says

23182319 f= m*log(alpha*lambda)+(lambda-1)*Sum1 +2319! (alpha-1)*Sum2 + alpha*Sum3 +

2320 alpha *(n-m-Rq[+])*log(1-(X[m]**lambda));

2321

2322

2323

2324 return( -f );

2324! /* return -f so that extrema are maxima */

2325 finish;

2329 f = Camel(KK); ERROR: (execution) Matrices do not conform to the operation.operation : * at line 2319 column 22operands : alpha, lambda alpha 10000 rows 1 col (numeric) lambda 10000 rows 1 col (numeric) statement : ASSIGN at line 2319 column 8 traceback : module CAMEL at line 2319 column 8 NOTE: Paused in module CAMEL.

"do not conform" for the '*' operation means that you are trying to perform matrix multiplication, but the matrices are the wrong dimension. By looking at the line number, you can see that matrix multiplication is not defined between two Nx1 vectors. Fortunately, you showed in a comment that you copied code from https://blogs.sas.com/content/iml/2014/06/11/initial-guess-for-optimization.html, and you can check that blog post to see that the author used the '#' operator (not the '*' operator) to perform elementwise multiplication of two vectors.

I don't know which of your symbols represent vectors vs scalars, but you can use # for multiplication when you define the function, like this:

f= m#log(alpha#lambda)+(lambda-1)#Sum1 + (alpha-1)#Sum2 + alpha#Sum3 + alpha#(n-m-Rq[+])#log(1-(X[m]**lambda));

1 REPLY 1

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

It is always a good idea to post the log near the error, not just the error. In your case, the log says

23182319 f= m*log(alpha*lambda)+(lambda-1)*Sum1 +2319! (alpha-1)*Sum2 + alpha*Sum3 +

2320 alpha *(n-m-Rq[+])*log(1-(X[m]**lambda));

2321

2322

2323

2324 return( -f );

2324! /* return -f so that extrema are maxima */

2325 finish;

2329 f = Camel(KK); ERROR: (execution) Matrices do not conform to the operation.operation : * at line 2319 column 22operands : alpha, lambda alpha 10000 rows 1 col (numeric) lambda 10000 rows 1 col (numeric) statement : ASSIGN at line 2319 column 8 traceback : module CAMEL at line 2319 column 8 NOTE: Paused in module CAMEL.

"do not conform" for the '*' operation means that you are trying to perform matrix multiplication, but the matrices are the wrong dimension. By looking at the line number, you can see that matrix multiplication is not defined between two Nx1 vectors. Fortunately, you showed in a comment that you copied code from https://blogs.sas.com/content/iml/2014/06/11/initial-guess-for-optimization.html, and you can check that blog post to see that the author used the '#' operator (not the '*' operator) to perform elementwise multiplication of two vectors.

I don't know which of your symbols represent vectors vs scalars, but you can use # for multiplication when you define the function, like this:

f= m#log(alpha#lambda)+(lambda-1)#Sum1 + (alpha-1)#Sum2 + alpha#Sum3 + alpha#(n-m-Rq[+])#log(1-(X[m]**lambda));

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

**If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. **

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.