Question: How can i do convert numbers for binary 8 bytes and plot histogram?

Hello, i want to do convert numbers to binary code 8 bytes and I want to sum the digits of each number 

For example first number is 0 i want to write 0 0 0 0 0 0 0 0 , sum=0, for 1= 0 0 0 0 0 0 0 1,  sum =1 for 7= 0 0 0 0 0 1 1 1 sum=3 etc.....
my code is this;

for i from 0 to 10 do;
> S(i):=convert(i,binary);
> end do;

and output is 

                              S(0) := 0
                              S(1) := 1
                              S(2) := 10
                            S(3) := 11
                            S(4):=100
                             S(5) := 101
                             S(6) := 110
                            S(7) := 111
                           S(8) := 1000
                             S(9) := 1001
                            S(10) := 1010
                and  Histogram(S(i));  doesnt work.                

Please Wait...