Hi experts,
I have a challenge situation here. I would like to looking for a text with 'Health Center' in one of my variables. However, it comes with different formats and different places. I am curious, if there is a way to find them. Thanks!
For example,
1. Health Center
2. health center
3. Health center
4. Health State Center
5. State health center
6. Health Department Center
7. Department health center
I would assume you wanna match text that basically should have both words.
How about
where findw(test,'health',' ','i') and findw(test,'center',' ','i');
/*or making sure health precedes center*/
where findw(test,'center',' ','i')>findw(test,'health',' ','i');
Do you mean this?
data have;
input test $40.;
cards;
1. Health Center
2. health center
3. Health center
4. Health State Center
5. State health center
6. Health Department Center
7. Department health center
;
data want;
set have;
where findw(test,'health center',' ','i');
run;
No, I would like to find all the seven answers even though there are one word in-between 'Health Center' or in front of it.
I would assume you wanna match text that basically should have both words.
How about
where findw(test,'health',' ','i') and findw(test,'center',' ','i');
/*or making sure health precedes center*/
where findw(test,'center',' ','i')>findw(test,'health',' ','i');
Thanks, that's what I want!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.