mata function maps(f,a) { nr = rows(a) nc = cols(a) b = J(nr,nc,"") for (i=1;i<=nr;i++) { for (j=1;j<=nc;j++) b[i,j] = (*f)(a[i,j]) } return(b) } function nth(n) { k = max((min((mod(n-1,10)+1,4)),4*(mod(n-10,100)<10))) return(strofreal(n)+("st","nd","rd","th")[k]) } maps(&nth(),((0::25),(250::275),(1000::1025))) end