TALLY procedure

Forms a simple tally table of the distinct values in a vector (D.B. Baird & R.D. Stern).


Options

PRINT = string tokens
What to print out for each vector (frequencies, percentages, cumfrequencies, cumpercentages, cumgraph, all); default freq, perc

GRAPH = string tokens
What to display as graphs (cumulative, %cumulative); default * i.e. no graphs

NGROUPS = scalar
Number of groups to form from a variate or factor (ignored for texts); default * forms a group for each distinct value allowing for rounding (see DECIMALS)

DECIMALS = scalar
Number of decimal places to which to round the DATA before forming the groups; default * i.e. no rounding

BOUNDARIES = string token
Whether to interpret the LIMITS as upper or lower boundaries (upper, lower); default lowe

DIRECTION = string token
Order in which to sort (ascending, descending); default asce

OMITEMPTY = string token
Whether empty groups are omitted (yes, no); default no

WEIGHTS = variate
Weights to be used in the tabulations; default * indicates that all units have weight 1

PQUANTILES = string token
Whether to include quantiles on the plot (yes, no); default no


Parameters

DATA = variates, factors or texts
Data vectors to be tallied

LIMITS = variates or texts
Limits to define the groups

FREPRESENTATION = string tokens
For a factor defines the representation used to define the sort order (ordinals, levels, labels); default leve

VALUES = variates or texts
Saves the distinct groups formed for the tally table

FREQUENCIES = variates
Saves the frequencies of each group in the data

PERCENTAGES = variates
Saves the percentage occurence of each group in the data

CUMFREQUENCIES = variates
Saves the cumulative frequencies of each group in the data

CUMPERCENTAGES = variates
Saves the cumulative percentages of each group in the data


Description

TALLY forms a simple tally table of a vector, giving the counts, percentages, and cumulative counts and percentages of each distinct value. These may be printed or saved. The number of classes in the tally table may be reduced for a variate or text by specifying the NGROUPS or DECIMALS options, or the LIMITS parameter. These work exactly as in the GROUPS directive. If limits are specified the BOUNDARIES option controls whether these are interpreted as upper or lower boundaries of the groups; by default they are lower limits. With reduced numbers of classes, the value to represent each group is the median of the units in the group. The WEIGHTS option can supply a variate of weights for the units of the vector, to be used when calculating the table. If this is not set, the units are all assumed to have weights equal to one.

   The PRINT option controls which summaries are printed. The DIRECTION option controls the order of the tally table (ascending or descending). For a factor, the FREPRESENTATION parameter controls which attribute is used to sort the groups (ordinals, levels or labels); by default the levels are used. Also the OMITEMPTY option can be set to omit empty groups. The GRAPH option may be set to cumulative to produce a cumulative frequency graph, or %cumulative to produce a percentage graph. The PQUANTILES option controls whether or not the graphs include quantiles.

   The VALUES, FREQUENCIES, PERCENTAGES, CUMFREQUENCIES, CUMPERCENTAGES parameters can be used to save the information (in variates).

 

Options: PRINT, GRAPH, NGROUPS, DECIMALS, BOUNDARIES, DIRECTION, OMITEMPTY, WEIGHTS, PQUANTILES.

Parameters: DATA, LIMITS, FREPRESENTATION, VALUES, FREQUENCIES, PERCENTAGES, CUMFREQUENCIES, CUMPERCENTAGES.


Method

The GROUPS directive is called for a variate or text to form the grouping factor. Then TABULATE forms the counts for each group.


Action with RESTRICT

Restricted units are left out of the tally results.


See also

Directive: TABULATE.

Procedures: DESCRIBE, MTABULATE, SVSTRATIFIED, SVTABULATE, TABMODE.

Commands for: Basic and nonparametric statistics, Calculations and manipulation, Survey analysis.

Example

CAPTION 'TALLY example'; STYLE=meta
CALC    [SEED=971064] X = GRNORMAL(200;10;3.3)
 &      IntX   = ROUND(X)
 &      Limits = !(-8...8) + 10
TEXT    Txt; !T((A,2(B,2(C)),3(D))3,A,B,E)
GROUPS  X; FacX; LIMITS=Limits
TEXT    Labs; !t(S,R,Q,P,N,M,L,K,J,I,H,G,F,E,D,C,B,A)
FACTOR  [MODIFY=yes;labels=Labs] FacX
TALLY   IntX,Txt,FacX
TALLY   [PRINT=frequencies,cumfrequencies;DIRECTION=descending] IntX
TALLY   [BOUNDARIES=upper;OMITEMPTY=yes] X; LIMITS=Limits
TALLY   [NGROUPS=10] X
TALLY   FacX; FREPRESENTATION=labels
TALLY   [PRINT=*;GRAPH=cumulative] X; VALUES=V; CUMPERCENTAGES=C
TALLY   [PRINT=*;DIRECTION=descending;GRAPH=%cumulative] IntX