Hello, i try to know if specific words are within text. i use function findw.
the problem is that i defined words inside array and when i run the function findw(text,word(i)) i didn't get answer, but when i write specific words by myself, i get right answer. for example findw(text,'sea').
data for example is :
text word1 word2 word3
the car is beautiful best car
blue sea sea blue exist
i saw that length,format and informat of array word is length 8, maybe this is problem? Whta i should do?
my program look like :
data test;
set text;
array word (3) $ word1-word3;
array exist_ind (3);
do i=1 to 3;
ind(i)=findw(text,word(i));
end;
run;
Hello,
use the strip function to eliminate blanks from word{*} variables.
data want;
set have;
array word (3) $ word1-word3;
array exist_ind (3);
do i=1 to 3;
exist_ind(i)=findw(text,strip(word(i)));
put _all_;
end;
run;
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.