Date: Mon, 20 Jul 2009 12:51:11 -0400
Reply-To: SUBSCRIBE SAS-L samark <samarkjones@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: SUBSCRIBE SAS-L samark <samarkjones@GMAIL.COM>
Subject: finding any one substring in a string
I was hoping someone could help me out. Is there a compact way to write the
if find(name,'hourly','i') then y=1;
else if find(name,'salarly','i') then y=1;
I am assigning the same value to y when I find either the substring 'hourly'
OR 'salary' in the string given by the character variable
name.Unfortunately, the find function only allows u to check for one
substring at a time.
Essentially, i would like the code to do something like this (the code is
completely wrong, of course)
if find(name,'hourly' OR 'salarly','i') then y=1;
I am working on a SAS code that assigns different values to a variable
depending onwheter a substring exists in another variable. There are many
substrings and alot of themassign the same value to the second variable. i
wanted to know wheter multipleif-then-elseif statements is only way to solve
this problem ..and i am using version 9.1
Thanks so much !!