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

SUBSET

Name:
    SUBSET
Type:
    Keyword
Purpose:
    Specifies a subset to be included for any plot, analysis, and certain support commands.
Syntax 1:
    <command> SUBSET <var> <qual> <list of values>
    where <command> is a DATAPLOT command that allows subsets;
                <var> is a variable for which the subset is defined;
                <qual> is an optional qualifier (=, <, >, <>, <=, >=);
    and      <list of values> are the values of <var> to be excluded.

    If <qual> is omitted, equality (i.e, =) is assumed.

Syntax 2:
    <command> SUBSET <var> <min> TO <max>
    <command> SUBSET <var> = <min> TO <max>
    where <command> is a DATAPLOT command that allows subsets;
                <var> is a variable for which the subset is defined;
                <min> is the minimum value of <var> to exclude;
    and      <max> is the maximum value of <var> to exclude.

    The "=" qualifier is optional in this syntax. This syntax excludes all values between (inclusive) <min> and <max>.

Examples:
    FIT Y=A*EXP(B*X) SUBSET X 101 TO 1000
    PLOT Y PRED VERSUS X SUBSET LAB 4
    PLOT Y X SUBSET LAB 2 TO 8 SUBSET LAB 4
    LET Y1 = Y2 SUBSET TAG = 4
Note:
    Expressions are not supported. That is,

      PLOT Y X SUBSET Y > 2*A

    is not valid. You need to do something like

      LET B = 2*A
      PLOT Y X SUBSET Y > B
Note:
    The SUBSET variable does not have to be one of the variables used in the command (e.g., PLOT X SUBSET TAG > 0).
Note:
    Using SUBSET TAG 101 1000 means to subset on the specific values 101 and 1000 (you can list more than two values) while using SUBSET 101 TO 1000 means to subset on the values between 101 and 1000 (inclusive).
Note:
    Although DATAPLOT does not explicitly support missing values, the SUBSET command can be used to exclude missing data (pick a value to mean missing and SUBSET on that value).
Note:
    More than one SUBSET clause can be used on a single command.
Note:
    Previously for SUBSET clauses the value to the right of the operator was restricted to being a number or a parameter. That is, for

      PLOT Y X SUBSET X > A

    the name A was restricted to a parameter name (i.e., a single value).

    The 2021/07 version of Dataplot extended this to support variables on he right hand side. So you can now do something like

      LET N = 10
      LET Y1 = NORMAL RANDOM NUMBERS FOR I = 1 1 N
      LET Y1 = SORT Y1
      LET Y2 = LOGISTIC RANDOM NUMBERS FOR I = 1 1 N
      LET Y2 = SORT Y2
      LET TAG = 0 FOR I = 1 1 N
      LET TAG = 1 SUBSET Y1 < Y2

    This is only supported for Syntax 1.

Default:
    None
Synonyms:
    None
Related Commands:
    EXCEPT = Allows exclusion-specification of a subset.
    FOR = Allows row-specification of a subset.
    < = Allows "less than" subset.
    = Allows "less than or equal to" subset.
    = = Allows "equal to" subset.
    = Allows "greater than or equal to" subset.
    > = Allows "greater than" subset.
    = Allows "not equal" subset.
Applications:
    Data Subsetting
Implementation Date:
    Pre-1987
Program:
     
    LET X = SEQUENCE 1 1 10
    LET Y = X**2
    PRINT X Y
    PRINT X Y SUBSET Y > 60
    RETAIN X Y SUBSET Y > 60
    PRINT X Y
        
    The following output is generated
     ------------------------------
                   X              Y
     ------------------------------
             1.00000        1.00000
             2.00000        4.00000
             3.00000        9.00000
             4.00000       16.00000
             5.00000       25.00000
             6.00000       36.00000
             7.00000       49.00000
             8.00000       64.00000
             9.00000       81.00000
            10.00000      100.00000
      
      
     ***** NOTE--
           SUBSET VARIABLE = Y
           SUBSET MINIMUM  =  0.6000006000E+02
           SUBSET MAXIMUM  =  0.1797693135+309
           INPUT  NUMBER OF OBSERVATIONS  =       10
           NUMBER OF OBSERVATIONS IGNORED =        7
           OUTPUT NUMBER OF OBSERVATIONS  =        3
      
     ------------------------------
                   X              Y
     ------------------------------
             8.00000       64.00000
             9.00000       81.00000
            10.00000      100.00000
      
      
     ***** NOTE--
           SUBSET VARIABLE = Y
           SUBSET MINIMUM  =  0.6000006000E+02
           SUBSET MAXIMUM  =  0.1797693135+309
           INPUT  NUMBER OF OBSERVATIONS  =       10
           NUMBER OF OBSERVATIONS IGNORED =        7
           OUTPUT NUMBER OF OBSERVATIONS  =        3
      
      
     VARIABLE X       --OLD NUMBER OF ELEMENTS =       10
                        NEW NUMBER OF ELEMENTS =        3
                        FIRST VALUE DELETED    =   0.1000000E+01
                              (DELETED FROM ROW        1)
                        LAST  VALUE DELETED    =   0.7000000E+01
                              (DELETED FROM ROW        7)
                        FIRST VALUE RETAINED   =   0.8000000E+01
                              (MOVED FROM ROW        8 TO ROW        1  )
                        LAST  VALUE RETAINED   =   0.1000000E+02
                              (MOVED FROM ROW       10 TO ROW        3)
      
     VARIABLE Y       --OLD NUMBER OF ELEMENTS =       10
                        NEW NUMBER OF ELEMENTS =        3
                        FIRST VALUE DELETED    =   0.1000000E+01
                              (DELETED FROM ROW        1)
                        LAST  VALUE DELETED    =   0.4900000E+02
                              (DELETED FROM ROW        7)
                        FIRST VALUE RETAINED   =   0.6400000E+02
                              (MOVED FROM ROW        8 TO ROW        1  )
                        LAST  VALUE RETAINED   =   0.1000000E+03
                              (MOVED FROM ROW       10 TO ROW        3)
      
     ------------------------------
                   X              Y
     ------------------------------
             8.00000       64.00000
             9.00000       81.00000
            10.00000      100.00000
        

Privacy Policy/Security Notice
Disclaimer | FOIA

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

Date created: 07/27/2021
Last updated: 07/27/2021

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