Generally, when we import data from external sources such as Excel/CSV files, it loads additional rows that are totally blank. Sometimes empty values in the database also affect the desired output so it’s necessary to check missing cases and perform operations accordingly
Input: The sample dataset looks like below have four variables – 1 character and 3 numeric. It would be used further in the example to demonstrate how to remove empty rows.
Create a SAS dataset
The below defined code is a sample dataset to perform delete empty operation.
- Method I: Removes complete row where all variables having blank/missing values
OPTIONS missing =
- The MISSING= system option is used to display the missing values as a single space rather than as the default period (.) options missing = ‘ ‘;
- The CATS function concatenates the values. It also removes leading and trailing blanks. cats(of _all_) – Concatenate all the variables
- missing(cats(of _all_)) – Identifies all the rows in which missing values exist in all the variables.
- Method II: Removes only that rows where any of the variable has missing/blank values
_numeric_) > 0
In this case, we are using the OR operator to check if any of the variables have missing values. It returns 4 observations. Check out the output below –
- Difference between Increment and Decrement Operators
- Problem in comparing Floating point numbers and how to compare them correctly?
- Control Structures in Programming Languages
- I Can't Use Logic In Programming. What Should I Do?
- 7 Tips To Write Clean And Better Code in 2020
- I Can’t Do Computer Programming – 7 Common Myths You Must Know
- Find all the possible remainders when N is divided by all positive integers from 1 to N+1
- Hello World Program : First program while learning Programming
- Difference between Functional Programming and Object Oriented Programming
- Program to implement Logic Gates
- Which Programming Language Should I Choose as a Beginner?
- Arrow operator -> in C/C++ with Examples
- 12 Reasons Why You Should Learn Python in 2019
- 5 Most Difficult Programming Languages of the World
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.