program define rccount
*! version 1.0  1mar1998    Zbinden@cmu.unige.ch
version 5.0

        local newvar "`1'"
        confirm new variable `newvar'

        local numb "`2'"
        confirm number `numb'

        mac shift 2
        tempvar xv
        local varlist "req ex"
        parse "`*'"
        parse "`varlist'", parse(" ")

        gen str1 $_xv=" "
        gen str1 `newvar' = ""
        while "`1'" ~= "" {
                quietly replace $_xv="."
                quietly replace $_xv="1" if (`1'==`numb')
                quietly replace `newvar' = `newvar' + $_xv
                mac shift
        }
tab1 `newvar'
end
exit