SAS FIND() - 查找两个连续大写字母的位置
SAS FIND() - Finding the position of two consecutive capital letters
在查找字符串中任何大写字母的位置时,鱼尾随前面的 question/answer。虽然我可以用之前提供的答案识别上面的场景:
DATA TEST;
SET SAMPLE;
_endpos= FINDC(TXT,,'u');
ID = substr(TXT,1,_endpos-1);
RUN;
我将如何找到连续两个连续大写字母的条件?不确定如何提供信息来表示此处 'u' 选项的两次连续出现....
DATA TEST;
SET SAMPLE;
_endpos= FINDC(TXT,__,'u');
ID = substr(TXT,1,_endpos-1);
RUN;
或
DATA TEST;
SET SAMPLE;
_endpos= FINDC(TXT, ,'u');
ID = substr(TXT,1,_endpos-1);
RUN;
我修改了分隔符以包含白色 space 和标点符号。
data _2upcase;
input string .;
do c=1 by 1 until(l eq 2 or p eq 0);
call scan(strip(string),c,p,l,,'ldsp');
end;
length _2upcase ;
_2upcase = substrn(string,p,l);
cards;
nndkd11UUndkdLLL
kdnakaliueoina
nnnlllLLLlllLLlll
thisISa2DIgit
this IS silly
this.IS.silly
;;;;
run;
在查找字符串中任何大写字母的位置时,鱼尾随前面的 question/answer。虽然我可以用之前提供的答案识别上面的场景:
DATA TEST;
SET SAMPLE;
_endpos= FINDC(TXT,,'u');
ID = substr(TXT,1,_endpos-1);
RUN;
我将如何找到连续两个连续大写字母的条件?不确定如何提供信息来表示此处 'u' 选项的两次连续出现....
DATA TEST;
SET SAMPLE;
_endpos= FINDC(TXT,__,'u');
ID = substr(TXT,1,_endpos-1);
RUN;
或
DATA TEST;
SET SAMPLE;
_endpos= FINDC(TXT, ,'u');
ID = substr(TXT,1,_endpos-1);
RUN;
我修改了分隔符以包含白色 space 和标点符号。
data _2upcase;
input string .;
do c=1 by 1 until(l eq 2 or p eq 0);
call scan(strip(string),c,p,l,,'ldsp');
end;
length _2upcase ;
_2upcase = substrn(string,p,l);
cards;
nndkd11UUndkdLLL
kdnakaliueoina
nnnlllLLLlllLLlll
thisISa2DIgit
this IS silly
this.IS.silly
;;;;
run;