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 (October 2007, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sun, 28 Oct 2007 14:13:33 -0500
Reply-To:     OR Stats <stats112@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         OR Stats <stats112@GMAIL.COM>
Subject:      Inverse of %SCAN for numeric position
Content-Type: text/plain; charset=ISO-8859-1

Hi Everyone, Does SAS have a macro function that is the inverse of its %SCAN function? The purpose is the following:

The user of my macro would input his text. I would match the text with an element in my array and return the position within the array. So that given my array is declared as

%let Array = Jack Jill Bob Anne;

When the end-user inputs any one of the four names in my macro function, I would like to have 1 returned if he typed in Jack; 2 if he typed Jill and so forth. So while using SAS's %SCAN function, given the position, and the function returns the name. I would like to have that function inversed so that given the name, a SAS function returns the position of the element within the array that matches the name. Does SAS have this function?

Thank you!


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