Function Reference: I
@ifirst Index of the first non-missing value in the vector or series.
@iif Recode values by condition (conditional value).
@ilast Index of the last non-missing value in the vector or series.
@imax Index of maximum value.
@imaxes Indices of maximum value (multiple).
@imin Index of minimum value.
@imins Indices of minimum value (multiple).
@implode Creates sym from lower triangle of square matrix.
@implodeu Creates sym from upper triangle of square matrix.
@inlist Dummy variable for observation value in list.
@instr Find position of substring in a string.
@inv Reciprocal function.
@isna Test for missing values.
@isobject Does object exist in active workfile page.
@ispanel Is the current workfile page panel structured.
@isperiod is this the first observation matching the specified period.
@isvalidgroup Does the string represent a valid EViews group or auto-series.
@isvalidname Indicator for whether string represents a valid name for an EViews object.
Identity matrix.
Syntax: @identity(n)
n: integer
Return: matrix
Returns a square

identity matrix.
Examples
matrix i4 = @identity(4)
creates a

identity matrix.
matrix k4 = @kronecker(@fill(1, 2, 3), @identity(4))
generates the

matrix formed by taking the Kronecker product of the 3 element vector and the

identity matrix.
sym z = @inner(@mnrnd(3, 3))
matrix k3 = @kronecker(@scale(@identity(3), @mrnd(3, 1)), z)
creates a

block diagonal matrix where a block equals Z multiplied by a random uniform number.
Cross-references
Index of the first non-missing value in the data object.
Syntax: @ifirst(m)
m: data object
Return: scalar
Returns a scalar containing the index of the first non-missing value of the data object.The series version uses the current workfile sample.
Examples
Let V be a vector of length 4 whose elements are NA, NA, 4.2, and 1.7. Then
= @ifirst(v)
returns 3.
Cross-references
See also
@first,
@last, and
@ilast.
Recode values by condition (conditional value).
Syntax: @iif(s, x, y)
s: number
x: number or string
y: number or string
Return: number or string
Returns

if

is non-zero (true); otherwise returns

.
Typically

is specified using an expression with a boolean operator or function returning (0, 1) values (
e.g., “z > 3” or “z > w”), but any argument providing (0, non-zero) values is sufficient.
Examples
= @iif(x<0,1,0)
returns 1 if x is negative, 0 otherwise.
Cross-references
See also
@nan and
@recode.
Index of the last non-missing value in the data object.
Syntax: @ilast(m)
m: data object
Return: scalar
Returns a scalar containing the index of the last non-missing value of the data object. The series version uses the current workfile sample.
Examples
Let V be a vector of length 4 whose elements are 8.6, 0.3, NA, and NA. Then
= @ilast(v)
returns 2.
Cross-references
See also
@first,
@last, and
@ifirst.
Index of maximum value.
Workfile or row index corresponding to the maximum of the elements of x.
Syntax: @imax(x[, s])
x: data object
s: (optional) sample string or object when x is a series and assigning to a series
Return: number
Return the actual workfile or row indices corresponding to
where the order statistics

represent the data ordered from low to high.
For series calculations, EViews will use the current or specified workfile sample.
Examples
Let x be a series of length 5 whose elements are 1, 3, 5, 4, 2. Then
= @imax(x)
returns 3 the (non-unique) index corresponding to the value 5.
Cross-references
Indices of maximums values (multiple).
Returns n workfile or row indices corresponding to the n-th maximums of the elements of x.
Syntax: @imaxes(x, n[, s])
x: data object
n: integer
Return: vector
If
n is not an integer, the integer floor

will be used.
Return the actual workfile or row indices corresponding to
where the order statistics

represent the data ordered from low to high. The indices will be ordered from high to low of the corresponding values.
For series calculations, EViews will use the current or specified workfile sample.
Examples
Let x be a series of length 5 whose elements are 1, 3, 5, 4, 2, 5.
Then
= @imaxes(x, 1)
returns a vector containing (3, 6) the set of indices corresponding to the value 5.
Similarly
= @imaxes(x, 2)
returns a vector containing (3, 6, 4) the set of indices corresponding to the values 5 and 4.
Cross-references
Index of minimum value.
Workfile or row index corresponding to the minimum of the elements of x.
Syntax: @imin(x[, s])
x: data object
s: (optional) sample string or object when x is a series or alpha and assigning to a series
Return: number
Given the order statistics

representing the data ordered from low to high, we return the
actual workfile or row index corresponding to
where the order statistics

represent the data ordered from low to high.
For series calculations, EViews will use the current or specified workfile sample.
Examples
Let x be a series of length 5 whose elements are 1, 3, 5, 4, 2. Then
= @imin(x)
returns 1.
Cross-references
Indices of n-th smallest values (multiple).
Returns workfile or row indices corresponding to the n-th minimum of the elements of x.
Syntax: @imins(x, n[, s])
x: data object
n: integer
Return: vector
If
n is not an integer, the integer floor

will be used.
Return the actual workfile or row indices corresponding to
where the order statistics

represent the data ordered from low to high.
For series calculations, EViews will use the current or specified workfile sample.
Examples
Let x be a series of length 5 whose elements are 4, 2, 1, 4, 2, 5.
Then
= @imins(x, 1)
returns a vector containing (3) the set of indices corresponding to the value 1.
Similarly
= @imins(x, 2)
returns a vector containing (3, 2, 5) the set of indices corresponding to the values 5 and 4.
Cross-references
Create sym from lower triangle of square matrix
Syntax: @implode(m)
m: matrix
Return: sym
Forms a sym by copying the lower triangle of a square input matrix, m. Note that this function does not check for symmetry.
Examples
Let M be a (square) matrix object. Then
sym s = @implode(m)
creates S, a sym object whose lower triangle is identical to that of M.
Cross-references
Create sym from upper triangle of square matrix
Syntax: @implodeu(m)
m: matrix
Return: sym
Forms a sym by copying the upper triangle of a square input matrix, m. Note that this function does not check for symmetry.
Examples
Let M be a (square) matrix object. Then
sym s = @implodeu(m)
creates S, a sym object whose upper triangle is identical to that of M.
Cross-references
Increment rows or columns of matrix.
Syntax: @incr(m, v[,p])
m: matrix
v: vector, rowvector
p: (optional) number
Return: matrix
Increment the rows or columns of a matrix by the corresponding vector times p. By default, p is equal to 1.
• If m is a matrix and v is a vector, increment each column of m by p times v.
• If m is a matrix and v is a rowvector, increment each column of m by p times v.
Examples
matrix x = @mrnd(5, 3)
creates a

matrix X filled with random normals.
The commands
vector v1 = @fill(1, 2, 3, 4, 5)
matrix x1 = @incr(x, v1)
form X1 by taking X and adding the vector V1 to each column (which is equivalent to adding 1 to the first row, 2 to the second, etc).
The commands
rowvector v2 = @transpose(@fill(1, 2, 3))
matrix x2 = @incr(x, v2, -1)
creates X2 by taking X and subtracting the rowvector V2 from each row (which is the equivalent of subtracting 1 from the first column, 2 from the second, etc.),
Cross-references
Dummy variable for observation value in list.
Syntax: @inlist(x, list)
x: number or string
list: number or string
Return: number
where list is a quoted, space delimited list of values.
Returns a dummy variable series equal to 1 for observations where x is equal to one of the values specified in list, and 0 otherwise.
Note that string comparisons are case sensitive.
Examples
series d1 = @inlist(x, "1 3 5 7 9")
creates a dummy variable that takes the value 1 where X equals 1, 3, 5, 7, or 9, and 0 otherwise.
series d2 = @inlist(a, """no problem"" help")
creates a dummy variable that takes the value 1 for observations in A that equal “no problem” or “help”, and 0 otherwise.
Cross-references
Inner product.
Series and Vectors
Computes the inner product of x and y.
Syntax: @inner(x[, y, s])
x: series, vector
y: (optional) series, vector
s: (optional) sample string or object when x and y are series and assigning to series
Return: number
Computes
given x and the optional input y. If the optional argument is omitted, computes the inner product of x with itself so that it is equivalent to @sumsq if the second argument omitted.
EViews will use the current or specified workfile sample.
Matrix
Syntax: @inner(x)
x: matrix, sym
Return: number
Computes the symmetric matrix
Examples
If X and Y are series of length 5 whose elements are 1, 2, 3, 4, 5, and 6, 7, 8, 9, 10, respectively, then
= @inner(x, y)
returns 130.
The commands
matrix m = @mnrnd(5, 7)
sym S = @inner(m)
creates a

matrix M filled with normal random variables and the

symmetric matrix S containing

.
Cross-references
See also
@prod,
@sum, and
@sumsq.
Insert string into a string.
Syntax: @insert(str1, str2, n)
str1: string
str2: string
n: integer
Return: string
Inserts the string str2 into the string str1 at the position given by the integer n.
Examples
string sval1 = "I believe it can be done"
string sval2 = "not "
@insert("I believe it can be done", "not ", 16)
@insert(sval1, sval2, 16)
@insert(sval1, "not ", 16)
all return the string “I believe it cannot be done”.
If ALPHA1 is an alpha series,
alpha a1 = @insert(sval2, "not ", 5)
creates an alpha series with the contents of ALPHA1 with the string “not ” at position 5, for each observation in the workfile sample.
alpha a2 = @insert(sval1, a1, ser1)
inserts SVAL1 into A1 using the integer positions given in the series SER1.
If SVEC1 is an svector,
svector s1 = @insert("(pretty please)", svec1, 10)
inserts “(pretty please) ” into SVEC at position 10.
Cross-references
Find position of substring in a string.
Syntax: @instr(str1, str2[, n])
str1: string
str2: string
n: integer
Return: integer
Finds the starting position of the n-th occurrence of the target string str2 in the string str1.
By default, the function returns the location of the first instance of str2 in str1, but you may provide the optional integer n to change the occurrence.
If the target string is not found, @instr will return a 0.
Examples
string sval = "1.23415"
@instr("1.23415", "34")
@instr(sval, "34")
return the value 4, since the substring “34” appears beginning in the fourth character of the base string.
If ALPHA1 is an alpha series,
series s1 = @instr(alpha1, "34", 2)
fills the series with the 2nd instance of the string “34” in each string in ALPHA1, for each observation in the workfile sample.
If SVEC1 is an svector,
vector v1 = @instr(svec1, sval)
fills the vector with the location of the contents of the string SVAL for each element of SVEC1.
Cross-references
See also
@rinstr for finding substrings starting from the end of the string, and
@mid for extracting substrings.
Intercept from trend regression.
Computes the intercept (or intercepts for panel data) of an OLS regression versus a constant and an implicit time trend.
Syntax: @intercept(x[, s])
x: series
s: (optional) sample string
Return: series
EViews will use the current or specified workfile sample.
This function is panel aware.
Examples
series y = 2 + 3 * @trend + @nrnd
= @intercept(y)
The first line generates the series y using a simple linear regression model, where the sole regressor is a time trend, the intercept is 2, and the slope coefficient is 3. The second line returns the OLS estimate of the intercept term, and is approximately 2 in large samples.
Cross-references
Reciprocal function.
Syntax: @inv(x)
x: number, series
Return: number, series
Returns

of the scalar

, or

of each value of

in the series.
For scalars and series only.
To obtain the reciprocals of the elements of a matrix object use
@einv.
For matrix inversion, see
@inverse.
Examples
show @inv(x)
returns a linked series whose elements are the reciprocal of those in the series x.
Cross-references
See also
@einv,
@emult, and
@ediv.
Inverse of matrix.
Syntax: @inverse(m)
m: matrix, sym
Return: matrix, sym
Returns the inverse of a square matrix object or sym.
The inverse has the property that the product of the inverse and the source matrix and is the identity matrix. The inverse of a matrix returns a matrix, while the inverse of a sym returns a sym. Note that inverting a sym is much faster than inverting a matrix.
Examples
matrix m1 = @mrnd(500, 10)
sym s1 = @inner(m1)
matrix sinv = @inverse(s1)
generates a matrix of random normals, computes the inner product and then its inverse.
The following demonstrates the properties of the inverse,
matrix i1 = sinv * s1
where I1 is the identity matrix.
Cross-references
Test for empty string.
Syntax: @isempty(arg)
arg: string
Return: number
Tests arg for an empty string.
Return value is an integer (0, 1). An argument which test as missing return a 1, and 0 otherwise.
When used with series objects, the test is performed for every observation in the workfile sample. Note that when used with string matrix objects, the comparison is a test of all of the elements of the matrix, and will return 0 if any element is not empty. Element tests are available in
@eisna.
Equivalent to the more general
@isna when applied to string data.
Examples
Define the string objects
string s1 = "abc"
string s2 = ""
Then
scalar b1 = @isempty("abc")
scalar b2 = @isempty(s1)
sets the scalar objects B1 and B2 to 0, while
scalar c1 = @isempty("")
sets C1 to 1.
If ALPHA1 is an alpha series,
series d1 = @isempty(alpha1)
tests ALPHA1 for an empty string for each observation in the workfile sample.
svector svec1 = @fill("abc", "abc", "")
scalar sc1 = @isempty(svec1)
returns 0, since the command is a full test of SC1 for missing values and returns a 0 if any element is not equal.
Cross-references
See also
@eisna and
@isna.
Test for missing value.
Syntax: @isna(arg)
arg: number or string
Return: number
Tests arg for a missing (NA) value or empty string.
Return value is an integer (0, 1). An argument which tests as missing returns a 1, and 0 otherwise.
When used with series objects, the test is performed for every observation in the workfile sample. Note that when used with matrix objects, the comparison is a missing value test of all of the elements of the matrix, and will return 0 if any element is not missing. Element tests are available in
@eisnaExamples
The test
scalar f = @isna(NA)
returns the value 1, not an NA.
If SER1 is a numeric series,
series s2 = @isna(ser1)
tests SER1 for an empty string for each observation in the workfile sample.
Consider the comparison
vector v1 = @fill(1, 2, NA)
scalar f2 = @isna(v1)
evaluates the entire vector V1, and returns 0 since some of the elements of V1 are not missing. Define the string objects
string s1 = "abc"
string s2 = ""
Then
scalar b1 = @isna("abc")
scalar b2 = @isna(s1)
sets the scalar objects B1 and B2 to 0, while
scalar c1 = @isna("")
sets C1 to 1.
If ALPHA1 is an alpha series,
series d1 = @isna(alpha1)
tests ALPHA1 for an empty string for each observation in the workfile sample.
svector svec1 = @fill("abc", "abc", "")
scalar sc1 = @isna(svec1)
returns 0, since the command is a full test of SC1 for missing values and returns a 0 if any element is not equal.
Cross-references
Syntax: @isobject(str)
str: string
Return: integer
Check for an object’s existence in the current workfile page. Returns a “1” if the object with the name str exists in the current workfile, and a “0” if it does not exist.
Examples
scalar exists = @isobject("x")
Cross-references
Indicator for panel workfile page.
Syntax: @ispanel
Return: integer
Returns a 0 or 1 depending on whether the active workfile page is panel structured.
Examples
scalar ispanel = @ispanel
assigns the (0, 1) panel indicator to the scalar object ISPANEL.
series ids = @recode(@ispanel, @crossid, NA)
creates a series that contains the cross-section identifiers if a panel workfile, and NAs, if not.
Cross-references
See also
@cellid and
@crossid.
Is observation the first one matching the specified period?
Syntax: @isperiod(d)
d: string
Return: series
Returns a (0, 1) dummy variable for whether the observation is the first that matches the specified date d.
• If the natural frequency of the date is greater than or equal to the frequency of the workfile, then only the single observation that includes the date will be assigned a 1. All other observations will be set to 0.
• If the natural frequency of the date is lower than the frequency of the workfile, then only the first observation that is included in the date will be assigned the value of 1. All other observations will be set to 0.
Examples
Suppose we create a quarterly workfile running from 2000q1 to 2022q4:
workfile q 2000 2022
Then the commands
series perm12 = @isperiod("2005m12")
series perm4 = @isperiod("2005q4")
will assign a 1 only to the 2000q4 observation since that is the only observation that contains or matches the specified date.
If we use a lower frequency date,
series perm1 = @isperiod("2000")
will assign a 1 only to the 2000q1 observation, since it is the first workfile observation included in the date.
Cross-references
Test matrix for singularity.
Syntax: @issingular(m)
m: matrix, sym
Return: integer
Returns “1” if the square matrix or sym, m, is singular, and “0” otherwise.
A singular matrix has a determinant of 0, and cannot be inverted.
Examples
matrix m1 = @mnrnd(1, 10)
sym s1 = @inner(m1)
= @issingular(s1)
returns 1 indicating that the inner product of M1 is singular (i.e., not invertible).
Cross-references
Syntax: @isvalidgroup(str)
str: string
Return: integer
Check for whether a string represents a valid specification for creating an EViews group or auto-series. Returns a “1” if the expression is valid, and a “0” if it is not.
Examples
If your workfile contains the series X, Y and Z:
scalar a = @isvalidgroup("x y z")
will set A equal to 1,
scalar b = @isvalidgroup("log(x)")
will set B equal to 1, and
scalar e = @isvalidgroup("log(xy)")
will set E equal to 0 since XY is not a valid series in the workfile.
In contrast to the result in E,
scalar f = @isvalidgroup("log(x*y)")
is valid, since “LOG(X*Y)” is a valid series expression.
Cross-references
Indicator for whether string represents a valid name for an EViews object.
Syntax: @isvalidname(str)
str: string
Return: integer
Returns a “1” if the name is valid, and a “0” if it is not.
Examples
!y = @isvalidname("ABC")
returns the value 1.
!y = @isvalidname("re!sult%")
returns the value 0.
Cross-references