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

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

Posted 10-02-2021 12:19 AM
(487 views)

Hello

I keep on getting the following "ERROR: (execution) Matrix has not been set to a value." my understanding is that "q" is undefined but it is well defined!!

seems that I don't understand what is the issue exactly? I need your help, please !!!

Thank you

6 REPLIES 6

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

The log tells you the line that contains the error and what the error is. On Line 217 (which is X_1_q=J(q,1,0);) the value q is undefined. The J function requires that the number of rows and columns be positive.

Notice that the loop that defines q only assigns a value if a certain logical condition is satisfied. Otherwise, q is not defined.

DO idx=1 to m-1;

if (( X_p[idx] < T) & (X_p[idx+1] >= T)) then q=idx; /* <== not defnd if condition false */

END;

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

But the other condition is there

Do idx=1 to m-1;

if (( X[idx] < T) & (X[idx+1] >= T)) then q=idx;

end;

if ( X[m] <= T) then q= m;

with this I exhausted all the cases

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

No. For example, the situation T=0 and x={1, 2, 3} is not covered by your logic.

By the way, if you are trying to find the interval in which T is contained, then consider using the BIN function:

q = bin(T, x);

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

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

It's your program, so feel free to ignore my suggestions. But I'd like to point out that you can still use the BIN function:

q = bin(T, x);

if q = . then q=m; /* if T out of range, assign q manually */

Anyway, good luck with your problem.

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

I am so so grateful to your help. I didn't know that I still can use (Bin) which is why I was trying to explain my problem in more detail.

Thank you again for your help. Iam definitely going to take your suggestion.

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.