DataObject.GetNumVar

Prototypes

int GetNumVar( <int nCharacteristics> )

Return Value

If the parameter nCharacteristics is specified, the return value is the number of variables in the DataObject that have the specified characteristics. If the parameter nCharacteristics is not specified, the return value is the total number of variables in the DataObject.

Parameters

int nCharacteristics
One or more flags that specify the characteristics of the variables to count. See Remarks for information about the flags. To specify multiple flags, use the addition operator (+) to add them together.

Remarks

This method returns either the total number of variables in the DataObject or the number of variables that have the specified characteristics.

The parameter nCharacteristics specifies one or more flags that specify the characteristics of the variables to count. The flags are as follows:

VC_NUMERIC
Only numeric variables are counted.

VC_CHARACTER
Only character variables are counted.

VC_INTERVAL
Only variables with a measurement level of Interval are counted.

VC_NOMINAL
Only variables with a measurement level of Nominal are counted.

VC_SELECTED
Only selected variables are counted.

VC_ALL
This flag is equivalent to the combination of all the above flags. It is only useful when used together with the flag VC_MATCHANY.

VC_MATCHANY
This flag instructs IML Studio to treat a variable as matching if it has any of the specified characteristics.

VC_MATCHALL
This flag instructs IML Studio to treat a variable as matching only if it has all of the specified characteristics. The behavior of this flag is the default behavior if the parameter nCharacteristics specifies neither VC_MATCHANY nor VC_MATCHALL.

Example
declare DataObject dobj;
dobj = DataObject.CreateFromFile( "baseball" );
NumVar = dobj.GetNumVar();
print "Total number of variables     = " NumVar[label=""];
NumVar = dobj.GetNumVar( VC_NUMERIC );
print "Number of numeric variables   = " NumVar[label=""];
NumVar = dobj.GetNumVar( VC_CHARACTER );
print "Number of character variables = " NumVar[label=""];
See Also

DataObject.GetDimensions
DataObject.GetNumObs