今天在网上看到这样一段话:
The following examples select observations having the values
Mobay and
Brisbayne for the variable COMPANY, but they do
NOT select observations containing
Bayview:
where company contains 'bay';
where company ? 'bay';
那么如果我想把bayview这种以及任意位置有‘bay’的全部筛选出来该如何操作呢?先行谢过!
感谢一楼,我忽略了Bay是大写的B,因此这里是说由于大小写的原因筛选不出来。
另外补一个刚看到的小方法,能够避免这种问题。由于对于文本的筛选都是区分大小写的,所以可以通过统一把单词转换为大写来消除这个问题。以下面code中sashelp.deskact文件为例:
desc1 = upcase(desc)
这样desc里的文字就都是大写了!
data exercise;
set sashelp.deskact;
desc1= upcase(desc)
where desc1 contains 'Ru';
run;
这样是出不来的(
求教到底为什么?)。。。我目前只会:
data exercise;
set sashelp.deskact;
desc1= upcase(desc)
run;
data exercise;
set exercise;
where desc1 contains 'Ru';
run;
=========================
但是我刚才自己试了一下:
data exercise;
set sashelp.deskact;
where desc contains 'Ru';
run;
然后desc这个变量下叫“Run”的就都顺利筛选出来了,难道是SAS版本变化升级就可以了,我用的9.4。