------------------------------------------------------------------------------- help forpcontract(Roger Newson) -------------------------------------------------------------------------------

Make dataset of frequencies and percentages

pcontractvarlist[weight] [ifexp] [inrange] [,freq(varname)percent(varname)cfreq(varname)cpercent(varname)floatformat(format)zeronomiss]

fweights are allowed; see help weights.

Description

pcontractis an extended version of contract. It replaces the dataset in memory with a new dataset consisting of all combinations ofvarlistthat 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,_freqis used. The name must be new.

percent(varname)specifies a name for the percentage variable. If not specified,_percentis 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.

floatspecifies that the percentage variables specified bypercentandcpercentwill be generated as variables of type float. Iffloatis 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 bypercent()andcpercent(). Ifformat()is not specified, then these variables will have the display format%8.2f.

zerospecifies that combinations with frequency zero are wanted.

nomissspecifies that observations with missing values on any of the variables invarlistwill 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 seeManual:

[R] contract,[R] compress,[R] formatOnline: help for contract, compress, format, expand; collapse,