SAS中文论坛

标题: 请问where b=*'smi'的筛选规则,谢谢 [打印本页]

作者: shiyiming    时间: 2008-10-27 17:25
标题: 请问where b=*'smi'的筛选规则,谢谢
data table1;
    infile datalines;
    input a b $;
datalines;
2000 smitha
3000 asmith
200 smith
1000 smita
4000 asmithb
;
run;


data table2;
    set table1;
        where b=*'smi';
run;
作者: shiyiming    时间: 2008-10-27 18:28
标题: Re: 请问where b=*'smi'的筛选规则,谢谢
Sounds-like Operator
The sounds-like ( =*) operator selects observations that contain a spelling variation of a specified word or words. The operator uses the Soundex algorithm to compare the variable value and the operand. For more information, see the SOUNDEX function in SAS Language Reference: Dictionary.

Note:   Note that the SOUNDEX algorithm is English-biased, and is less useful for languages other than English.  

Although the sounds-like operator is useful, it does not always select all possible values. For example, consider that you want to select observations from the following list of names that sound like Smith:

Schmitt

Smith

Smithson

Smitt

Smythe


The following WHERE expression selects all the names from this list except Schmitt and Smithson:

where lastname=* 'Smith';

You can combine the NOT logical operator with the sounds-like operator to select values that do not contain a spelling variation of a specified word or words, such as:

where lastname not =* 'Smith';

Note:   The sounds-like operator cannot be optimized with an index.




欢迎光临 SAS中文论坛 (https://mysas.net/forum/) Powered by Discuz! X3.2