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 1 Vol 2

CHARACTER CODE

Name:
    CHARACTER CODE (LET)
Type:
    Subcommand under LET
Purpose:
    Converts previously read character data to a coded numeric variable.
Description:
    Dataplot can now read character data using the

      SET CONVERT CHARACTER ON

    command. This command stores the character fields in the file "dpchzf.dat".

    The two primary uses of character data are:

    1. Provide a row identifier for the data.

    2. Define a group (or factor) variable. For example, we can identify sex by coding males as M and females as F.

    In the context of Dataplot, we can use groups in two contexts.

    1. The group variable can be used in a numerical context. For example,

        BOX PLOT Y X

      Here, X is the group-id variable.

      The command CHARACTER CODE (or ALPHABETIC CHARACTER CODE) can be used to create a coded numeric variable from a character variable saved in the file dpchzf.dat.

    2. We may want to use the group label for labeling. In this case, we typically want to use the character coding.

      The GROUP LABEL command is used to create character group labels from a character variable saved in the file dpchzf.dat.

      The GROUP LABEL will extract and save the unique rows for the specified character variable.

    The CHARACTER CODE command identifies the unique rows in the character variable (Dataplot checks for exact matches, it does not try to guess if a typo has occurred, etc.). If there are K unique rows, Dataplot will generate coded values as the integer values from 1 to K. The CHARACTER CODE performs the coding in the order that the unique rows are encoutered in the file.

    The ALPHABETIC CHARACTER CODE is a variant of the CHARACTER CODE command that sorts the unique character rows and assigns the code based on the alphabetic order of the character rows.

Syntax 1:
    LET <y> = CHARACTER CODE <ix>
    where <ix> specifies the name of the character variable in the file dpzchf.dat;
    and    <y> specifies the name for the coded numberic variable to be saved.

    The character variable is originally created with a READ command where the SET CONVERT CHARACTER ON was entered prior to the READ.

Syntax 2:
    LET <y> = ALPHABETIC CHARACTER CODE <ix>
    where <ix> specifies the name of the character variable in the file dpzchf.dat;
    and    <y> specifies the name for the coded numberic variable to be saved.

    The character variable is originally created with a READ command where the SET CONVERT CHARACTER ON was entered prior to the READ.

    This syntax assigns the codes based on the alphabetic order of the character variable.

Examples:
    SET CONVERT CHARACTER ON
    READ TEST.DAT Y X IX
    LET Y = CHARACTER CODE IX
Default:
    None
Synonyms:
    None
Related Commands:
    READ = Carries out a column-wise input of data.
    CONVERT CHARACTER = Specify how Dataplot will handle character data.
    GROUP LABEL = Converts character data to a group label variable.
    ALPHABETIC CHARACTER CODE = Converts character data to a coded numeric variable.
    ROWLABELS = Define row labels from character data.
Applications:
    Input/Output
Implementation Date:
    2004/1
Program:
     
    set convert character on
    skip 25
    read draft69c.dat rank day month
    .
    let ig = group label month
    x1tic mark label format group label
    x1tic mark label content ig
    x1tic mark label font simplex
    x1tic mark label angle 45
    x1tic mark label displacement 10
    let xcode = character code month
    .
    major xtic mark number 12
    minor xtic mark number 0
    xlimits 1 12
    xtic offset 0.5 0.5
    .
    char box plot
    line box plot
    fences on
    .
    box plot rank xcode
        
    plot generated by sample program

Privacy Policy/Security Notice
Disclaimer | FOIA

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

Date created: 02/03/2004
Last updated: 12/15/2013

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