The first solution is one that I would not have thought of. The UNION function is one that I was not aware of, but is certainly good to know.

For solution #2, I would note that there is no need to use the CMISS function (which was made available only with SAS V9.2). The NMISS function will work just fine in place of the CMISS function in this example. The CMISS function allows testing for missing values of either character or numeric. An IML matrix can be only all character or all numeric. In the present case, we are testing a numeric matrix. For a numeric matrix in IML, the NMISS function which finds numeric missing values will work across all SAS versions.

I would offer an alternative to use of the NMISS or CMISS function. For numeric missing, we can write:

c = (x = .); /** matrix of missing indicators **/
count = c[,+];
mIdx = loc(count>0);

This can be modified for a character matrix as:

c = (x = " "); /** matrix of missing indicators **/
count = c[,+];
mIdx = loc(count>0);

This approach constructs exactly the same indicator matrix C as is obtained using the NMISS or CMISS functions. Since we don't invoke a (data step) function, I would anticipate that this solution would be more efficient.