Reputation: 794
Trying to use the following code to sum horizontally and create a dummy total. So, each variable in the array is a dummy flag. I want to count the number of dummy flags per row.
data rep;
set clean;
array missU (9) util_92013 util_32014 util_22014 util_72013 util_82013 util_12014 util_42014 util_122013 util_62014;
do i = 1 to 9;
totalU = sum(of missU(i));
end;
drop i;
run;
I continue getting NOTE: Missing values were generated as a result of performing an operation on missing values.
Upvotes: 1
Views: 2140
Reputation: 63434
You don't need a loop.
data rep;
set clean;
array missU ... ;
totalU = sum(of missU[*],0);
run;
As user667489 pointed out in comments, adding a zero to the sum function will avoid a missing value being generated when all flags are missing (if that's desired).
Upvotes: 1