Command Reference : Function Reference : Function Reference: N
  
Function Reference: N
 
@nan
@nas
@nasby
@neqna
@norm
@now
@nper
@nan Recode missing values.
@nas Number of missing observations.
@nasby Number of missing observations in a series or alpha for each specified group.
@neqna Inequality test (NAs and blanks treated as values, not missing).
@norm Norm of series or matrix object.
@now Current time date number.
@nper Number of periods for annuity to pay given present value.
@nan
Recode missing values.
Syntax: @nan(x, y)
x: number
y: number
Return: number
Returns , if is non-missing (not an NA or blank string); otherwise returns .
Examples
show @pmax(x,-999)
returns a linked series that is identical to x except that NAs are replaced by the number -999.
Cross-references
See also @iif, @recode, and @bridge.
@nas
Number of missing observations.
Number of missing (NA) observations in .
Syntax: @nas(x[, s])
x: data object
s: (optional) sample string or object when x is a series or alpha and assigning result to a series
Return: number
For series calculations, EViews will use the current or specified workfile sample.
Examples
If x is a series of length 5 with elements 1, NA, 2, NA, 3, then
= @nas(x)
returns 2.
Cross-references
See also @obs.
@nasby
Number of missing observations in a series or alpha for each specified group.
Syntax: @nasby(x, y[y1, y2, ... yn, s])
x: series, alpha
y series, alpha
s: (optional) sample string or object
Return: series
Compute the number of missing values in x for groups identifiers defined by distinct values of y.
EViews will use the current or specified workfile sample.
Examples
show @nasby(x, g1, g2)
produces a linked series of by-group NA counts in the series x, where members of the same group have identical values for both g1 and g2.
Cross-references
See also @obsby.
@neqna
Inequality test (NAs and blanks treated as values, not missing).
Syntax: @neqna(arg1, arg2)
arg1: number or string
arg2: number or string
Return: integer
Tests for inequality of arg1 and arg2, treating NA values and null strings as ordinary values or blanks, and not as missing values. Simple inequality testing which propagates NAs may be performed using the “<>” binary comparison operator.
Arguments which test as equal return a 0, and 1 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 an inequality test of all of the elements of the two matrices, and will return 0 if any element comparison is false. Individual element tests are available in @eneqna
Examples
The test
scalar f1 = @eqna(na, 2)
returns a 0, and not a missing value.
Consider the comparison
vector v1 = @fill(1, 2, 2)
scalar f2 = @neqna(v1, 2)
compares the entire vector V1 to 2, and returns 1 since some of the elements of V1 are equal to 2. Note that this is a full inequality test that returns a 0 if any element is equal, and a 1 if all elements are unequal (ignoring NAs)
If SER1 and SER2 are numeric series,
series s2 = @neqna(ser1, ser2)
tests SER1 and SER2 for inequality, ignoring NAs, for each observation in the workfile sample.
Define the string objects
string s1 = "abc"
string s2 = ""
Then
scalar b1 = @neqna("abc", "abc")
scalar b2 = @neqna("abc", s1)
sets the scalar objects B1 and B2 to 0, while
scalar c1 = @neqna("", "def")
scalar c2 = @neqna(s2, "def")
scalar c3 = @neqna(s1, s2)
sets C1, C2, and C3 to 1.
If ALPHA1 and ALPHA2 are alpha series,
series d1 = @neqna(alpha1, "abc")
series d2 = @neqna(alpha1, s1)
series d3 = @neqna(alpha1, alpha2)
perform the inequality test using ALPHA1 and the literal string and scalar containing “abc”, and the contents of ALPHA2 for each observation in the workfile sample.
If SVEC1 and SVEC2 are svectors,
scalar sc1 = @neqna(svec1, "abc")
scalar sc2 = @neqna(svec1, svec2)
perform the equality test of SVEC1 against “abc”, and the contents of SVEC2. Note that this is a full inequality test of SVEC1 against the string, or against each element of SVEC2, and that the test will return a 0 if any element is equal, and a 1 if all elements are unequal (ignoring empty strings).
Cross-references
See also @eeqna, @enisna and @eqna.
@norm
Norm of series or matrix object.
Syntax: @norm(m[, n])
m: numeric data object
n: (optional) integer
Return: number
Returns the norm of m.
If no norm type is provided, this function returns the infinity norm. Possible choices for the norm type n include “–1” for the infinity norm, “0” for the Frobenius norm, and an integer “n” for the norm.
For series calculations, EViews will use the entire workfile. If you want to compute the norm for a subsample, use mtos to convert the subsample of the series to a vector.
Examples
matrix m1 = @mnrnd(10, 4)
scalar sc1 = @norm(m1)
computes the infinity norm of the matrix M1.
sym s1 = @inner(m1)
scalar sc2 = @norm(s1, 2)
computes the norm of the symmetric matrix S1.
series x = nrnd
scalar sc3 = @norm(x)
assigns to SC3 the norm of the series X computed over the entire workfile.
@now
Current time date number.
Syntax: @now
Return: date number
Returns the date number associated with the current time.
Examples
scalar nowtime = @now
Cross-references
See “Dates” for additional details on date numbers and date format strings.
@nper
Number of periods for annuity to pay given present value.
Syntax: @nper(r, x, pv[, v, bf])
r: number
x: number
pv: number
v: (optional) number
bf: (optional) number
Return: integer
Find the number of periods n required to receive at least the present value pv from an n-period annuity, with receipts x and discount rate r, and optional receipt of a final lump sum v.
A non-zero value for the optional bf indicates that the receipts are made at the beginning of periods (annuity due) instead of ends (ordinary annuity).
The present value of by n-periods of ordinary annuity receipts and a final lump sum is:
The present value of n-periods of annuity due receipts and a final lump sum is:
Then for a given PVO or PVD and annuity type, the function returns the smallest n required to exceed the required value.
Examples
= @nper(0.05, 100, 1000)
returns the value 14.20670, indicating that a 15-period annuity that pays $100 per period has a present value greater than $1000 assuming the discount rate of 5%.
Cross-references
See also @fv, @pmt, @pv, and @rate.