Date: Thu, 18 Nov 2004 08:51:53 -0500
Reply-To: "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Subject: Re: LIKE statement as a regular SAS expression???
> I am generating an HTML table using put statement. I would like to
> output the link only where prod_code is like C for everything else I
> don't want to put the link out.
> If prod_code like 'C%' then
> put @134 '<TD WIDTH="235" ALIGN="CENTER"><FONT FACE="Arial"
> SIZE="2"> <A HREF='my_link'
> TARGET="_top">Click Here</A></FONT></TD>';
> but it is complaining about like. Like can only be used with where
> statement. Can you please put me in the right direction??
In this case your matching is very simple, so other string operators and
functions will work
if prod_code =: 'C' ...
if index (prod_code,"C") = 1 ...
if substr(prod_code,1,1) = 'C' ...
... a couple other ways ...
For general pattern matching using regular expressions you would want to use
RX or PRX function.
Richard A. DeVenezia