*! 1.2.0 GML 5 June 2001
prog def datesum, byable(recall)
    version 7
    syntax varlist [if] [in], [ Format(string) ]
    marksample touse, novarl
    foreach datvar of local varlist {
        local vname : var l `datvar'
        if "`vname'" == `""' { local vname "`datvar'" }
        if `"`format'"'~="" {
            local datfmt "`format'"
        }
        else {
            local vform : format `datvar'
            if substr("`vform'",2,1) == "d" {
                local datfmt "`vform'"
            }
            else {
                local datfmt "%dN/D/Y"
            }
        }
        qui sum `datvar' if `touse',d
        di
        di in gr " `vname'"
        di in gr "  observations: " in yel r(N)
        di in gr "  min:  " `datfmt' in yel r(min) /*
           */ in gr "     25th %tile: " `datfmt' in yel round(r(p25),1) /*
           */ in gr "     s.d.(days): "%7.1g in yel r(sd)
        di in gr "  max:  " `datfmt' in yel r(max) /*
           */ in gr "     median:     " `datfmt' in yel round(r(p50),1)
        di in gr "  mean: " `datfmt' in yel round(r(mean),1) /*
           */ in gr "     75th %tile: " `datfmt' in yel round(r(p75),1)
    }
end