@Aldo_Leal:
This piece of code returns CURED=1 if the customer is cured and CURED=0 otherwise:
data _null_ ;
input hist_payment $24. ;
cured = findc (hist_payment, "012", "k") > 12 ;
put hist_payment cured= ;
cards ;
210120102010508172635401
012212201220908172635401
123456789012345678901234
120120070220123456789012
;
run ;
This will print in the log:
210120102010508172635401 cured=1
012212201220908172635401 cured=1
123456789012345678901234 cured=0
120120070220123456789012 cured=0
Alternatively, the expression for CURED can be coded as:
cured = findc (hist_payment, "3456789") > 12 ;
Though the most concise and perhaps the cleanest is using the VERIFY function, as suggested by @Patrick:
cured = verify (hist_payment, "012") > 12 ;
Of course, in this context VERIFY is equivalent to FINDC with the K modifier (minus the cornucopia of the bells and whistles of the latter). For some odd reason, I have always found VERIFY kind of counter-intuitive - perhaps due to its negative logic "find the first position of any character NOT present in the specified list". Logically, the same is true for FINDC with the K modifier; and yet, it feels less counter-intuitive to me - maybe because in this case that same NOT (in the form of the K modifier) must be specified explicitly, while with VERIFY it is implicit.
Kind regards
Paul D.
... View more