LOOKUP statement is another very useful function available in Cube. Users can use this in HIGHWAY, MATRIX, NETWORK and PT Programs. We will use MATRIX to demonstrate the usage of LOOKUP statement and its related sub keywords based on a very simple lookup table we prepared.
Input Lookup Table:
Note: there are only two fields, let's assume the first column is the data index and the second column gives the value for this data point.
Now we are interested in to search for values below in the table:
Depends on what users specific the LOOKUP function, the return values will be different!
Now why somebody would care about this?
In our example, we only have values for 2 and 3. In its simplest form, LOOKUP statement can only return correct value for 2 and 3. What should we do if we want to get a value between 2 to 3, lower than 2 and higher than 2? That's all depends on the users and Cube gives the capability for the users to specify return values for something is not in the lookup table. Also, many times, the data are NOT perfect, if we have something out of the range in the lookup table, we can detect them and report (use IF and PRINT) to the users or abort the model.
How to achieve these?
Please see the details in the attached catalog on LOOKUP, INTERPOLATE, NEAREST, FAIL, FAIL and FAIL. Again, users are encouraged to twist the input files and script to understand and explore LOOKUP statement.
useLookup.rar (20.2 KB)