Command Reference : Function Reference : Function Reference: I
  
 
@isempty
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.