Date: Mon, 28 Jun 2004 23:14:13 -0400
Reply-To: Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Subject: Re: SAS Date Interval
Another unknown: Is Rick using the term "format" in its technical sense? Is
ACTDATE a numeric expressing the number of days since 1 Jan. 1960, with a
MMDDYY. format associated? Or is he (like so many others) using "format"
casually? In that case ACTDATE might be a character variable with values
like six, slash, one, slash ...
In either case there are solutions, but they are different.
On Mon, 28 Jun 2004 20:20:39 -0500, Jack Hamilton
<JackHamilton@FIRSTHEALTH.COM> wrote:
>The format for a SAS date constant is
>
> 'nnmonyyyy'd
>
>for example
>
> begdate='30jun2003'd
>
>or
>
> if '01jun2003'd <= actdate <= '30jun2003'd;
>
>When you coded
>
> if 6/1/2003<=actdate<=6/30/2003;
>
>SAS calculated the values of 6/1/2003 (6 divided by 1 divided by 2003)
>and 6 divided by 1 divided by 30. Both of those values are fractions
>between 0 and 1, and a SAS date value is always an integer, so the test
>always returns false.
>
>When asking questions on SAS-L, it is helpful to let us know why you
>think your code didn't work. Error messages? Incorrect results? In
>your examples below, it was problem one of each, but since you didn't
>include your job log we don't know whether the code in your message is
>the code you actually ran.
>
>
>
>
>--
>JackHamilton@FirstHealth.com
>Manager, Technical Development
>Metrics Department, First Health
>West Sacramento, California USA
>
>>>> "Rick Preiss" <rpreiss@PREISSCO.COM> 06/28/2004 6:02 PM >>>
>I have a field (actdate) in a database that is a date in the following
>format: 6/12/2003. I want to select only those dates between two time
>periods, say 6/1/2003 and 6/30/2003. I'm trying to use code akin to
>what's shown below:
>
>if 6/1/2003<=actdate<=6/30/2003;
>
>to subset the records in the database.
>
>I have also tried (to no avail) the following:
>
>begdate='6/1/2003'd;
>enddate='6/30/2003'd;
>
>if begdate<=actdate<=enddate;
>
>
>I'm doing something wrong and I'm too new to sas to figure it out.
>
>Any help would be appreciated.
>
>Thanks,
>
>Rick
|