跳到内容

SAS/字符串函数

来自 Wikibooks,面向开放世界的开放书籍
< SAS

spedis 函数可计算两个字符串之间的距离。这是一个示例 

options nodate pageno=1 linesize=64;
data words;
   input Operation $ Query $ Keyword $;
   Distance = spedis(query,keyword);
   Cost = distance * length(query);
   datalines;
match       fuzzy        fuzzy
singlet     fuzy         fuzzy
doublet     fuuzzy       fuzzy
swap        fzuzy        fuzzy
truncate    fuzz         fuzzy
append      fuzzys       fuzzy
delete      fzzy         fuzzy
insert      fluzzy       fuzzy
replace     fizzy        fuzzy
firstdel    uzzy         fuzzy
firstins    pfuzzy       fuzzy
firstrep    wuzzy        fuzzy
several     floozy       fuzzy
;
proc print data = words; run;
华夏公益教科书