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

UNSTACK

Name:
    UNSTACK
Type:
    LET Subcommand
Purpose:
    Given a response variable and an associated group-id variable, create a separate response variable corresponding to each unique value of the group-id variable.
Description:
    Many commands in Dataplot expect the data to be in the form of a single response variable and a group-id variable (e.g., BOX PLOT, MEAN PLOT, SD PLOT, TABULATE). Therefore it is common for data to be created in this form for usage in Dataplot.

    However, there may be occasions where it is more convenient to work with the data were the data for each group is in a separate response variable. This command performs this conversion.

    Currently, group-id variables with up to 99 distinct values are supported (if the group-id variable has more than 99 distinct values, an error message will be generated).

    This command is the reverse of the STACK command which converts from the multi-column form to the single response variable with group-id variable form.

Syntax:
    LET <z> = UNSTACK <y> <x>       <SUBSET/EXPCEPT/FOR qualification>
    where <y> is a response variable;
                <x> is a group-id variable;
                <z> is the base name for the generated response variables;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.

    The <z> is the base name for the new response variables. So if Z is the base name and there are five distinct values in the group-id variable, this command will generate the new response variables Z1, Z2, Z3, Z4 and Z5. The Z variable will contain the distinct values of the group-id variable.

Examples:
    LET Z = UNSTACK Y X
    LET Z = UNSTACK Y X SUBSET X > 2
Note:
    The distinct values of the group-id variable are sorted. For example, if the group-id variable contains the distinct values 2, 6, and 8 and Z is the base name, the response variable Z1 will contain the response values associated with 2, Z2 will contain the response values associated with 6 and Z3 will contain the response values associated with 8. This will be the case regardless of how the original response and group-id variables are ordered.
Default:
    None
Synonyms:
    None
Related Commands:
    STACK = Convert a response variable and an associated group-id variable to multiple response variables.
Applications:
    Data Management
Implementation Date:
    2016/09
Program:
     
    dimension 100 columns
    skip 25
    read gear.dat y x
    .
    let z = unstack y x
    set write decimals 4
    print z1 z2 z3 z4 z5
    print z6 z7 z8 z9 z10
    print z
        
     
    ---------------------------------------------------------------------------
                 Z1             Z2             Z3             Z4             Z5
    ---------------------------------------------------------------------------
             1.0060         0.9980         0.9910         1.0050         0.9980
             0.9960         1.0060         0.9870         1.0020         0.9980
             0.9980         1.0000         0.9970         0.9940         0.9820
             1.0000         1.0020         0.9990         1.0000         0.9900
             0.9920         0.9970         0.9950         0.9950         1.0020
             0.9930         0.9980         0.9940         0.9940         0.9840
             1.0020         0.9960         1.0000         0.9980         0.9960
             0.9990         1.0000         0.9990         0.9960         0.9930
             0.9940         1.0060         0.9960         1.0020         0.9800
             1.0000         0.9880         0.9960         0.9960         0.9960
     
     
    ---------------------------------------------------------------------------
                 Z6             Z7             Z8             Z9            Z10
    ---------------------------------------------------------------------------
             1.0090         0.9900         0.9980         1.0020         0.9910
             1.0130         1.0040         1.0000         0.9980         0.9950
             1.0090         0.9960         1.0060         0.9960         0.9840
             0.9970         1.0010         1.0000         0.9950         0.9940
             0.9880         0.9980         1.0020         0.9960         0.9970
             1.0020         1.0000         0.9960         1.0040         0.9970
             0.9950         1.0180         0.9980         1.0040         0.9910
             0.9980         1.0100         0.9960         0.9980         0.9980
             0.9810         0.9960         1.0020         0.9990         1.0040
             0.9960         1.0020         1.0060         0.9910         0.9970
     
     
    ---------------
                  Z
    ---------------
             1.0000
             2.0000
             3.0000
             4.0000
             5.0000
             6.0000
             7.0000
             8.0000
             9.0000
            10.0000
        

Privacy Policy/Security Notice
Disclaimer | FOIA

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

Date created: 01/24/2017
Last updated: 01/24/2017

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