Multi-key ranking
I am trying to get ranking using two keys; a primary one (which has ties) and a secondary one to break the ties. Docs.analytica.com gives this example: Â
Index keyIndex := ['age', 'gender'];
Rank(Array(keyIndex, [age, gender]), i, keyIndex)
In this example, the third argument to Rank seems to be an index called keyIndex.Â
But when I try to get this working in my code, I get an error message:Â Evaluation error in Proj_ranks:Â In call to function Rank, the third parameter, <<tyoe>>, should be numeric ...
I think the documentation is off, because a subsequent example shows keyIndex: being used as a keyword, and it is followed by a reference to the index, which has some other name. When I use keyIndex: as a keyword, it seems to work for me.
Yes the documentation is off. Thanks for reporting this. I will change the docs.
In the function rank, type: is the optional numeric 3rd parameter, with default value -1. keyIndex: is the optional 4th parameter.
In the example given here Index keyIndex := ['age', 'gender'];Rank(Array(keyIndex, [age, gender]), i, keyIndex)
With the the optional 3rd parameter not specified the 4th keyIndex parameter must be named like so; Index keyIndex := ['age', 'gender'];Rank(Array(keyIndex, [age, gender]), i, keyIndex: keyIndex)
You mention a subsequent example I think you may mean this:
Rank(NumMaintEvents, CarNum, keyIndex: maintType: RankType)
In this example keyIndex: is the parameter's name with the value being the index maintType. keyIndex: is named since it is out of order. RankType: is the type: parameter and is not named here but it should be - i.e. type: RankType - since it also is out of order.
There is an example model which contains some of the example variables on this page: Look at rank function examples in the array functions/array transforming module here.
C:\Program Files\Lumina\Analytica 6.4\Example Models\User Guide Examples\Array Function Examples.ana
help meeee
pak cepat cepat jeder
ahhuhh  ahhhh
- 4 Forums
- 87 Topics
- 286 Posts
- 1 Online
- 1,887 Members