a sas9 feature (not sure if it is available earlier) which seems to be most appropriate is the count() function.
It works on strings, but the catx() function provides a flexible way of collecting variables into a string with delimiters ensuring the original columns can still be distinguished.
Demonstrated here in a ~"flexible" kind of way with a mixture of data-type columns[pre]106 %let var_list = age name height ;
107 data;
108 set sashelp.class ;
109
110 ** alter content to prove the counting works ;
111 if _n_ in( 1,5,9) then name='1' ;
112 if _n_ in( 3,5,8) then height=1 ;
113
114 ones_ct = count( '||' !! catx( '||', of &var_list ) !!'||', '|1|' ) ;
115 run ;
NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: The data set WORK.DATA13 has 19 observations and 6 variables.
[/pre]
It places two pipe(|) marks around and between column values and searches for single pipes surrounding each 1. There might be a simpler way to maintain separation of the ones, but I found a problem with a single pipe when consecutive variable have value=1.
For Mirisage's data:
change the variable names assigned to the macro variable &var_list
replace sashelp.class with the appropriate dataset and
remove the testing lines numbered 110 to 112 in the log above.
PeterC