Determining quarter number

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
Offshored2002
Participant
Posts: 17
Joined: Wed Apr 16, 2008 6:39 am
Location: Arlington, VA

Determining quarter number

Post by Offshored2002 »

Is there an easy way to determine the number of quarters between two dates which could be added as a column derivation in say, a COPY stage:
For example:
NQTRS between (2007-03-31 - 2008-03-31) + 1 = 5 (absolute value)

Those of you familar with SAS, the code would be
NQTRS = INTCK('QTR','31Mar2007'd,'31Mar2008'd) + 1;
and would return 5
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Convert your dates to internal format, then use OCONV(In.Date1,'DQ') to get the quarter number and OCONV(In.Date1,'DY') to get the year and then (Date1Q+(Date1Y*4))-(Date2Q+(Date2Y*4))
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

A Time dimension would be helpful.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Moderator: please move to parallel forum
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply