*! 1.0.0 ghistcum Graph histogram and cumulative density CFBaum 0315
* 1.1.0 NJC fiddling 16 March 2000
* 1.1.1 NJC transatlantic tinkering 17 March 2000
prog def ghistcum
        version 6
        syntax varname(numeric) [if] [in] [, Connect(str) T1title(str asis) /*
        */ YLAbel(str) XLAbel(str) Bin(int 5) Pen(int 4) * ]

        if "`ylabel'" == "" { local yla "yla" }
        else local yla "yla(`ylabel')"

        if "`xlabel'" == "" { local xla "" }
        else local xla "xla(`xlabel')"

        tempvar cum
        cumul `varlist' `if' `in', gen(`cum')

        local connect = cond("`connect'" != "", "c(`connect')", "c(J)")
        if `"`t1title'"' != "" { local t1 `"t1(`"`t1title'"')"' }
        else local t1 "t1(Histogram and cumulative distribution of `varlist')"

        gph open

        graph `varlist' `if' `in', bbox(0,0,20000,30000,850,390,0) gap(7) /*
        */ ys(0,1) `t1' `yla'  `xla'  bin(`bin') `options'

        graph `cum' `varlist' `if' `in' , bbox(0,0,20000,30000,850,390,0) /*
 */ `connect' noax ys(0,1) pen(`pen') gap(9) sy(i) `t1' `xla'  `yla' `options'

        gph close
end