How one can Take away Rows with Lacking Values in SAS


You’ll be able to usefulness please see modest syntax to take away rows with lacking values from a dataset in SAS:

information new_data;
    eager my_data;
    if cmiss(of _all_) later delete;
run;

This actual instance creates a pristine dataset referred to as new_data the place any rows with lacking values from the untouched dataset referred to as my_data had been deleted.

Please see instance displays easy methods to usefulness this syntax in observe.

Instance: Take away Rows with Lacking Values in SAS

Think now we have please see dataset in SAS that accommodates details about numerous basketball groups:

/*develop dataset*/
information my_data;
    enter crew $ issues assists;
    datalines;
Mavs 113 22
Pacers 95 .
Cavs . .
Lakers 114 20
Warmth 123 39
Kings . 22
Raptors 105 11
Hawks 95 25
Charm 103 26
Spurs 119 .
;
run;

/*view dataset*/
proc print information=my_data;

Realize that there are countless rows with lacking values.

We will be able to usefulness please see code to develop a pristine dataset by which we take away all rows from the present dataset that experience lacking values in any column:

/*develop pristine dataset that eliminates rows with lacking values from present dataset*/
information new_data;
    eager my_data;
    if cmiss(of _all_) later delete;
run;

/*view pristine dataset*/
proc print information=new_data;

We will be able to see that every one rows with lacking values had been got rid of from the dataset.

Word #1: The argument _all_ inside the CMISS serve as specifies that SAS will have to search for lacking values inĀ all columns for each and every row.

Word #2: You’ll be able to in finding all the documentation for the CMISS serve as right here.

Backup Sources

Please see tutorials give an explanation for easy methods to carry out alternative familiar duties in SAS:

How one can Take away Duplicates in SAS
How one can Depend Lacking Values in SAS
How one can Exchange Lacking Values with 0 in SAS

Leave a Comment