Skip to content
Related Articles

Related Articles

Improve Article

IS MISSING and IS NOT MISSING Operators in SAS Programming

  • Last Updated : 23 Jul, 2019
  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.




    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;

    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.






    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;

    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
Recommended Articles
Page :