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;
data want;
set Blank_rows;
where not (cmiss(ADD1,ADD2,ADD3,ADD4,PCODE)=5);
run;
data want;
set Blank_rows;
where not (cmiss(ADD1,ADD2,ADD3,ADD4,PCODE)=5);
run;
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.
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.
Ready to level-up your skills? Choose your own adventure.