VARSTAT <data>,Y,<rule>
computes a derived variable Y from active variables (say X1,X2,...,Xm)
for active observations in <data> according to a given <rule>.
Rules available are:
VARSTAT <data>,Y,SUM Y=X1+X2+...
VARSTAT <data>,Y,SUM,p Y=X1^p+X2^p+...
VARSTAT <data>,Y,MEAN Y=(X1+X2+...)/m
VARSTAT <data>,Y,MEAN,p Y=((X1^p+X2^p+...)/m)^(1/p)
VARSTAT <data>,Y,MEDIAN Y=median(X1,X2,...)
VARSTAT <data>,Y,STDDEV Y=stddev(X1,X2,...)
VARSTAT <data>,Y,MAX Y=max(X1,X2,...)
VARSTAT <data>,Y,MIN Y=min(X1,X2,...)
VARSTAT <data>,Y,RANGE Y=max-min
VARSTAT <data>,Y,#MISS Y= # of missing values
VARSTAT <data>,Y,#N Y= # of non-missing values
VARSTAT <data>,Y,#VAL,A Y= # of values X=A (A is a constant)
VARSTAT <data>,Y,#VAL,A,B Y= # of values A<=X<=B (A and B constants)
Other forms of VARSTAT are described on next pages.
To compute several Y variables (say Y1,Y2,...) with different rules for
the same X1,X2,..., another form of VARSTAT with a VARSTAT specification
is
VARSTAT <data> / VARSTAT=Y1,Y2,...
Y1=<rule1> Y2=<rule2>, ...
For example, the mean and the standard deviation in each active observation
are computed as variables M1 and S1 by
VARSTAT <data> / VARSTAT=M1,S1 M1=MEAN S1=STDDEV
VARSTAT <data>,*,<rule>
makes a collective transformation for all active variables. The original
values are overwritten in this form of VARSTAT.
Alternative rules:
VARSTAT <data>,*,DIVSUM,100 Xi=100*Xi/SUM i=1,2,...,m
VARSTAT <data>,*,DIVMAX,100 Xi=100*Xi/MAX
VARSTAT <data>,*,NORM,p,C Normalize: X1^p+X2^p+..=C
VARSTAT <data>,*,CENTER Xi=Xi-mean
VARSTAT <data>,*,STANDARD Xi=(Xi-mean)/stddev
VARSTAT <data>,*,DIV,<var> Xi=Xi/<var>
VARSTAT <data>,*,MLT,<var> Xi=Xi*<var>
VARSTAT <data>,*,ADD,<var> Xi=Xi+<var>
VARSTAT <data>,*,SUB,<var> Xi=Xi-<var>
VARSTAT <data>,*,SORT Sort in ascending order
Example:
VARSTAT TEST,*,DIVSUM / Activate these two VARSTAT lines!
VARSTAT TEST,Sum,SUM
VARS=X1,X2,X3
DATA TEST,A,B,N,M
X1 X2 X3 Sum
AA.AA AA.AA AA.AA 111.111
6 - 1
6 3 5
- 1 7
8 1 0
6 2 2
A = Some special forms of VARSTAT
V = More information on transformations