BookmarkSubscribeRSS Feed
slivingston
Calcite | Level 5

Hi all!

I have a simple problem and  I know it will be a simple answer however after alot of searching all day, I still do not have the answer. I have a dataset with 6 variables and 2 variables contain null values (var5 and var6). I would like to filter out the null values for each variable (var5 and var6), and if there is a null value for the row, then the row is deleted.

For example.

ID           var1          var2          var3          var4          var5            var6

1001       23            Yes          560            22             No

1002                                                        54            No             6

1003       42            No            652            33

1004                                                        60            Yes

1005       32            YES                                                           5

Final would look like this

ID           var1          var2          var3          var4          var5            var6

1002                                                        54            No             6

^Only left due to having complete values for Var5 and Var 6.

Thanks in adance!

2 REPLIES 2
Murray_Court
Quartz | Level 8

The delete statement can be used conditionally.

data want;

set have;

if var5="" /*null value for character variable */

OR

var6=. /*null value for numeric variable */

then delete;

run;

Patrick
Opal | Level 21

IF cmiss(var5,var6) ne 0 then delete;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1400 views
  • 0 likes
  • 3 in conversation