logo SmartSurvey / Scripting Docs
Back to Docs
Question Type
5 Ranking Choice *RANK

Asks the respondent to rank a list of items in order of preference. Each item receives a rank number (1 = first/most preferred). Use valueof[Qx.n] where n is the item code to retrieve its assigned rank.

Type ID 5
Directive *RANK
Category Choice
Script Definition
script definition (.q)
*QUESTION Q5 *RANK
Q5. Please rank these brands from most to least preferred.
1:Brand A
2:Brand B
3:Brand C
4:Brand D

-- Rotating Answer Options Randomly with *ROT:
*QUESTION Q5 *RANK *ROT
Q5. Please rank these brands from most to least preferred.
1:Brand A
2:Brand B
3:Brand C
4:Brand D

-- Randomize Answer Options with *RANDOM:
*QUESTION Q5 *RANK *RANDOM
Q5. Please rank these brands from most to least preferred.
1:Brand A
2:Brand B
3:Brand C
4:Brand D

-- Limiting the Number of Rankings with *MIN and *MAX:
*QUESTION Q5 *RANK *MIN 2 *MAX 3
Q5. Please rank these brands from most to least preferred.
1:Brand A
2:Brand B
3:Brand C
4:Brand D
Use in Expressions
expressions
valueof[Q5.1]=1    -- BrandA was ranked first
valueof[Q5.2]<=2   -- BrandB was ranked 1st or 2nd
valueof[Q5.3]=4    -- BrandC was ranked last (out of 4)
valueof[Q5.n] where n is the option code returns that option's rank position (1 = top-ranked).
The index n refers to the option code, not the rank position. valueof[Q5.1] answers: "what rank did option 1 receive?"
Related