I have a number of variables, e.g. X1, X2, X3, X4, X5.
I want to select only the ones that are non zero(there will only be 2 or 3 at any time), and record them as Y1, Y2 and Y3
I want to know the best way of incrementing the name of the variable, e.g. the variable in a loop is X + (num)
I was trying
Num1=1
Num2=1
Do until num1 =5
If X(num1)<>0 then Y(num2) = X(num1) else goto J1
num2 = num2 +1
J1:
num1 = num1 +1
loop
Is this the best way? and if so how do I define X(num1), I am currently getting the error "sub of function not defined"