Hi ,
I need to filter out data in the "ZIP" column of a data set. It has few values which start with a character variable (A-Z). How can I filter them in a dataset of 1000000 rows. Column "ZIP" is a categorical variable.
I did try this approach but there seems something to be wrong :
proc sql;
delete * from dataset where zip = '^[A-Z]';
quit;
The log says no rows are selected. Please advice !
Thanks ,
Minal
proc sql;
select *
from have
where anayalpha(ZIP);
quit;
Thanks for the reply. But on running the code I get the following error :
23 proc sql;
24 select *
25 from project.a1
26 where anayalpha(ZIP);
ERROR: Function ANAYALPHA could not be located.
But anyways I tried running this :
proc sql;
select * from project.a1 where prxmatch('/^[A-Z]/', zip);
quit;
and it worked.
Thanks,
Minal
Typo in word anyalpha:
where anyalpha(ZIP);
it should be
if anyalpha(zip)=1;
1 is for if zip starts with character value.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.