NULL_PROCESSOR Function
Facilitates the use of the Null_Info keyword for the DB_SQL function by extracting the list of rows containing missing for one or more columns.
Usage
table = NULL_PROCESSOR(null_info_object,['col1','col2', ..., 'coln'], Comp=comp)
Input Parameters
null_info_object—The object returned by the Null_Info keyword in the DB_SQL call.
coli—The list of column names.
Keywords
Comp=comp—Produces the complement to the result, that is, the result contains a list of rows with missing data. comp contains a list of rows with no missing data.
Discussion
Assuming the following use of the DB_SQL Null_Info keyword:
table=db_sql(db_connect('oracle', 'user_id/user_pw'), $
'select * from blanktest', null_info=foo)
where
blanktest contains the data given in
Table 2-1: blanktest Data, which has missing data for ID_NO in the 4
th, 9
th, and 11
th rows and missing data for ANIMAL_NAME in the 3
rd, 8
th, and 10
th rows.
note | NULL indicates a NULL value in the corresponding database field. |
Then,
jjj=NULL_PROCESSOR(foo,['ID_NO','ANIMAL_NAME'],Comp=comp)
produces the results
jjj = 2 3 7 8 9 10
comp = 0 1 4 5 6
This output can be utilized as in the following examples.
Table2 = table(comp)
produces a table with only rows and no missing values, as shown in
Table 2-2: Table2, or as in
Table 2-1: blanktest Data.
Then,
Table3=table(jjj)
produces a table, as shown in
Table 2-3: Table3, containing only rows with missing data (note how zeros have been substituted for values of ID_NO that are missing).
Instead, if you want only the locations where one field is missing, a different db_sql call, jjj=foopro(foo,['ID_NO'],Comp=comp), returns an array, jjj, with the rows where ID_NO is missing (3 8 10).
Remember that rows are counted beginning with 0.