Home Page Overview
New Features Downloads & Prices
P-STAT documentation Technical Support
Contact P-STAT Unistat for Windows

EXPAND: The Power of P-STAT's Programming Language (PPL)


EXPAND is designed to facilitate the creation of dummy variables. It is especially helpful when recoding variables for use by the TURF command.

The previous example showed a simple, single variable use of EXPAND. In this example there are 3 questions. Which of these four radio stations do you listen to at home, at work and in the car?

1) WABC     2) WDEF     3) WGHI     4) WJKL

This is entered as 3 variables coded 1 through 4. In the following example, the input file is named "Radio" and the variables are named "Home" "Work" and "Car".

In the simple example, the output variable is set to 1 if it is mentioned in any of the 3 input variables.

MODIFY radio [ EXPAND Home Car Work, VALUES 1 TO 4,
GEN wabc wdef wghi wjkl ], OUT multi.exp $

 Home   Car  Work   wabc   wdef   wghi   wjkl

    4     3     -      0      0      1      1
    2     1     1      1      1      0      0
    -     2     -      0      1      0      0
    1     1     1      1      0      0      0
    3     -     2      0      1      1      0
    -     4     3      0      0      1      1
    4     4     4      0      0      0      1
    2     -     2      0      1      0      0
    1     1     -      1      0      0      0
    2     -     -      0      1      0      0
    3     1     -      1      0      1      0
    3     -     2      0      1      1      0
    4     -     3      0      0      1      1
    1     3     1      1      0      1      0
    2     3     -      0      1      1      0
ADD is an option which weights the output when a station is mentioned more than once.
MODIFY radio [ EXPAND Home Car Work, VALUES 1 TO 4,
GEN wabc wdef wghi wjkl, ADD ], OUT multi.add $

 Home   Car  Work   wabc   wdef   wghi   wjkl

    4     3     -      0      0      1      1
    2     1     1      2      1      0      0
    -     2     -      0      1      0      0
    1     1     1      3      0      0      0
    3     -     2      0      1      1      0
    -     4     3      0      0      1      1
    4     4     4      0      0      0      3
    2     -     2      0      2      0      0
    1     1     -      2      0      0      0
    2     -     -      0      1      0      0
    3     1     -      1      0      1      0
    3     -     2      0      1      1      0
    4     -     3      0      0      1      1
    1     3     1      2      0      1      0
    2     3     -      0      1      1      0
The input data can be character as well as numeric. Generated names can be specified exactly or you can specify a prefix to use with the input variable names. It is a powerful tool in P-STAT's PPL tool box.

Other identifiers include:
RANK      NEED      EXACT   NO TRIM