Hello, I want to determine whether CHAR2 variable is included in CHAR1 variable. If CHAR2's inputs are all included in CHAR1, then want variable has a value of 1. Otherwise, it has a value of 0. The data and the desired results are as follows: Data: Obs CHAR1 CHAR2 1 A001940, A007280 . 2 A001940, A007280 . 3 A001940, A007280 A001940, A007280 4 A001940 A001940, A007280 5 A001940, A007280 A001940 6 A001940, A007280 A001940 7 A001940, A007280 A001940, A007280 8 A001940, A007280 A001940, A007280 9 A001940, A007280, A104700 A001940, A007280 10 A001940, A007280, A104700 A001940, A007280 11 A001940, A007280, A104700 A001940, A007280 12 A001940, A007280, A012160, A104700 A001940, A007280, A104700 13 A001940, A007280, A012160, A104700 A001940, A007280, A104700 14 A001940, A007280, A012160, A104700 A001940, A007280, A012160, A104700 15 A001940, A007280, A012160, A104700 A001940, A007280, A012160, A104700 16 A001940, A012160, A104700 A001940, A007280, A012160, A104700 17 A001940, A012160, A104700 A001940, A007280, A012160, A104700 Desired result: Obs CHAR1 CHAR2 want 1 A001940, A007280 . 0 2 A001940, A007280 . 0 3 A001940, A007280 A001940, A007280 1 4 A001940 A001940, A007280 0 5 A001940, A007280 A001940 1 6 A001940, A007280 A001940 1 7 A001940, A007280 A001940, A007280 1 8 A001940, A007280 A001940, A007280 1 9 A001940, A007280, A104700 A001940, A007280 1 10 A001940, A007280, A104700 A001940, A007280 1 11 A001940, A007280, A104700 A001940, A007280 1 12 A001940, A007280, A012160, A104700 A001940, A007280, A104700 1 13 A001940, A007280, A012160, A104700 A001940, A007280, A104700 1 14 A001940, A007280, A012160, A104700 A001940, A007280, A012160, A104700 1 15 A001940, A007280, A012160, A104700 A001940, A007280, A012160, A104700 1 16 A001940, A012160, A104700 A001940, A007280, A012160, A104700 0 17 A001940, A012160, A104700 A001940, A007280, A012160, A104700 0 I tried the following solution, but it doesn't apply because the order of input is different. Want = (indexw(CHAR1,CHAR2,', ')>0); If you know the solution, please help me.
... View more