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

KEEP

Name:
    KEEP (LET)
Type:
    Let Subcommand
Purpose:
    Given a group-id variable, create a tag variable based on a list of groups to keep.
Description:
    For some analyses, it may be necessary to omit some laboratories from the analysis. Although you can create an appropriate tag variable manually, the KEEP command can simplify that process.

    For example, if you have labs 1 to 10 and you want to perform your analysis on labs 3 and 8 only, you can do something like the following

      LET XKEEP = DATA 3 8
      LET TAG = KEEP X XKEEP

    That is, this command will return a tag variable (TAG) based on the values of X. Values of X that match any value in XKEEP will be set to 1 and values of X that do not match any values in XKEEP will be set to 0.

Syntax:
    LET <tag> = KEEP <x> <xkeep>             <SUBSET/EXCEPT/FOR qualification>
    where <x> is the group-id variable;
                <xkeep> is a list of values to match against <x>;
                <tag> is a variable of the same length as <x> that will contain 1 where a match is found and 0 otherwise;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.
Examples:
    LET TAG = KEEP X XKEEP
Note:
    The OMIT command is similar. However, with the OMIT command you specify a list of lab id's to omit rather than to keep.
Default:
    None
Synonyms:
    None
Related Commands:
    OMIT = Create a tag variable based on a list of labs to omit.
    CODE = Generate a coded variable.
    COCODE = Generate a coded variable based on another variable.
    COCOPY = Generate a coded variable based on another variable.
Applications:
    Data Transformations
Implementation Date:
    2011/4
Program:
     
    skip 25
    read gear.dat y x
    set write decimals 4
    .
    let xkeep = data 1 3 5 7 8 9
    let tag = keep x xkeep
    print x tag y
        
    The following output is generated:
    ---------------------------------------------
                  X            TAG              Y
    ---------------------------------------------
             1.0000         1.0000         1.0060
             1.0000         1.0000         0.9960
             1.0000         1.0000         0.9980
             1.0000         1.0000         1.0000
             1.0000         1.0000         0.9920
             1.0000         1.0000         0.9930
             1.0000         1.0000         1.0020
             1.0000         1.0000         0.9990
             1.0000         1.0000         0.9940
             1.0000         1.0000         1.0000
             2.0000         0.0000         0.9980
             2.0000         0.0000         1.0060
             2.0000         0.0000         1.0000
             2.0000         0.0000         1.0020
             2.0000         0.0000         0.9970
             2.0000         0.0000         0.9980
             2.0000         0.0000         0.9960
             2.0000         0.0000         1.0000
             2.0000         0.0000         1.0060
             2.0000         0.0000         0.9880
             3.0000         1.0000         0.9910
             3.0000         1.0000         0.9870
             3.0000         1.0000         0.9970
             3.0000         1.0000         0.9990
             3.0000         1.0000         0.9950
             3.0000         1.0000         0.9940
             3.0000         1.0000         1.0000
             3.0000         1.0000         0.9990
             3.0000         1.0000         0.9960
             3.0000         1.0000         0.9960
             4.0000         0.0000         1.0049
             4.0000         0.0000         1.0020
             4.0000         0.0000         0.9940
             4.0000         0.0000         1.0000
             4.0000         0.0000         0.9950
             4.0000         0.0000         0.9940
             4.0000         0.0000         0.9980
             4.0000         0.0000         0.9960
             4.0000         0.0000         1.0020
             4.0000         0.0000         0.9960
             5.0000         1.0000         0.9980
             5.0000         1.0000         0.9980
             5.0000         1.0000         0.9820
             5.0000         1.0000         0.9900
             5.0000         1.0000         1.0020
             5.0000         1.0000         0.9840
             5.0000         1.0000         0.9960
             5.0000         1.0000         0.9930
             5.0000         1.0000         0.9800
             5.0000         1.0000         0.9960
             6.0000         0.0000         1.0089
             6.0000         0.0000         1.0129
             6.0000         0.0000         1.0089
             6.0000         0.0000         0.9970
             6.0000         0.0000         0.9880
             6.0000         0.0000         1.0020
             6.0000         0.0000         0.9950
             6.0000         0.0000         0.9980
             6.0000         0.0000         0.9810
             6.0000         0.0000         0.9960
             7.0000         1.0000         0.9900
             7.0000         1.0000         1.0040
             7.0000         1.0000         0.9960
             7.0000         1.0000         1.0009
             7.0000         1.0000         0.9980
             7.0000         1.0000         1.0000
             7.0000         1.0000         1.0180
             7.0000         1.0000         1.0100
             7.0000         1.0000         0.9960
             7.0000         1.0000         1.0020
             8.0000         1.0000         0.9980
             8.0000         1.0000         1.0000
             8.0000         1.0000         1.0060
             8.0000         1.0000         1.0000
             8.0000         1.0000         1.0020
             8.0000         1.0000         0.9960
             8.0000         1.0000         0.9980
             8.0000         1.0000         0.9960
             8.0000         1.0000         1.0020
             8.0000         1.0000         1.0060
             9.0000         1.0000         1.0020
             9.0000         1.0000         0.9980
             9.0000         1.0000         0.9960
             9.0000         1.0000         0.9950
             9.0000         1.0000         0.9960
             9.0000         1.0000         1.0040
             9.0000         1.0000         1.0040
             9.0000         1.0000         0.9980
             9.0000         1.0000         0.9990
             9.0000         1.0000         0.9910
            10.0000         0.0000         0.9910
            10.0000         0.0000         0.9950
            10.0000         0.0000         0.9840
            10.0000         0.0000         0.9940
            10.0000         0.0000         0.9970
            10.0000         0.0000         0.9970
            10.0000         0.0000         0.9910
            10.0000         0.0000         0.9980
            10.0000         0.0000         1.0040
            10.0000         0.0000         0.9970
        

Date created: 06/23/2011
Last updated: 06/23/2011
Please email comments on this WWW page to alan.heckert@nist.gov.