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 (August 2009, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 25 Aug 2009 14:49:56 -0400
Reply-To:     Mike Rhoads <RHOADSM1@WESTAT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Mike Rhoads <RHOADSM1@WESTAT.COM>
Subject:      Re: What's wron with this Code in SQL?
In-Reply-To:  <67f588aa0908251110m540db548s61a591f017415474@mail.gmail.com>
Content-Type: text/plain; charset="us-ascii"

I'm not sure about the "calculated", but I don't think you can use the a <= b <= c construct as a shortcut in SQL the way you can in the DATA step.

So, try

case when calculated ExpenLess <=Expenses AND Expenses <= ExpenMoor (adding extra instances of CALCULATED if necessary)

or use the BETWEEN operator instead.

Mike Rhoads RhoadsM1@Westat.com

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Akshaya Sent: Tuesday, August 25, 2009 2:11 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: What's wron with this Code in SQL?

Calculated keyword has to be used for all the values calculated within the query, when they are used in other parts of the same query.

when calculated ExpenLess <= calculated Expenses <= calculated ExpenMoor then

AkshayA!

On Tue, Aug 25, 2009 at 2:01 PM, Elmaache, Hamani < Hamani.Elmaache1@cra-arc.gc.ca> wrote:

> Hi there, > Please, can anybody help, > For the below code, I get the following ERRORs: > > ERROR: Expression using less than or equal (<=) has components that > are of different data types. > ERROR: The following columns were not found in the contributing > tables: ExpenMoor, Expenses. > > > /********************************************************************* > ** > */ > proc SQL; > select L8521 ,L8690, L8710, L8960 ,L8871 ,L9281, L8810 ,L8860 , > L9180, L9060, L9200, L9220, L9270, L9949, > sum(L9949 -100) as ExpenLess, > sum(L9949 +100) as ExpenMoor, > sum(L8521 ,L8690, L8710, L8960 ,L8871 ,L9281, L8810 ,L8860 , > L9180, L9060, L9200, L9220, L9270) as Expenses, > case when calculated ExpenLess <=Expenses <= ExpenMoor then > 'Good_exp' > else 'Bad_exp' > end > from STC.Stc_test > group by BUSINESS_TYPE; >


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