Date: Mon, 26 Sep 2011 21:01:34 +0000
Reply-To: "DUELL, BOB" <bd9439@ATT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "DUELL, BOB" <bd9439@ATT.COM>
Subject: Re: Need help with "translating" SAS into Teadata SQL
In-Reply-To: <201109261830.p8QFHvaW020624@waikiki.cc.uga.edu>
Content-Type: text/plain; charset="us-ascii"
Use a CASE expression; for example:
select case when ID = X or ID = Y or ID = Z
then substr(city,1,9)
else city end as city
, case when ID = X or ID = Y or ID = Z
then substr(state,1,2)
else state end as state
, case when ID = X or ID = Y or ID = Z
then substr(site,1,8)
else site end as site
from (
select 1 as ID
, 1 as X
, 3 as Y
, 3 as Z
, 'Bellingham Heights' as city
, 'Washinton' as state
, 'At some site' as site
) xxx
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Lessia Shajenko
Sent: Monday, September 26, 2011 11:31 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Need help with "translating" SAS into Teadata SQL
Hello,
I need to "translate" the following SAS into Teradata SQL:
if ID in ( x, y, z )
then do ;
city = substr ( city , 1, 9) ;
state = substr ( state, 1, 2) ;
site = substr ( site , 1, 8) ;
end ;
Thanks!--
Lessia
|