Command Reference : Function Reference : Function Arguments
  
Function Arguments
Most of the functions you will use in EViews take arguments, where you will supply necessary information to the function. In discussing various function types, it will be useful to develop a simple framework for understanding the use of function arguments in EViews.
Some functions require that arguments correspond to a highly specific object types. For example, the @eigenvalues function, which computes the eigenvalues of a symmetric matrix, requires a single sym and returns a vector. Similarly, the @wjoin function, which concatenates elements of an svector, requires a single svector argument, and returns a string.
For other functions, arguments are valid for a wider range of object types. For example, the single argument of the matrix @transpose command may be a vector, rowvector, or matrix object. In this case the function return type depends on the input type, with a vector returning a rowvector and vice versa, and an matrix returning a matrix.
Lastly, for some functions, arguments can work with almost all types of input. Some, like the absolute value function @abs, work with any numeric input, including numeric objects, literals and program replacement variables. Other functions, like the string length function @len work with any alphanumeric input, including string vectors, literals and program substitution variables. In these cases, the return type will generally depend on the input type.
When functions with flexible types have multiple arguments, you can often provide any appropriate values for the function argument and if possible, EViews will adjust the evaluation and output accordingly.
Consider, for example the @left function which returns the left-most characters in a string . The first argument of the function corresponds to an alphanumeric , and the second argument is a numeric .
For this function, EViews will return different types of results for different combinations of valid and argument types. The command
= @left("When in the course", 4)
returns the string “When” which is displayed in the EViews status line.
If A is a vector object containing the values 1, 2, 3, 4,
svector s1 = @left("When in the course", A)
will produce an svector S1 containing the strings “W”, “Wh”, “Whe”, and “When”. In this case, EViews evaluates the function repeatedly using the literal value “When in the course” for paired with each of the four values of A for .
Alternately, if V is a 4-element svector,
svector s2 = @left(V, 4)
will return a 4-element svector S2 containing the left-most 4 characters of the corresponding elements of V.
Lastly,
svector s3 = @left(V, A)
will pair the elements of the svector V and vector A as defined above, returning an svector containing the first character of the first element of V, the first two characters of the second element of V, the first three characters of the third element of V, and the first four characters of the fourth element of V.
To take another example, suppose we wish to specify a string date, find the corresponding underlying date number, manipulate that number to add various numbers of weeks, and then find a string representation of the new date number.
We can now perform a vectorized version of this operation which finds a string representation for 11 weekly days beginning at an initial scalar date:
wfcreate d7 2000 202
vector weeks = @seq(0, 1, 11)
string startdate = "May 1, 2000"
svector enddates = @datestr(@dateadd(@dateval(startdate), weeks, "W"))
This operation uses the @dateval function to convert the initial string into a date number, the @dateadd function to find the date numbers associated with the initial date number and the following 10 weeks, and the @datestr function to convert the result back into a string.