04-11-2013 11:41 AM
I would like to know how to group daily expenses into a by-weekly format. Since i've worked with a small database i've used the recoded function and applied ranges.
|Date of Charge||By-Weekly Expenses|
i'll appreciate the help to construct a condition to apply in the Advanced Expression option
04-11-2013 01:14 PM
I think we need some more detail as to what you're looking to do.
One thing to look into is formats for the date variable that will automatically calculate a week portion of the date and then if you can use that to help with your calculation.
If you're looking for bi-weekly dates you could subtract or add 1 week to the result if you had an odd number for example.
04-11-2013 01:21 PM
I basically want to fit a historical range of purchases dates into a by-weekly format. For every purchase between 01AUG2012 and 15AUG2012, label them as 15AUG2012 and the same for some other purchase between 16AUG2012 and 31AUG2012 with the label 31AUG2012.
Since i have too much data, i cannot keep creating a format within the recoded function.
04-11-2013 01:35 PM
Since i'm not that skillful yet with some unknown functions, i was given this (example) to arrange dates in a different bi-weekly format:
ifn(day(t1.purchase_date)<=15, intnx('month',t1.purchase_date,0,'e'), intnx('month',t1.purchase_date,1,'m'))
I'm trying to understand the conditions from this formula to fit my neccesities in a customized format.
04-11-2013 01:58 PM
My bi_week2 gives you biweekly counts and you can add/subtract 7 to get it closer to what you need and seems simpler.
You can refer to the docs for the definition of the intnx function, but basically it increments dates within specified intervals, in this case a biweek interval, WEEK2.
do date="01Mar2013"d to "01Jun2013"d;
bi_week=ifn(day(date)>=15, intnx('month',date,0,'e'), intnx('month',date,1,'m'));
bi_week2=intnx('WEEK2', date, 0, 'BEGINNING');
format date bi_week bi_week2 date9.;