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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.