program def histplot
*! NJC 1.0.3 13 April 1999
* NJC 1.0.2 26 January 1999
* NJC 1.0.1 4 Sept 1998
* NJC 1.0.0 31 August 1998
        version 6.0
        syntax varlist(max=1) [if] [in] [aweight fweight iweight] /*
        */ [ , Width(real 0) Ulinc BY(varname) JOIN FRac TOtal * ]
        if "`by'" != "" { local byby "by(`by')" }
        if "`total'" == "total" {
                di _n in bl "Sorry: total option not available"
        }
        marksample touse, strok
        tempvar bgen fgen
        genfreq `varlist' if `touse' [`weight' `exp'], /*
         */ w(`width') bg(`bgen') fg(`fgen') `ulinc' `byby'
        if "`frac'" == "frac" { qui replace `fgen' = `fgen' / $S_1 }
        barplot `fgen' `bgen', w(`width') `join' `byby' `options'
end