Skip to content
Notifications
Clear all

Multi-key ranking

5 Posts
3 Users
0 Likes
292 Views
Avatar
Posts: 10
Customer
Topic starter
(@ddb8zvbjy5qer2dwyzwynjlpc543)
Active Member
Joined: 2 years ago

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.

4 Replies
Avatar
Posts: 9
Admin
(@dpaine)
Member
Joined: 5 years ago

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

Reply
Risa Hanzel
Posts: 3
Customer
(@risahanzel)
New Member
Joined: 2 months ago

help meeee

Reply
Risa Hanzel
Posts: 3
Customer
(@risahanzel)
New Member
Joined: 2 months ago

pak cepat cepat jeder

Reply
Risa Hanzel
Posts: 3
Customer
(@risahanzel)
New Member
Joined: 2 months ago

ahhuhh   ahhhh

Reply
Share: