Date: Tue, 25 Aug 2009 15:11:52 -0400
Reply-To: Akshaya <akshaya.nathilvar@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Akshaya <akshaya.nathilvar@GMAIL.COM>
Subject: Re: What's wrong with this Code in SQL?
In-Reply-To: <3EAEB2472FF19C44AE21EA709D0E9464018BF948@SD01ITMV21.PROD.NET>
Content-Type: text/plain; charset=ISO-8859-1
case
when calculated ExpenLess <= calculated Expenses <= calculated
ExpenMoor then 'Good_exp'
else 'Bad_exp'
end as flag
Please refer to this
paper<http://www.nesug.org/Proceedings/nesug97/posters/zhang.pdf>for
further help.
AkshayA!
On Tue, Aug 25, 2009 at 3:05 PM, Elmaache, Hamani <
Hamani.Elmaache1@cra-arc.gc.ca> wrote:
> 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;
>
>
>
|