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
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;
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
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);
T in my case represents the terminal time (time to finish the study) while X represents the failure times (X1,...,Xn). I am looking for m failures. So either I get these m failures before the time T (that is why I have the condition T>= Xm) if not then T is between two times. That is why the ( Bin ) suggestion won't work in my case.
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.
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.
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.