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.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: