Date: Mon, 29 Sep 2003 14:48:14 -0400
Reply-To: Venky Chakravarthy <venky.chakravarthy@PFIZER.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Venky Chakravarthy <venky.chakravarthy@PFIZER.COM>
Subject: Re: SAS v 8 | intck vs datdif
On Mon, 29 Sep 2003 13:47:02 -0400, Evan Cooch
<evan.cooch@NOSPAMCORNELL.EDU> wrote:
>Problem may just be due to my lack of understanding of SAS date formatting
>(never had to use it before in ~ 20 years of working with SAS - lucky me,
as far
>as I can tell).
>
>The datafile is IMPORTED from dBASE. There are 2 date fields (call them
date1
>and date2). When I run PROC CONTENTS on the imported datafile, I see that
for
>both, the INFORMAT is YYMMDD8., and the FORMAT is MMDDYY8.
>
>When I print them out, I get values for date1 and date2 that look like
>
>01/14/99 01/28/99
>
>(for date1 and date2, respectively).
>
>Now, all I want is the number of days between the 2. If I try something
obvious
>(and apparently stupid) like
>
>
>diff=date2-date1, I don't get 14, but rather some weird number like 36749
(or
>some such).
>
>So, given what I've stated, how does one trick SAS into doing something
this
>obvious, and basic?
More likely, there is something else going on. The two functions behave as
expected (see below):
55 data _null_ ;
56 first = input("01/01/99",mmddyy8.) ;
57 last = input("01/15/99",mmddyy8.) ;
58 format first last mmddyy10. ;
59 _intck = intck('days',first,last) ;
60 _datdif = datdif(first,last,'actual') ;
61 put (_all_) (=) ;
62 run ;
FIRST=01/01/1999 LAST=01/15/1999 _INTCK=14 _DATDIF=14
Venky
|