简体   繁体   中英

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.

I could not find a way to do that in SAS EG? Is there any function to do this?

Thanks

You can use functions like find , index or count .

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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