IS MISSING and IS NOT MISSING Operators in SAS Programming

  1. IS MISSING Operator: Selecting Missing Values

    Task 1: Suppose you want to select only those observations in which students did not fill their section information.

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    data readin;
    input name $ Section $ Score;
    cards;
    Raj  A 80
    Atul . 77
    Priya B 45
    Sandeep A 95
    Rahul . 84
    Shreya . 44
    ;
    run;
      
    data readin1;
    set readin;
    where Section is missing;
    run;

    chevron_right

    
    

    Output:



    Where Section is missing => This would tell SAS to select missing values for variable SECTION.

  2. IS NOT MISSING Operator: Selecting Non-Missing Values

    Task 2: Suppose you want to select only those observations in which students filled their section information.

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    data readin;
    input name $ Section $ Score;
    cards;
    Raj  A 80
    Atul . 77
    Priya B 45
    Sandeep A 95
    Rahul . 84
    Shreya C 44
    ;
    run;
      
    data readin1;
    set readin;
    where Section is not missing;
    run;

    chevron_right

    
    

    Output:

    Where Section is not missing => This would tell SAS to select non-missing values.

    The NOT operator can be used with WHERE statement in many other ways:

    • where the section is not missing and the score is missing;

    • where not (score in (34, 44, 84));

    • where not (Score between 50 and 90);

    • where NOT(Section EQ “A”);



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.