BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Sandeep77
Lapis Lazuli | Level 10

Hi all,

I have a dataset which has missing address information. I want to remove all the accounts which are missing the address column. Can you please suggest the best way to do it?

I want the output data to remove all the ACCNO where the ADD1, ADD2, ADD3, ADD4 and PCODE are missing. So in this case from the below table only two rows should be available which has the address information.

Here is a sample dataset.

Data Blank_rows;
infile cards expandtabs;
input ACCNO TITLE $ FORENAME $ SURNAME $ ADD1 $ ADD2 $ ADD3 $ ADD4 $ PCODE;
datalines ;
2056673 Mr Michael Davis 5StationRoad . HOLSWORTHY Devon 24
2054394 Mrs TarisaM Karo . . . . .
2060648 Mr Jonathan Cannell . . . . .
2072589 Mr Chris Stirk 119HighthornRoad York . . 2456
2063169 Mr Barry Rudd . . . . .
2061769 Mr Jonathan Park . . . . .
2061126 Mr Craig McClurrey . . . . .
;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
yabwon
Onyx | Level 15
data want;
  set Blank_rows;
  where not (cmiss(ADD1,ADD2,ADD3,ADD4,PCODE)=5);
run;
_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



View solution in original post

1 REPLY 1
yabwon
Onyx | Level 15
data want;
  set Blank_rows;
  where not (cmiss(ADD1,ADD2,ADD3,ADD4,PCODE)=5);
run;
_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1 reply
  • 346 views
  • 1 like
  • 2 in conversation