Page 1 of 1

Ranking system in Data stage

Posted: Fri Oct 19, 2007 6:37 am
by mcs@rajesh
Hello Friends,
I have a job similar to the ranking system in schools and colleges.. I am doing this job in Data stage and i am not getting the exact answer, for example

St_name marks
Joe 100
Tim 100
Jacob 50
Jason 20

The expected result, should be

St_name marks rank
Joe 100 1
Tim 100 1
Jacob 50 3
Jason 20 4

i tried this with all possible ways i know but i am not getting it...

Posted: Fri Oct 19, 2007 6:39 am
by sudhakar_viswa
Hi,

By using stage variables u can get this result.

Regards,
-- sudhakar

Posted: Fri Oct 19, 2007 6:47 am
by mcs@rajesh
sudhakar_viswa wrote:Hi,

By using stage variables u can get this result.

Regards,
-- sudhakar
Thanks for your, reply can u walk through the steps...

Posted: Fri Oct 19, 2007 7:42 am
by stefanfrost1
build a couple of stage varibles checking that records change and a counter and a rank. Add rank with the counter value if a record has changed, then reset the counter and continue....

pseudo code:
if this_value equals prev_value then count = count+1 else count = 1
if this_value equals prev_value then rank = rank else rank = rank+count

or something similar to that .

Remeber to have your data sorted and beware of partitioning mistakes...