Suppose that E is a data-carrier having 20 observations , and that you wish to construct a further data-carrier with observations . One valid way to do this is to use a FOR: loop in combination with an ordinary DATA: command:
BD>for : i=1,1,20 data : F([i])=2*E([i])
If instead we consider E and F to be data vectors, it is much more natural to consider writing something of the form . The DATAVEC: command enables this form. That is, we replace the above line of code by the line
so that we don't refer explicitly to the individual cases. As another example, we could replace the line of code
BD>for : i=1,1,20 data : A[i]=B[i]+ln (C(2)/D[i]*E[i])
by the line of code
BD>datavec : A=B+ln (C(2)/D*E)
where we drop the explicit case numbers. (Note that C(2) remains as it was, as the real number contained in C(2) is intended, rather than the data vector ). In practice, this way of constructing data vectors is also much quicker. We should observe various rules - to do largely with the selection of observations to be assumed - in applying the command as follows.