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 (May 2012, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sat, 12 May 2012 09:16:45 -0400
Reply-To:     Peter Timusk <petertimusk@PROGRAMDOCUMENTATION.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Peter Timusk <petertimusk@PROGRAMDOCUMENTATION.COM>
Subject:      Perl match question. Using prxmatch to complete an if contains
              statement.
Comments: To: at571@ncf.ca
Content-Type: text/plain; charset=us-ascii

Hello all

I was this morning hoping to do this

If x_char contains 'y' then var =1;

Apparently I can not use "contains" in an if statement.

So I use this

If substr(x_char, prxmatch(x_char,'y'), 1) = 'y' then var=1;

My question is what does the prxmatch function return for a position number, if it does not find the string you asked it to find? In other words will my if statement cough up too many errors when observations of x_char do not contain a 'y' character?

Peter Timusk


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