next up previous contents index
Next: Constructing data from other Up: Constructing data over many Previous: Constructing data over many

Introductory example

Suppose that E is a data-carrier having 20 observations tex2html_wrap_inline36454 , and that you wish to construct a further data-carrier tex2html_wrap_inline36456 with observations tex2html_wrap_inline36458 . 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 tex2html_wrap_inline33876 data : F([i])=2*E([i]) tex2html_wrap_inline33712

If instead we consider E and F to be data vectors, it is much more natural to consider writing something of the form tex2html_wrap_inline36460 . The DATAVEC:  command enables this form. That is, we replace the above line of code by the line

BD>datavec : F=2*E tex2html_wrap_inline33712

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 tex2html_wrap_inline33876 data : A[i]=B[i]+ln (C(2)/D[i]*E[i]) tex2html_wrap_inline33712

by the line of code

BD>datavec : A=B+ln (C(2)/D*E) tex2html_wrap_inline33712

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 tex2html_wrap_inline34522 ). 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.



David Wooff
Wed Oct 21 15:14:31 BST 1998