Date: Tue, 25 Aug 2009 15:05:42 -0400
Reply-To: "Elmaache, Hamani" <Hamani.Elmaache1@CRA-ARC.GC.CA>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Elmaache, Hamani" <Hamani.Elmaache1@CRA-ARC.GC.CA>
Subject: Re: What's wrong with this Code in SQL?
In-Reply-To: <67f588aa0908251110m540db548s61a591f017415474@mail.gmail.com>
Content-Type: text/plain; charset="us-ascii"
Thanks. Your help is useful,
One other question: How to set variable name for The Flag:
case when calculated ExpenLess <= calculated Expenses <= calculated
ExpenMoor then Flag='Good_exp'
else Flag='Bad_exp'
________________________________
From: Akshaya [mailto:akshaya.nathilvar@gmail.com]
Sent: August 25, 2009 14:11
To: Elmaache, Hamani
Cc: 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;
|