rxparse question - exact match

  • Follow


I am wondering whether I can get rxparse to give score the text "cat"
within a variable but not other instances of cat contained in that
variable.

AN_IDrx = "`[$#  'cat'  #1]";
rx = rxparse(AB_IDrx);
call rxsubstr(rx, ANIMAL, start, len, Is_animal);
end;

(desired result) is that  is_animal = 1 for the second case ONLY.  I
have many other types of variables that have the same issue and I want
to score of 1 to happen only for the specific substring.

data like so:
ANIMAL
cat house
cat
cats
cat litter
cleaning: cat

0
Reply Webman 2/10/2011 1:12:19 PM

On Feb 10, 2:12=A0pm, Webman <bdweb...@gmail.com> wrote:
> I am wondering whether I can get rxparse to give score the text "cat"
> within a variable but not other instances of cat contained in that
> variable.
>
> AN_IDrx =3D "`[$# =A0'cat' =A0#1]";
> rx =3D rxparse(AB_IDrx);
> call rxsubstr(rx, ANIMAL, start, len, Is_animal);
> end;
>
> (desired result) is that =A0is_animal =3D 1 for the second case ONLY. =A0=
I
> have many other types of variables that have the same issue and I want
> to score of 1 to happen only for the specific substring.
>
> data like so:
> ANIMAL
> cat house
> cat
> cats
> cat litter
> cleaning: cat

Perhaps I am missing something but why don't you forget about using
PRX and just test for upcase(ANIMAL)=3D"CAT"?
0
Reply RolandRB 2/10/2011 2:13:09 PM


Because that is much too simplistic for what I am doing.  I do have
substring within my data, but want to look for a specific instance in
one case only.

On Feb 10, 6:13=A0am, RolandRB <rolandbe...@hotmail.com> wrote:
> On Feb 10, 2:12=A0pm, Webman <bdweb...@gmail.com> wrote:
>
>
> > I am wondering whether I can get rxparse to give score the text "cat"
> > within a variable but not other instances of cat contained in that
> > variable.
>
> > AN_IDrx =3D "`[$# =A0'cat' =A0#1]";
> > rx =3D rxparse(AB_IDrx);
> > call rxsubstr(rx, ANIMAL, start, len, Is_animal);
> > end;
>
> > (desired result) is that =A0is_animal =3D 1 for the second case ONLY. =
=A0I
> > have many other types of variables that have the same issue and I want
> > to score of 1 to happen only for the specific substring.
>
> > data like so:
> > ANIMAL
> > cat house
> > cat
> > cats
> > cat litter
> > cleaning: cat
>
> Perhaps I am missing something but why don't you forget about using
> PRX and just test for upcase(ANIMAL)=3D"CAT"?- Hide quoted text -
>
> - Show quoted text -

0
Reply Webman 2/10/2011 6:56:49 PM

On Feb 10, 10:56=A0am, Webman <bdweb...@gmail.com> wrote:
> Because that is much too simplistic for what I am doing. =A0I do have
> substring within my data, but want to look for a specific instance in
> one case only.
>
> On Feb 10, 6:13=A0am, RolandRB <rolandbe...@hotmail.com> wrote:
>
>
>
> > On Feb 10, 2:12=A0pm, Webman <bdweb...@gmail.com> wrote:
>
> > > I am wondering whether I can get rxparse to give score the text "cat"
> > > within a variable but not other instances of cat contained in that
> > > variable.
>
> > > AN_IDrx =3D "`[$# =A0'cat' =A0#1]";
> > > rx =3D rxparse(AB_IDrx);
> > > call rxsubstr(rx, ANIMAL, start, len, Is_animal);
> > > end;
>
> > > (desired result) is that =A0is_animal =3D 1 for the second case ONLY.=
 =A0I
> > > have many other types of variables that have the same issue and I wan=
t
> > > to score of 1 to happen only for the specific substring.
>
> > > data like so:
> > > ANIMAL
> > > cat house
> > > cat
> > > cats
> > > cat litter
> > > cleaning: cat
>
> > Perhaps I am missing something but why don't you forget about using
> > PRX and just test for upcase(ANIMAL)=3D"CAT"?- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

Can you provide some more examples? The rules don't seem clear to me,
I'd agree with Roland so far, just use upcase(Animal)=3D"CAT".

0
Reply Reeza 2/10/2011 8:22:24 PM

On Feb 10, 7:56=A0pm, Webman <bdweb...@gmail.com> wrote:
> Because that is much too simplistic for what I am doing. =A0I do have
> substring within my data, but want to look for a specific instance in
> one case only.
>
> On Feb 10, 6:13=A0am, RolandRB <rolandbe...@hotmail.com> wrote:
>
>
>
> > On Feb 10, 2:12=A0pm, Webman <bdweb...@gmail.com> wrote:
>
> > > I am wondering whether I can get rxparse to give score the text "cat"
> > > within a variable but not other instances of cat contained in that
> > > variable.
>
> > > AN_IDrx =3D "`[$# =A0'cat' =A0#1]";
> > > rx =3D rxparse(AB_IDrx);
> > > call rxsubstr(rx, ANIMAL, start, len, Is_animal);
> > > end;
>
> > > (desired result) is that =A0is_animal =3D 1 for the second case ONLY.=
 =A0I
> > > have many other types of variables that have the same issue and I wan=
t
> > > to score of 1 to happen only for the specific substring.
>
> > > data like so:
> > > ANIMAL
> > > cat house
> > > cat
> > > cats
> > > cat litter
> > > cleaning: cat
>
> > Perhaps I am missing something but why don't you forget about using
> > PRX and just test for upcase(ANIMAL)=3D"CAT"?- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

What about using the indexw() function in SAS?
0
Reply RolandRB 2/11/2011 2:38:59 PM

Did you try using "cat " and/or " cat" instead of "cat"?  using both
should pick up instances in the beginning or end of a text stream....
0
Reply TKeyes 2/11/2011 5:42:48 PM

5 Replies
233 Views

(page loaded in 0.068 seconds)


Reply: