Tech Tip! - Sort Data by Week Number
There are times when doing reports when you need to sort your values into weeks. Most people would end up writing a program to do this, but that is not necessary.
So assuming attribute 14 contains a date, then
F Correlative
F;14;C7;/
A Correlative
A;(14 / "7")
A full dictionary item would like the like the following
WEEK.NBR
001 S
002 0
003 Week Number
008 F;14;C1;+;C7;/
009 R
010 6
is now the week number since 1968, with Sunday as the start of the week.
You can
then use this in a BREAK-ON.
SORT FILE BY DATE BREAK-ON WEEK.NBR
If you want to have Monday as the beginning of the week, then do the
follow:
WEEK.NBR.M-S
001 S
002 0
003 Week Number
008 F;14;C1;-;C7;/
009 R
010 6
This Tips was derived from Tom Phillips. He has lost of more samples like
this
at http://www.tom-phillips.info
p>