Generate frequency distribution -------------------------------
^genfreq^ varname [^if^ exp] [^in^ range] [weight] ^, f^generate^(^freqvar^)^ [ ^b^generate^(^bincentrevar^)^ ^w^idth^(^#^) by(^byvarlist^)^ ^u^linc ]
^genfreq^ produces a frequency distribution for varname in which the range of varname is divided into bins or classes of width given by ^width( )^ and the frequency of values falling into each class is computed. The limits of each class are multiples of the width.
The default convention can be illustrated by example: if mpg varies from 12 to 41 miles per gallon, with width 2, the classes will be by default 12 to almost 14, 14 to almost 16, ... , 40 to almost 42. In general, each frequency is the number >= the lower limit and < the upper limit of each class. The opposite convention is obtained by using the ^ulinc^ option.
aweights, fweights and iweights are allowed.
^fgenerate(^freqvar^)^ specifies a new variable to include the frequencies. It is required.
^bgenerate(^bincentrevar^)^ specifies a new variable to include the midpoints or centres of each bin. It is required unless the data are treated as they are, that is, no width is specified.
^width(^#^)^ specifies the width of each class. The default is ^width(0)^, meaning that the data are treated as they are.
^by(^byvarlist^)^ specifies that frequencies are to be computed separately for distinct values of byvarlist.
^ulinc^ specifies that the upper limits are to be inclusive. In the example above, they would run from just above 10 to 12, and so on. In general, each frequency is the number > the lower limit and <= the upper limit of each class.
. ^genfreq mpg, f(Fmpg)^ . ^genfreq mpg, w(2) f(Fmpg2) b(Bmpg2)^
Nicholas J. Cox, University of Durham, U.K. n.j.cox@@durham.ac.uk
Also see --------
On-line: help for @graph@, @barplot@ (if installed)