Date: Tue, 25 Nov 2008 09:27:16 -0500
Reply-To: Akshaya Nathilvar <akshaya.nathilvar@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Akshaya Nathilvar <akshaya.nathilvar@GMAIL.COM>
Subject: Re: use of the coalesce() function
In-Reply-To: <bfb90334-8dc3-4136-8605-f9c67de1e81d@z1g2000yqn.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
How about using IFN function along with COALESCE function.
datetime=dhms(date,0,0,coalesce(ifn(time>0,time,0),0));
Akshaya
On Tue, Nov 25, 2008 at 9:12 AM, RolandRB <rolandberry@hotmail.com> wrote:
> I'd never heard of the coalesce() function before today. It returns
> the first non-missing value from a list of arguments. I wanted to
> create a datetime value from a date and a time. The time might be
> missing or in rare cases negative but must be used if non-missing. If
> missing then 0 should be used.
>
> datetime=dhms(date,0,0,coalesce(time,0));
>
|