vcount

vcount /Data/tmp/twoyear (or some matrix) < infile > outfile

returns the proportion of non-zero vector elements.