DataObject.AddAnalysisVar

Prototypes

void AddAnalysisVar( String sVarName <, String sVarLabel>, Matrix mData <, boolean bNominal> )

void AddAnalysisVar( String sVarName <, String sVarLabel>, double[] adData <, boolean bNominal> )

void AddAnalysisVar( String sVarName <, String sVarLabel>, String[] asData )

Parameters

String sVarName
The name for the new variable. This string must be a valid SAS variable name.

String sVarLabel
The label for the new variable. This string can be used to describe the variable. If the sVarLabel parameter is not specified, the variable is assigned a label that is the same as its name.

Matrix mData
The observation data for the new variable. This must be either an n x 1 column vector or a 1 x n row vector.

boolean bNominal
If bNominal is true, the data is treated as nominal data. If bNominal is false, the data is treated as interval data. Calling this method without specifying the bNominal parameter is equivalent to calling it with bNominal equal to false.

double[] adData
The observation data for the new variable.

String[] asData
The observation data for the new variable.

Remarks

This method adds an analysis variable to the DataObject.

The DataObject class provides two types of variables: ordinary variables, and analysis variables. Ordinary variables and analysis variables are identical in all respects except one: adding, modifying, or deleting an analysis variable does not mark the DataObject as modified. Closing a DataObject that is marked modified causes IML Studio to prompt you to save changes if you used IML Studio's user interface to do either of the following:

Notes
Example
x = { 1 2 3 4 5 6 7 8 };
declare DataObject dobj = DataObject.Create( "Sample Data" );
dobj.AddVar( "X", x );
DataTable.Create( dobj ).ActivateWindow();
print "To complete this example, please follow these steps:";
print "(1) Click the Save button on the toolbar and save"/;
print "    the data set somewhere on your disk.";
print "(2) Press ALT+F5 to resume the program.";
print "(3) When the program finishes, close the data table"/;
print "    window and notice that it does not prompt you"/;
print "    to save changes.";
pause "nodialog:";
y = { 2 1 4 5 6 5 6 9 };
dobj.AddAnalysisVar( "Y", y );
See Also

DataObject.AddAnalysisVars
DataObject.AddVar
DataObject.AddVars