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.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.