The following assumes that there are three tables DATA_VALS, LOOKUP_VALS and CONSTANT_VALS containing all the desired input data.
:CONNECT DATA1
:DATA
:VARNAME varname
:SUB sub1
:TIME TimeValue
:VALUE DataValue
:SELECT DATA_VALS
:LOOKUPS
:VARNAME varname
:SUB sub1
:X x
:Y y
:SELECT LOOKUP_VALS
:CONSTANTS
:VARNAME varname
:SUB sub1
:VALUE DataValue
:SELECT CONSTANT_VALS
For the remaining examples we will only do 1 of DATA, LOOKUPS or CONSTANTS but the same principles apply to each.