Is there a Stata equivalent of the SPSS count function, which counts the
number of occurrences of a particular value amongst a set of variables?
Something like this:
count (newvar)=a1 to a21 (5), which assigns newvar the number of times
a1-a21 equals 5 for each case?
Nothing in egen seems to be quite what I'm looking for.