I keep getting errors regarding variables in my module although these values are well defined. Sometimes SAS gives no error at all and some other times SAS doesn't let it go. It feels like the program is been hunted😊
Can any one help me please figure out where is the problem.
Thank you all
The error message tells you that the problem is on Line 6753, which is the statement
Sum = 1 + R[m];
The error message also tells you that when the error occurs:
The expression R gives an error because R only has 1 element, not 5 or more. Thus, you get an error that states, "invalid subscript or subscript out of range."
There are several places where you are calling the Adaptive module, and in one of those places you are calling it with invalid parameters.
Thank you Rick for the explanation.
I tried to check each time I call the subroutine, the error occurred in the second time (inside my Bootstrap). I am so surprised as R is well defined since I used
AdaptiveResX=Adaptive(n1,m1,K,theta1); (K gives the value for the R)
AdaptiveResY=Adaptive(n2,m2,L,theta2); (L gives the value for the R)
K and L are well defined in the top of my code. That is where I am confused why this is happening?
I tried to define R inside the subroutine and call my subroutine using Adaptive(n1,m1,theta1) and Adaptive(n1,m1,theta1). This fix the error, however, it doesn't give correct results and moreover, it will always force me to make the vectors K and L to be equal all the time and not for certain cases.
I still don't know how to fix my problem
I just tried another thing which is to copy and paste the values of K and L from the top of the program to just before I started the bootstrap ( Step 1)
and the error disappeared and in this case I can solve my problem. The issue for me is the following
(1) when I use different values for K and L I have to remember to change these values at two places
(2) I don't understand why can't insert the K and L once and use it everywhere in the code. After all they are Global values?
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.