Michael Angelo Pagala
New User
Joined: 02 Mar 2007 Posts: 34 Location: somewhere in the middle
|
|
|
|
I have searched and read threads and can't find any answer specific to my problem.
Is there any way I can compare two dates in MM/DD/CCYY format without breaking it to MMDDCCYY?
I need to compare the two dates and if one is greater than the other I would use the one which ever is higher.
I thought something like this would do the trick.
sample: (51,10,CH,GT,24,10,CH)
Is there any additional parameters that would not require me to remove the slashes first and compare.but if I really need to remove it..how do I do it in a simple way and the output would still has the '/'.
here is my current sort card
Code: |
JOINKEYS FILES=F1,FIELDS=(1,23,A)
JOINKEYS FILES=F2,FIELDS=(1,23,A)
JOIN UNPAIRED,F2
REFORMAT FIELDS=(F2:1,50,F1:25,10)
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=(50,1,CH,EQ,C'P',AND,51,10,CH,GT,24,10,CH),
BUILD=(1,19,24,10,51,10,50,1,20,4)),
IFTHEN=(WHEN=NONE,BUILD=(1,19,24,20,50,1,20,4)) |
when reformatted the position of the dates would be 24 & 51 respectively |
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
The problem is not the slashes but rather the order of the date fields. . .
Comparing 11231990 to 01152009 or comparing 11/23/1990 to 01/15/2009 will never give the correct answer even with the slashes removed.
If i understand, your comparison needs to be ccyymmdd in order to work. Once the dates are in the proper order, it won't matter if there are slashes or not.
Possibly, there is something i misunderstand. . . |
|