简体   繁体   English

SAS EG字符功能

[英]SAS EG Character Functions

I have two tables containing characters: 我有两个包含字符的表:

      First_Column            Second Column
          aaa                   123aaa123
          bbb                   cdsbbbsxd
          ccc                   098fdsccd

I want to label 1 if Second Column string contains the string in the first column otherwise I would like put 0. 如果第二列字符串包含第一列中的字符串,我想将其标记为1,否则我想输入0。

I could not find a way to do that in SAS EG? 我找不到在SAS EG中做到这一点的方法吗? Is there any function to do this? 有什么功能可以做到这一点吗?

Thanks 谢谢

You can use functions like find , index or count . 您可以使用诸如findindexcount

count('Second Column'n, First_Column)

index('Second Column'n, First_Column)

find('Second Column'n, First_Column)

In Query Builder you have to add new column with an expression like below: 在查询生成器中,您必须使用以下表达式添加新列:

case(count('Second Column'n, First_Column))
  when(0) then 0
  else 1
end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM