SED navigation bar go to SED home page go to Dataplot home page go to NIST home page SED Home Page SED Staff SED Projects SED Products and Publications Search SED Pages
Dataplot Vol 2 Vol 1

CODEZ

Name:
    CODEZ (LET)
Type:
    Let Subcommand
Purpose:
    Generate a coded variable based on contiguous values of the response variable.
Description:
    The CODE command codes the values in a response variable based on the distinct values in the response variable without regard to the order of the values in the response variable.

    The CODEZ command is similar to the CODE command. However, the CODEZ command takes the order of the response variable into account. Specifically, CODEZ changes the value of the coded variable whenever the response variable changes value.

    The following example shows the difference between the CODE and CODEZ commands.

      X CODE CODEZ
      1 1 1
      1 1 1
      2 2 2
      2 2 2
      3 3 3
      3 3 3
      1 1 4
      1 1 4
      2 2 5
      2 2 5
      3 3 6
      3 3 6
Syntax:
    LET <y> = CODEZ <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 = CODEZ X
    LET Y = CODEZ X SUBSET X > 0
Default:
    None
Synonyms:
    None
Related Commands:
    CODE = Generate a coded variable based on distinct values.
    CODEX = Generate a coded variable based on contiguous distinct values (but treat zero as special case).
    COCODE = Generate a cocoded variable.
Applications:
    Data Manipulation
Implementation Date:
    2016/06
Program:
     
    LET X = DATA 1 1 1 2 2 2 3 3 3 1 1 1 1 2 2 3 3 3 3 4
    LET Y = CODEZ X
    .
    SET WRITE DECIMALS 0
    PRINT X Y
        
    The following results are generated.
    ------------------------------
                  X              Y
    ------------------------------
                  1              1
                  1              1
                  1              1
                  2              2
                  2              2
                  2              2
                  3              3
                  3              3
                  3              3
                  1              4
                  1              4
                  1              4
                  1              4
                  2              5
                  2              5
                  3              6
                  3              6
                  3              6
                  3              6
                  4              7
        

Privacy Policy/Security Notice
Disclaimer | FOIA

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

Date created: 07/06/2016
Last updated: 07/06/2016

Please email comments on this WWW page to alan.heckert.gov.