LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (March 2002, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 1 Mar 2002 10:17:28 -0500
Reply-To:   Robert Virgile <virgile@MEDIAONE.NET>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Robert Virgile <virgile@MEDIAONE.NET>
Subject:   Re: scanning
Comments:   To: "Fehd, Ronald J." <rjf2@CDC.GOV>
Content-Type:   text/plain; charset="iso-8859-1"

Just be careful with the index function ... it looks for a string, not a word. Thus if the original text contained the word LOCOMOTION, the index function would locate the string MOTION. I think there is also an indexw function which locates words, but you'd need to check it out and see how it handles punctuation.

Good luck.

Bob V.

-----Original Message----- From: Fehd, Ronald J. <rjf2@CDC.GOV> Newsgroups: bit.listserv.sas-l To: SAS-L@LISTSERV.UGA.EDU <SAS-L@LISTSERV.UGA.EDU> Date: Friday, March 01, 2002 9:48 AM Subject: Re: scanning

>> From: Shannon [mailto:swheatma@FJC.GOV] >> Is there anyway to scan the first 10 words of the example below and >> flag whether certain words appear (i.e. motion, appeal, defendant - >> I'd want a flag variable for each): >> >> NOTICE OF APPEAL, defendant filed a motion in >> court to appeal . . . > >input Line $char80.; >Line = upcase(Line);%* or downcase, whichever you prefer to test for; >Motion = index(Line,'MOTION');%*returns integer in 1:~72; >Motion = index(Line,'MOTION') gt 0;%*returns boolean integer in 0,1; > >... etc. > >Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov >OpSys: Win_Pro Ver: 8.2 >--> cheerful provider of UNTESTED SAS code from the Clue?Gee!Wrx <--


Back to: Top of message | Previous page | Main SAS-L page