Function Reference: V
@val Number from a string.
@var Population variance (no d.f. adjustment).
@varp Population variance (no d.f. adjustment).
@varpsby Population variances (non-d.f. corrected) of a series for each specified group.
@vars Sample variance (d.f. adjusted).
@varsby Sample variances (d.f. corrected) of a series for each specified group.
@varssby Sample variances (d.f. corrected) of a series for each specified group.
@vcat Vertically concatenate matrices.
@vec Vectorize (stack columns of) matrix.
@vech Vectorize (stack columns of) lower triangle of matrix.
@verstr EViews product name string.
Number from a string.
Syntax: @val(arg[, fmt])
arg: string
fmt: (optional) numeric format string
Return: scalar
Returns the number that string arg represents. You may provide an optional numeric format string fmt.
In most cases, EViews will be able to convert your string into the corresponding numeric value without additional input. If EViews is unable to perform a conversion, it will return a missing (NA) value.
There are a few important conventions used in the conversion process:
• A leading “$” in the string will be ignored.
• Strings enclosed in “( )” or with a leading “–” will be treated as negative numbers. All other numeric strings, including those with a leading “+” will be treated as positive numbers. You may not have a leading “+” or “–” inside of the parentheses.
• A trailing “%” sign instructs EViews to treat the input string as a percentage—the resulting value will be divided by 100.
There are some situations where you must provide a numeric format string so that EViews can properly interpret your input. The syntax for the format string depends on the type of number the string represents.
Real-Value Formats
EViews will properly interpret non-delimited decimal and scientific notation numeric input strings as numbers.
If your string uses “,” to separate thousands, you should specify the “t” format string to remove “,” delimiters prior to conversion. If the string uses “.” to separate thousands, you should use “t..” to instruct EViews to remove “.” delimiters.
If your input string represents a number with suppressed decimal format, you should include a format string beginning with the letter “s”:
s.precision | suppressed decimal point format (precision determines the number of digits to the right of the decimal) |
EViews will divide the resulting number by 10 raised to the power of the specified precision. The “s” format specification may be followed by a “t.” or a “t..” specification if necessary.
Integer Formats
r | ratio (e.g., “30 1/5”). |
i | integer |
h | hexadecimal |
o | octal |
b | binary |
You should use the “r”, “h”, “o”, or “b” formats to indicate that your input is in the specified format. The “i” format is generally not necessary unless you wish to produce a missing value for a non-integer input string.
Examples
scalar num = @val("$1.23")
assigns the scalar NUM the numeric value 1.23.
series ser1 = @val("-$123.88")
returns the value -123.88.
scalar sperct = @val("478%")
divides the value by 100, setting the scalar SPERCT to 4.78.
scalar sratio = @val("(321 1/5)", "r")
sets the scalar SRATIO equal to -321.2
scalar shexa = @val("f01a", "h")
treats the string “f01a” as a hexadecimal number, converts it into the decimal equivalent, 61466, and assigns it to the scalar object SHEXA.
scalar sbin = @val("11110101", "b")
interprets the string “11110101” as a binary number, converts it into the decimal equivalent, 245, and assigns it to the scalar SBIN.
To ensure that a value is an integer, you may use the “i” option.
scalar sintna = @val("98.32", "i")
scalar sint = @val("96", "i")
SINTNA will contain a missing value NA since the input represents a non-integer value, while SINT is set to 96.
You may use @val to convert values in an svector into a vector. The matrix command,
vector v = @val(sv1)
converts the string values of svector SV1 to numeric values and returns the values in the svector V. If the vector V exists it will be sized to match the rows of SV1 and non-numeric strings will be converted to NA.
The series command
series x = @val(alpha1)
converts the string values in the alpha series ALPHA1 to numeric values and returns the values in the series X. Non-numeric strings will be converted to NA.
Format strings may be used to govern the conversion,
vector vbin = @val(svbin, "b")
interprets the strings in the svector SVBIN as binary numbers, converts it into their decimal equivalents and assigns it to the vector VBIN. If for example, SVBIN contained “110” “001” and “010”, the resultant VBIN will contain 6, 1, and 2.
Cross-references
See
@str for tools for expressing numbers as strings.
Count of matching values.
Syntax: @valcount(x, y)
x: data object
y: value or string
Return: number
The number of elements in x that match y. Note that numeric matches require an exact match.
For series and alpha calculations, EViews will use the current or specified workfile sample.
Examples
Let X be a series of length 5 whose elements are 1, 2, 5, 4, 2. Then
= @valcount(x, 2)
returns 2, while
= @valcount(x, 2.000000000000000000001)
returns 0.
Consider the string vector A where
svector a = @sfill("pear", "bear", "ear")
Then the command
= @valcount(a, "ear")
returns the value 1, while
= @valcount(@right(a, 3), "ear")
returns 3.
Cross-references
Population Variance (no d.f. adjustment).
Population (non-d.f. adjusted) Pearson product moment variance.
Syntax: @var(x, [s])
x: series, vector, matrix
s: (optional) sample string or object when x is a series
Return: number
The population variance is calculated as
where

is the mean of

.
For series calculations, EViews will use the current or specified workfile sample.
Examples
If x = @rnd, then
= @var(x)
will return a value close to 1/12 in large samples.
Cross-references
Population variance (no d.f. adjustment).
Population (non-d.f. adjusted) Pearson product moment variance.
Syntax: @varp(x, [s])
x: series, vector, matrix
s: (optional) sample string or object when x is a series and assigned to a series
Return: number
The population variance is calculated as
where

is the mean of

.
Equivalent to @var.
For series calculations, EViews will use the current or specified workfile sample.
Examples
If x = @rnd, then
= @varp(x)
will return a value close to 1/12 in large samples.
Cross-references
See also
@var,
@vars, and
@stdevp.
Population variances (non-d.f. corrected) of a series for each specified group.
Syntax: @varpsby(x, y[y1, y2, ... yn, s])
x: series
y series, alpha
s: (optional) sample string or object
Return: series
Returns the Pearson product moment population (non-d.f. corrected) variance for x each group defined by distinct values of y.
EViews will use the current or specified workfile sample.
Examples
show @varpsby(x, g1, g2)
produces a linked series of the by-group population variance of the series x, where members of the same group have identical values for both g1 and g2.
Cross-references
See also
@varsby and
@varssby.
Sample variance (d.f. adjusted).
Sample (d.f. adjusted) Pearson product moment variance.
Syntax: @vars(x, [s])
x: series, vector, matrix
s: (optional) sample string or object when x is a series and assigned to a series
Return: number
The sample variance estimate is calculated as
where

is the mean of

.
For series calculations, EViews will use the current or specified workfile sample.
Examples
If x = @rnd, then
= @vars(x)
will return a value close to 1/12 in large samples.
Cross-references
See also
@var,
@varp, and
@stdevs.
Sample variances (d.f. corrected) of a series for each specified group.
Syntax: @varsby(x, y[y1, y2, ... yn, s])
x: series
y series, alpha
s: (optional) sample string or object
Return: series
Returns the Pearson product moment population (d.f. corrected) variance for x each group defined by distinct values of y.
EViews will use the current or specified workfile sample.
Examples
show @varsby(x, g1, g2)
produces a linked series of the by-group population variance of the series x, where members of the same group have identical values for both g1 and g2.
Cross-references
Sample variances (d.f. corrected) of a series for each specified group.
Syntax: @varssby(x, y[y1, y2, ... yn, s])
x: series
y series, alpha
s: (optional) sample string or object
Return: series
Returns the Pearson product moment population (d.f. corrected) variance for x each group defined by distinct values of y.
EViews will use the current or specified workfile sample.
Examples
show @varssby(x, g1, g2)
produces a linked series of the by-group sample variance of the series x, where members of the same group have identical values for both g1 and g2.
Cross-references
See also
@varsby and
@varpsby.
Vertically concatenate matrices.
Syntax: @vcat(m1, m2[, m3, ...])
m#: matrix, vector, svector or sym
Return: matrix
Performs vertical concatenation of two matrix objects. Each of the m# must have the same number of columns.
The result will have the sum of the number of rows and the same number of columns as the m#.
For example, if m1 is a matrix with m rows and k columns, and m2 is a matrix with n rows and k columns, then @vcat will return a matrix with (m+n) rows and k columns.
Examples
vector v1 = @fill(1, 2, 3)
matrix k1 = @vcat(v1, 2*v1, 3*v1)
produces the matrix K1 which vertically stack the vectors V1, 2*V1 and 3*V1.
matrix g1 = @mnrnd(3, 3)
sym s1 = @identity(3)
matrix m1 = @vcat(g1, s1, v1.@t)
stacks the random normal matrix G1 on top of the identity matrix, and the row vector containing (1, 2, 3).
Cross-references
Vectorize (stack columns of) matrix.
Syntax: @vec(m)
m: matrix, sym
Return: vector
Creates a vector from the columns of the given matrix stacked one on top of each other. The vector will have the same number of elements as the source matrix.
Examples
matrix m1 = @mrnd(10, 3)
vector v1 = @vec(m1)
creates a

matrix of uniform random numbers M1 and stacks it into a 30 element vector V1.
Cross-references
See also
@unvec,
@unvech, and
@vech.
Vectorize (stack columns of) lower triangle of matrix.
Syntax: @vech(m)
m: matrix, sym
Return: vector
Creates a vector from the columns of the lower triangle of the source square matrix m stacked on top of each another.
The vector has the same number of elements as the source matrix has in its lower triangle.
Examples
sym s1 = @mrnd(5, 5)
vector v1 = @vech(s1)
creates a

sym matrix S1 and stacks the elements in its lower triangle in a 15-element vector V1.
If M is a matrix,
scalar is_symm = @vech(M)=@vech(M.@t)
tests for symmetry by seeing whether the lower and upper triangles of the matrix are equal. If the upper and lower elements triangles are the same, then the equality test will return 1, otherwise, it will return 0.
Cross-references
See also
@unvec,
@unvech, and
@vec.
Syntax: @vernum
Return: number
returns a number containing the EViews version number.
Syntax: @verstr
Return: string
returns a string containing the EViews product name string (e.g. “EViews Enterprise Edition”).