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
Amethyst | Level 16
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
Amethyst | Level 16
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



hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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