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;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.