The local
provider provides ADO rowset property “SAS Get Missing Values
Grid” so that the local provider can return results that indicate
the special numeric missing values. SAS supports special
missing numeric values to represent different categories of missing
data. For more information about special numeric missing values, see
“Missing Values” in
SAS Language Reference:
Concepts.
In order
to return the special missing numeric value, when this property is
set to True, the provider returns a grid with values that are the
opposite of the standard data. Numeric fields with special numeric
missing values normally return Null. When this property is set to
True, those fields return a value that represents the special numeric
missing value.
// This sample uses C# syntax
//
// obConnection is an ADODB.Connection object and
// obRecordset is an ADODB.Recordset object
//
try
{
string connectionString = "Provider=sas.LocalProvider; Data Source=\"c:\\data\"";
obConnection.Open(connectionString, "", "",
(int)ADODB.ConnectOptionEnum.adConnectUnspecified);
obRecordset.ActiveConnection = obConnection;
obRecordset.Properties["SAS Get Missing Values Grid"].Value = true;
obRecordset.Open(dataSetName, System.Type.Missing,
CursorTypeEnum.adOpenForwardOnly, LockTypeEnum.adLockReadOnly,
(int)CommandTypeEnum.adCmdTableDirect);
}
catch (Exception ex)
{
if (obConnection.Errors.Count > 0)
{
foreach (ADODB.Error e in obConnection.Errors)
Console.WriteLine(e.Description);
}
else
{
Console.WriteLine(ex.toString());
}
}
Consider
the following table that represents a SAS data set. It has a character
variable and a numeric variable. The second observation has the standard
SAS missing value. The third and fourth observations use the special
numeric missing variables.
Input Table with Special Numeric Missing Values
When the
“SAS Get Missing Values Grid” property is set to True
and the data set is read, the results resemble the following table.
All character variables are set to missing. Non-missing numeric variables
are set to missing. The fields with special numeric missing values
in the original data set return values to represent the missing value.
Result Recordset with “SAS Get Missing Values Grid”
Set to True
The following
table shows the mapping from the special numeric missing value to
the value that is returned in the record set.
Special Numeric Missing Value Representation