Forms a simple tally table of the distinct values in a vector (D.B. Baird & R.D. Stern).
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.
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.
Procedures: DESCRIBE, MTABULATE, SVSTRATIFIED, SVTABULATE, TABMODE.
Commands for: Basic and nonparametric statistics, Calculations and manipulation, Survey analysis.
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