-------------------------------------------------------------------------------
help for pcontract                                               (Roger Newson)
-------------------------------------------------------------------------------

Make dataset of frequencies and percentages

pcontract varlist [weight] [if exp] [in range] [, freq(varname) percent(varname) cfreq(varname) cpercent(varname) float format(format) zero nomiss ]

fweights are allowed; see help weights.

Description

pcontract is an extended version of contract. It replaces the dataset in memory with a new dataset consisting of all combinations of varlist that exist in the data and new variables containing the frequency and percentage of each combination, and, optionally, the cumulative frequency and percentage of each combination.

Options

freq(varname) specifies a name for the frequency variable. If not specified, _freq is used. The name must be new.

percent(varname) specifies a name for the percentage variable. If not specified, _percent is used. The name must be new.

cfreq(varname) specifies a name for the cumulative frequency variable. If not specified, no cumulative frequency variable is created. The name must be new.

cpercent(varname) specifies a name for the cumulative percentage variable. If not specified, no cumulative percentage variable is created. The name must be new.

float specifies that the percentage variables specified by percent and cpercent will be generated as variables of type float. If float is not specified, then these variables will be generated as variables of type double. All generated variables are compressed to the smallest storage type possible without loss of precision. See help for compress.

format(format) specifies a display format for the generated percentage variables specified by percent() and cpercent(). If format() is not specified, then these variables will have the display format %8.2f.

zero specifies that combinations with frequency zero are wanted.

nomiss specifies that observations with missing values on any of the variables in varlist will be dropped. If not specified, all observations possible are used.

Examples

. pcontract foreign rep78 . pcontract foreign rep78, zero . pcontract foreign rep78, f(count) zero nomiss . pcontract foreign rep78,fr(frequency) per(percentage) cf(cumfreq) cp(cumperc) float format(%4.0f)

. pcontract _all

Also see

Manual: [R] contract, [R] compress, [R] format

Online: help for contract, compress, format, expand; collapse,