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 (June 2001, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 8 Jun 2001 11:37:31 -0500
Reply-To:     "Gregg P. Snell" <gsnell@datasavantconsulting.com>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Gregg P. Snell" <gsnell@DATASAVANTCONSULTING.COM>
Organization: Data Savant Consulting
Subject:      Re: searching for a character in a character field
Comments: To: melanie.barish@clinarc.com
Content-Type: text/plain; charset="iso-8859-1"

Melanie,

Here is just one example that will count the names, though it assumes the field always has at least one name.

data _null_; drug1='one/two/three'; names=length(trim(drug1))-length(compress(trim(drug1),'/'))+1; put names=; run;

I have no idea what your fields might contain if not names, so you will definitely have to tweak this to your own data. But it should give you something to start with...

Gregg P. Snell Data Savant Consulting (913) 638-4640 (208) 977-1943 fax http://www.datasavantconsulting.com

Co-chair of MWSUG 2001 http://www.mwsug.org/mw_2001/index.htm

Melanie Barish <melanie.barish@CLINARC.COM> wrote in message news:5240538BEE29D411A7F100902778790C7D4A18@MUDSKIPPER... > Hello SAS-L, > > I need to search 6 fields (drug1 - drug6) to identify how many of the 6 > actually have a name in them. However, some have more than one name, > seperated by a slash. Is there a SAS function that I can use to count how > many times in a given field that the slash appears? I looked up INDEX and > SCAN, but they both appear to only return the location of the slash, not how > many times it is found. Any suggestions would be greatly > appreciated...thank you in advance for your help. > > Regards, > > Melanie > > > Melanie J. Barish > Clinical Data Manager > ClinArc > 212-698-1561 > > > >


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