Re: How to Compare two different informat dates using SAS #2

  • Follow


Hi Suthakar,

Here's how i would approach it.  I will format date2 to DATETIME20.
and use VVALUE function.  The VVALUE function returns the formatted
value that is associated with the variable that you specify .
VVALUE returns a character string that contains the current value of
the variable that you specify. The value is formatted using the
current format that is associated with the variable. (Source: SAS
Help and Documentation).


data test;
input date1 $16. date2 datetime20.;
cards;
09OCT2006:09:03 09OCT2006:09:03:00
10OCT2006:09:03 09OCT2006:09:03:00
;
run;

data test;
set test;
date1a = substr(vvalue(date1),1,15);
format date2 datetime20.;
date2a = substr(left(vvalue(date2)),1,15);
if date1a = date2a then same = 1; else same = 0;
;
run;

HTH,

Florio



At 08:12 PM 11/2/2006, Suthakar Iyer wrote:
>   date1 = 09OCT2006:09:03     this date in the $16. informat
>   date2 = 09OCT2006:09:03:00   this date in the datetime20. informat.
0
Reply foa2 (105) 11/3/2006 2:08:28 AM


0 Replies
8 Views

(page loaded in 0.018 seconds)


Reply: