Command Reference : Function Reference : Function Reference: I
  
 
@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 @eisna
Examples
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
See also @eeqna, @isempty, @eqna, and @neqna.