03-21-2017 11:59 AM - edited 03-21-2017 12:00 PM
I am trying so run this coding however it get stuck at the Error : (execution) Matrix has not been set to a value. The error is noticed at the statement : ind=(ul[i]-u0)/h; and the system spotted the operation '[' of the operand u1.
Another ERROR: (execution) Invalid subscript or subscript out of range is spotted at the statement : pdh=pdh[2:nrow(pdh),]; and the system spotted the operation '[' of the operands pdh.
The last ERROR: Matrix beta1 has not been set to a value. I wonder that this error is generated due to the previous error spotted in the coding after running it.
I am hoping to get some help on this because i tried my best but cannot figure out is it something that I have missing out or my coding is wrong.
I am using SAS version 9.4 and I have uploaded my input data and my coding is as follow :
proc import out=pepper
proc print data=pepper;
read all into y;
do p=1 to 8;
do d=1 to p;
do i= p+1 to nrow(y);
do h=0.1 to 1 by 0.1;
do j=1 to 4;
do i= p+1 to t;
do i=1 to t;
if (ind<=1) then do;
do i=1 to nrow(pdh);
if (pdh[i,4]=minAPE) then rw=i;
03-28-2017 09:22 AM
Firstly: Why several threads?
Secondly, you still have the error of mistyping your u1 vector as ul (with a lower case L).
Thirdly, you still have to take a look at the subscripts in your loops. For instance, you loop from 1 to t in your code and reference u1[i] in the line in which you specify your first error above. However running the following line of code at the end of you IML procedure
print (nrow(u1))[C = 'Rows in u1'] t;
prints the following
which suggests that you have 117 rows in u1, but you are trying to reference the 118'th row. Therefore, I suggest that you take a look at either your loop or the creation of u1.
Hope this can get you in the right direction.
03-31-2017 01:13 AM
03-31-2017 02:59 AM
You have a loop from i=1 to t as below where I have commented where your mistake is
do i=1 to t; ind=(ul[i]-u0)/h; /* This line should be: ind=(u1[i]-u0)/h; */ if (ind<=1) then do; w[i,i]=(0.75/h)*(1-((u1[i]-u0)*(u1[i]-u0))/(h*h)); w1[i,]=w[i,i]; x2[i,]=x1[i,]*(u1[i]-u0); end; else do; w[i,i]=0; w1[i,]=w[i,i]; x2[i,]=x1[i,]*(u1[i]-u0); end; end;
03-31-2017 03:11 AM - edited 03-31-2017 03:13 AM
Once you have fixed the line draycut is pointing to above, you need to debug the subscript errors. Try inserting the command,
just before the 1st error, and at other strategic points in your code, this should help you understand what is going wrong. Each time you issue the command you get a lisy of all matrices currently defined together with the number of rows and columns.