Hi,
I would like to make an if condition like if PRXMATCH(..., var1)>0 then delete. I would like to remove all cases in which I have:
Thanks in advance!
Do you want to delete the observations where any of those three strings occur or do you want to delete the 'dd' part of the posted strings?
Like this?
data have;
input string $20.;
datalines;
abc0,00ddabc
abcabc
defdef
abcdef454dd
0,234ddabcdef
;
data want;
set have;
if not prxmatch('/0,00dd|454dd|0,234dd/', string);
run;
What if I have different numbers before dd? I wrote these numbers with dd only like an example. I want remove all cases in which dd is after numbers.
Ah ok. Do this. This looks for patterns where the string 'dd' is after at least 1 digit.
data have;
input string $20.;
datalines;
abc0,00ddabc
abcabc
defdef
abcdef454dd
0,234ddabcdef
;
data want;
set have;
if not prxmatch('/\d+dd/', string);
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.