Date: Wed, 19 Jul 2006 05:55:53 -0700
Reply-To: Guillermo Ramos <g.ramos.alvarez@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Guillermo Ramos <g.ramos.alvarez@GMAIL.COM>
Organization: http://groups.google.com
Subject: Re: case statements with else as null
In-Reply-To: <1153307495.517229.74170@i42g2000cwa.googlegroups.com>
Content-Type: text/plain; charset="iso-8859-1"
Andeww -
it depends on what type "Transactors" is:
- a number: then use "else . end as transactors"
- a string : then use "else '' end as transactors"
Regards
Andreww wrote:
> Hi - I have the following code in SQL which I am trying to convert to
> SAS sql in proc sql:
>
>
> select
> COUNT(DISTINCT
> (CASE WHEN (tran_date BETWEEN '01-MAY-2005' AND
> '01-MAY-2006')
> THEN customer_number
> ELSE null
> END)) AS transactors
> from tblCustomer
>
>
> the idea is that a distinct count is produced when the transaction date
> is between the two dates.
>
> The piece of code I am trying to translate to SAS is the "ELSE null" -
> what do I put instead of null. doing "else missing" doesn't work.
>
> Incidentally if I comment out the "else null" the log file says values
> translated to missing which is what I want.
>
> Thanks
>
> Andrew
|