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. This example shows the command which can be
entered directly or generated from the
menus available with PC/windows.
In this simple example the question is: "Which of the
following four radio stations are you most likely to listen to?"
1) WABC 2) WDEF
3) WGHI 4) WJKL
This is entered as a single variable coded 1 through 4. TURF requires
4 variables coded 0 or 1. In the following example, the input file is named
"Radio" and the relevant variable is named "Home"
MODIFY radio [ KEEP Home;
EXPAND Home, VALUES 1:4, GEN radio.* ],
OUT At.home $
radio radio radio radio
Home .1 .2 .3 .4
4 0 0 0 1
2 0 1 0 0
- - - - -
1 1 0 0 0
3 0 0 1 0
- - - - -
4 0 0 0 1
2 0 1 0 0
1 1 0 0 0
2 0 1 0 0
3 0 0 1 0
3 0 0 1 0
4 0 0 0 1
1 1 0 0 0
2 0 1 0 0
The variables radio.1 through radio.4 are appropriately coded
for input to the TURF or SURVEY commands. EXPAND can also be
used with character variables as input.
You can, of course do the modification, on a temporary basis as
part of your TURF run.
TURF radio [ EXPAND Home, VALUES 1:4, GEN radio.*] [KEEP radio?],
SIZE 2, REACH.RESULTS radio.reach $