Sas Array Count Function In R