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

SMALLEST

Name:
    SMALLEST (LET)
Type:
    Let Subcommand
Purpose:
    Extract the smallest elements of a variable.
Description:
    This is a generalization of the MINIMUM command. However, instead of returning the single smallest value, it returns the user specified number of smallest values.

    The values will be returned in sorted order. If the requested number of smallest values is less than 1, then an error will be returned. If the requested number of smallest values is greater than the number of observations in the response variable, then the full response variable will be returned in sorted order.

Syntax:
    LET <y> = SMALLEST <x> <nval>                         <SUBSET/EXCEPT/FOR>
    where <x> is a response variable;
                <nval> is a number or parameter that specifies how many values to extract;
                <y> is a variable that contains the smallest values;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.
Examples:
    LET NVAL = 3
    LET Y = SMALLEST X NVAL

    LET Y = SMALLEST X 3
    LET Y = SMALLEST X 5

Default:
    None
Synonyms:
    None
Related Commands:
    LARGEST = Return the largest values in a variable.
    MAXIMUM = Return the maximum value of a variable.
    MINIMUM = Return the minimum value of a variable.
Applications:
    Data Transformation
Implementation Date:
    2018/10
Program:
     
    let y = normal random numbers for i = 1 1 100
    let nval = 5
    let yout = smallest y nval
    set write decimals 3
    print yout
        
    The following output is returned
    ---------------
               YOUT
    ---------------
             -2.023
             -1.756
             -1.558
             -1.483
             -1.482
        

Privacy Policy/Security Notice
Disclaimer | FOIA

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

Date created: 10/10/2018
Last updated: 10/10/2018

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