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 (December 2004, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 6 Dec 2004 22:53:11 -0500
Reply-To:     "Chang Y. Chung" <chang_y_chung@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Chang Y. Chung" <chang_y_chung@HOTMAIL.COM>
Subject:      Re: Selecting on character string characteristics
Comments: To: Laughing Beggar <laughing_beggar@HOTMAIL.COM>

On Tue, 7 Dec 2004 03:10:50 +0000, Laughing Beggar <laughing_beggar@HOTMAIL.COM> wrote:

>Hi all, >Having finally discovered the colon will let me find character variable >strings that start a certain way (eg (icd10d1 = :'M85.1') finds me all the >values that start with M85.1) I now have to limit this to character strings >that do not contain a forward slash (/). How do I do this ? or where can I >find some documentation on selecting by character string characteristics ? >Thanks

Hi, Laughing Beggar,

That is easy. just use index() function -- if not found, then it will return 0, which is false when evaluated in the logical context, like below.

Is the Beggar laughing? :-)

Cheers, Chang

/* test data */ data one; v = "M85.1 "; output; v = "M85.1/M85.2"; output; v = "M85.2 "; output; run;

/* select only those that start with M85.1 but having no slash character */ data two; set one; where v =: "M85.1" and not index(v,"/") ; run; /* check */ proc print data=two; run; /* on lst Obs v 1 M85.1 */

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