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

EXPAND

Name:
    EXPAND (LET)
Type:
    Let Subcommand
Purpose:
    Given a variable of lab-id's, create a coded variable where the code values are taken from another variable.
Description:
    Suppose we have a variable, LAB, containing 100 lab-id's where there are 10 distinct lab-id's. Suppose we have a variable, XVAL, that contains the means corresponding to each of these 10 lab-id's. This command will create a coded variable where the first value in XVAL will be inserted into the rows with the smallest lab-id, the second value in XVAL will be inserted into the rows with the second smallest lab-id, and so on. If the number of unique values for the lab-id's is greater than the number of rows in XVAL an error message will be generated (if it less, then the extra rows in XVAL will simply be ignored).
Syntax:
    LET <y> = EXPAND <lab> <xval>             <SUBSET/EXCEPT/FOR qualification>
    where <lab> is a variable containing lab or group id's;
                <xval> is a variable (with length equal to the number of distinct values in <lab>);
                <y> is a variable of the same length as <lab> where the coded values are stored;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.
Examples:
    LET Y = EXPAND LAB XMEAN
Default:
    None
Synonyms:
    None
Related Commands:
    CODE = Generate a coded variable.
    COCODE = Generate a cocoded variable.
    COCOPY = Generate a cocoded variable.
    CODE2 = Generate a binary coded variable.
    CODE4 = Generate a quartile coded variable.
    CODE8 = Generate an octal coded variable.
    CODEH = Generate a hinge coded variable.
Applications:
    Data Manipulation
Implementation Date:
    2012/1
Program:
     
    skip 25
    read gear.dat y x
    .
    set let cross tabulate collapse
    let ymean = cross tabulate mean y x
    .
    let y2 = expand x ymean
    set write decimals 3
    print x y y2
        
    The following output is generated.
    ---------------------------------------------
                  X              Y             Y2
    ---------------------------------------------
              1.000          1.006          0.998
              1.000          0.996          0.998
              1.000          0.998          0.998
              1.000          1.000          0.998
              1.000          0.992          0.998
              1.000          0.993          0.998
              1.000          1.002          0.998
              1.000          0.999          0.998
              1.000          0.994          0.998
              1.000          1.000          0.998
              2.000          0.998          0.999
              2.000          1.006          0.999
              2.000          1.000          0.999
              2.000          1.002          0.999
              2.000          0.997          0.999
              2.000          0.998          0.999
              2.000          0.996          0.999
              2.000          1.000          0.999
              2.000          1.006          0.999
              2.000          0.988          0.999
              3.000          0.991          0.995
              3.000          0.987          0.995
              3.000          0.997          0.995
              3.000          0.999          0.995
              3.000          0.995          0.995
              3.000          0.994          0.995
              3.000          1.000          0.995
              3.000          0.999          0.995
              3.000          0.996          0.995
              3.000          0.996          0.995
              4.000          1.004          0.998
              4.000          1.002          0.998
              4.000          0.994          0.998
              4.000          1.000          0.998
              4.000          0.995          0.998
              4.000          0.994          0.998
              4.000          0.998          0.998
              4.000          0.996          0.998
              4.000          1.002          0.998
              4.000          0.996          0.998
              5.000          0.998          0.991
              5.000          0.998          0.991
              5.000          0.982          0.991
              5.000          0.990          0.991
              5.000          1.002          0.991
              5.000          0.984          0.991
              5.000          0.996          0.991
              5.000          0.993          0.991
              5.000          0.980          0.991
              5.000          0.996          0.991
              6.000          1.008          0.998
              6.000          1.012          0.998
              6.000          1.008          0.998
              6.000          0.997          0.998
              6.000          0.988          0.998
              6.000          1.002          0.998
              6.000          0.995          0.998
              6.000          0.998          0.998
              6.000          0.981          0.998
              6.000          0.996          0.998
              7.000          0.990          1.001
              7.000          1.004          1.001
              7.000          0.996          1.001
              7.000          1.000          1.001
              7.000          0.998          1.001
              7.000          1.000          1.001
              7.000          1.018          1.001
              7.000          1.010          1.001
              7.000          0.996          1.001
              7.000          1.002          1.001
              8.000          0.998          1.000
              8.000          1.000          1.000
              8.000          1.006          1.000
              8.000          1.000          1.000
              8.000          1.002          1.000
              8.000          0.996          1.000
              8.000          0.998          1.000
              8.000          0.996          1.000
              8.000          1.002          1.000
              8.000          1.006          1.000
              9.000          1.002          0.998
              9.000          0.998          0.998
              9.000          0.996          0.998
              9.000          0.995          0.998
              9.000          0.996          0.998
              9.000          1.004          0.998
              9.000          1.004          0.998
              9.000          0.998          0.998
              9.000          0.999          0.998
              9.000          0.991          0.998
             10.000          0.991          0.994
             10.000          0.995          0.994
             10.000          0.984          0.994
             10.000          0.994          0.994
             10.000          0.997          0.994
             10.000          0.997          0.994
             10.000          0.991          0.994
             10.000          0.998          0.994
             10.000          1.004          0.994
             10.000          0.997          0.994
        

Date created: 01/27/2012
Last updated: 01/27/2012
Please email comments on this WWW page to alan.heckert@nist.gov.