Dataplot Vol 2 Vol 1

# CODEX

Name:
CODEX (LET)
Type:
Let Subcommand
Purpose:
Generate a coded variable based on contiguous values of the response variable, but treat zero as a special case.
Description:
In some cases, you may want to define a tag variable based on some condition. That is, the tag variable will be zero when the condition is meet and 1 otherwise (or vice versa). However, you may want to identify contiguous blocks of the response where the condition is met and give each of the these distinct blocks a unique value. However, where the original response value is zero, that will always be coded as zero.

This command is similar to the CODEZ command. However, it treats the response equal to zero differently (CODEZ treats a block of zeros similar to any other value of the response).

The following shows an example of the CODEZ command

X CODEZ
1 1
1 1
0 0
0 0
1 2
1 2
0 0
0 0
1 3
1 3
0 0
0 0
Syntax:
LET <y> = CODEX <x>             <SUBSET/EXCEPT/FOR qualification>
where <x> is the response variable;
<y> is a variable where the coded values are saved;
and where the <SUBSET/EXCEPT/FOR qualification> is optional.
Examples:
LET Y = CODEX X
LET Y = CODEX X FOR I = 1 1 100
Default:
None
Synonyms:
None
Related Commands:
 CODEZ = Generate a coded variable based on contiguous distinct values. CODE = Generate a coded variable based on distinct values. COCODE = Generate a cocoded variable.
Applications:
Data Manipulation
Implementation Date:
2017/07
Program:

LET X = DATA 1 1 1 2 2 2 0 0 0 1 1 1 1 0 0 3 3 3 3 4
LET Y = CODEX X
.
SET WRITE DECIMALS 0
PRINT X Y

The following output is generated


NIST is an agency of the U.S. Commerce Department.

Date created: 07/14/2017
Last updated: 07/14/2017