Hi,
I am looking here to get any Digit is continuously repeated more than 6 times from Security_No.
Sl_No | Security_No |
1 | 111111111112 |
2 | 989898989898 |
3 | 111111111111 |
4 | 910000000000 |
5 | 999999999990 |
6 | 128390203040 |
7 | 127777777771 |
8 | 739349340595 |
9 | 634995038404 |
Thanks in Advance....!
data have;
input Sl_No Security_No : $20.;
cards;
1 111111111112
2 989898989898
3 111111111111
4 910000000000
5 999999999990
6 128390203040
7 127777777771
8 739349340595
9 634995038404
;
run;
data want;
set have;
if prxmatch('/0{6,}|1{6,}|2{6,}|3{6,}|4{6,}|5{6,}|6{6,}|7{6,}|8{6,}|9{6,}/o',Security_No);
run;
Xia Keshan
data have;
input Sl_No Security_No : $20.;
cards;
1 111111111112
2 989898989898
3 111111111111
4 910000000000
5 999999999990
6 128390203040
7 127777777771
8 739349340595
9 634995038404
;
run;
data want;
set have;
if prxmatch('/0{6,}|1{6,}|2{6,}|3{6,}|4{6,}|5{6,}|6{6,}|7{6,}|8{6,}|9{6,}/o',Security_No);
run;
Xia Keshan
Here is an alternative to using regular expression.
data foo;
input Sl_No Security_No : $12.;
do rept_int=0 to 9 while (_n_>0);
if find(Security_No, repeat(put(rept_int,1.),5)) then do;
_n_=0;
output;
end;
end;
cards;
1 111111111112
2 989898989898
3 111111111111
4 910000000000
5 999999999990
6 128390203040
7 127777777771
8 739349340595
9 634995038404
;
run;
Thank you...!
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.