SAS : Delete empty rows in SAS

Suppose you want to delete empty rows in SAS.

Dataset
NameScore1Score2Score3
Sam776866
Deepanshu50
89




Shane557889
Roger509786




Priya886893

Create a SAS dataset
Run the following syntax


Notes :
1. The MISSING= system option is used to display the missing values as a single space rather than as the default period (.) options missing = ' ';

2. The CATS function concatenates the values. It also removes leading and trailing blanks. cats(of _all_) - Concatenate all the variables

3.   missing(cats(of _all_)) - Identifies all the rows in which missing values exist 
for all the variables.
Output


SAS Tutorials : 100 Free SAS Tutorials

Get Free Email Updates :
*Please confirm your email address by clicking on the link sent to your Email*

Related Posts:

3 Responses to "SAS : Delete empty rows in SAS"

  1. Because Name is your 'key', your code could be written more succinctly as:
    data readin;
    set outdata;
    where not missing( Name);
    run;

    But, if you got records with a Name, but no Scores, you could write it as:
    data readin;
    set outdata;
    where n( of Score1-Score3) > 0 ;
    run;

    Cheers, :)

    ReplyDelete
  2. But if i want to delete rows only when missing values exist in all the variables ;)

    ReplyDelete
  3. Anytime you change the Options, please do take care to change it back so that later code doesn't change its behavior.

    ReplyDelete

Next → ← Prev