Skip to content
Notifications
Clear all

Multi-key ranking

11 Posts
4 Users
0 Reactions
4,529 Views
Posts: 10
Customer
Topic starter
(@ddb8zvbjy5qer2dwyzwynjlpc543)
Active Member
Joined: 3 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.

10 Replies
Posts: 9
Admin
(@dpaine)
Member
Joined: 6 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
Posts: 3
Guest
(@Anonymous 10912)
New Member
Joined: 1 year ago

help meeee

Reply
Posts: 3
Guest
(@Anonymous 10912)
New Member
Joined: 1 year ago

pak cepat cepat jeder

Reply
Posts: 3
Guest
(@Anonymous 10912)
New Member
Joined: 1 year ago

ahhuhh   ahhhh

Reply
Page 1 / 3
Share:

Download Free Analytica


    We hate spam as much as you. We won't share your email with third parties.
    The free edition of Analytica includes these key Analytica features:
    Free Analytica has no time limit. The only constraint is it won’t let you create more than 100 variables or other objects. But your model can be quite substantial since each variable can be a multidimensional array. It also lets you explore, change inputs, and run existing models of any size (excluding features unique to the Enterprise or Optimizer editions).

    Download the free edition of Analytica

    The free edition of Analytica includes these key Analytica features: 

    Free Analytica has no time limit. The only constraint is it won’t let you create more than 100 variables or other objects. But your model can be quite substantial since each variable can be a multidimensional array.  It also lets you explore, change inputs, and run existing models of any size (excluding features unique to the Enterprise or Optimizer editions).

    Analytica runs on any Windows computer, or on a Macintosh using Parallels or VMWare.


      Analytica Cubes Pattern