| NIPO ODIN Version 5.17*ORDERPurpose Set the order of codes in a code list or the order of execution in a *REPEATloop. Syntax *ORDER <var | QnM | QnR>
 Description You can define the order of codes in a *CODESor*FORM question and the order of a*REPEATloop according to the contents of an array variable or the order of mentions of another question. Both variable names and questions with order specifier (QnMorQnR) may be used in the*ORDERcommand.*ORDERmay be used in a*REPEAT,*QUESTIONor*FORMstatement.Invalid orders in the argument with *ORDERare ignored. This means if an order number is used twice or if an index in the variable is empty, all remaining code are displayed in regular ascending order.*ORDERcannot be used together with*RANDOM,*INV or*ROT.The order of mentions in a question are available through QnMiwherenis the question number andiis the index of the mention.The display order of a random-question is available through QnRi, wherenis the question number andiis the index of the random order.You can store the order of mentions and or the random order by specifying a length behind the *MULTI or*RANDOMcommand usingLnwherenis the number of positions to store answers. The operatorsQnMandQnRare available, independent of whether the order is saved or not.A syntax check produces a warning message if the variables MorRare defined. If these variable names are used, the operatorQnMiandQnRiare not available.The items in a *REPEATblock or code list which are not in the*ORDERcommand, are displayed in the order as if there was no*CONTROLcommand. This means that if you only want to show the items mentioned in a previous*CODESquestion in the order they were mentioned, you have to use both a*ORDER and a*CONTROLcommand.
 Arguments varThis is a variable name of an array variable (
 *VARS name[n]). The values in this variable set the order in which the codes are displayed or the order in which the*REPEATloop is processed.
 QnMThis is order of mentions of a previous
 *MULTI question.
 QnRThis is the order in which a previous question with
 *RANDOM,*INV or*ROT was displayed.
 Example 1 *QUESTION 1 *CODES 61L5 *MULTI 66L4Which brands do you know?
 
 (Int. do NOT help!
 
 Type the answers in the same order as given by the respondent)
 
 1: brand A
 2: brand B
 3: brand C
 4: brand D
 
 5: None of these *NMUL *NOCON
 
 *QUESTION 2 *CODES 71L5 *MULTI 76L4 *CONTROL Q1 W *ORDER Q1M
 Which brand do you use most often
 
 (Brands are presented in the order that was entered in Q1)
 
 1: brand A
 2: brand B
 3: brand C
 4: brand D
 
 5: None of these *NMUL *NOCON
 Example 2 *QUESTION 3 *CODES 81L5 *MULTI *RANDOMWhich of the following brands do you know?
 
 1: brand A
 2: brand B
 3: brand C
 4: brand D
 
 5: None of these *NMUL *NOCON
 
 *TEXTVARS STATEMENT
 *REPEAT 5 *ORDER Q3R
 
 ** The repeat loop will be executed in the same order
 ** that Q3 was (randomly) displayed
 
 *REPNUM 1 *PUT STATEMENT "Brand A"
 *REPNUM 2 *PUT STATEMENT "Brand B"
 *REPNUM 3 *PUT STATEMENT "Brand C"
 *REPNUM 4 *PUT STATEMENT "Brand D"
 *REPNUM 5 *PUT STATEMENT "All brands"
 
 *QUESTION 4 *CODES L1
 *?STATEMENT
 
 5: 5 (good)
 4: 4
 3: 3
 2: 2
 1: 1 (poor)
 
 *ENDREP
 Example 3 *** 'Brand A' should always be presented first*** 'Brand B', 'Brand C' and 'Brand D' should be in random order
 *** 'All brands' should always be last
 
 *VARS MyOwnOrder[4],NR
 *PUT MyOwnOrder[1] [1]
 
 *** Create an extra repeat-loop to get 3 unique numbers
 *** 2 through 4
 
 *REPEAT 3 *RANDOM
 *PUT NR [ NR + 1 ]
 *PUT MyOwnOrder[?R + 1] [NR + 1]
 *ENDREP
 
 *TEXTVARS STATEMENT
 
 *REPEAT 5 *ORDER MyOwnOrder
 
 ** The repeat loop will be executed in the order
 ** that I defined in the variable MyOwnOrder
 ** As the variable MyOwnOrder has only 4 indices,
 ** the fifth repetition will be executed in the normal order
 ** (i.e. last)
 
 *REPNUM 1 *PUT STATEMENT "Brand A"
 *REPNUM 2 *PUT STATEMENT "Brand B"
 *REPNUM 3 *PUT STATEMENT "Brand C"
 *REPNUM 4 *PUT STATEMENT "Brand D"
 *REPNUM 5 *PUT STATEMENT "All brands"
 
 *QUESTION 3 *CODES L1
 *?STATEMENT
 
 5: 5 (good)
 4: 4
 3: 3
 2: 2
 1: 1 (poor)
 
 *ENDREP
 When you create random order numbers for brand A, B, C and D, you could also use the RAN operator. But then you are not sure that it will pick four different numbers. If this happens, brand A, B, C and D will be in random order until a duplicate is met. *PUT MyOwnOrder[1] [ (RAN 4) + 1 ]*PUT MyOwnOrder[2] [ (RAN 4) + 1 ]
 *PUT MyOwnOrder[3] [ (RAN 4) + 1 ]
 *PUT MyOwnOrder[4] [ (RAN 4) + 1 ]
 
 *REPEAT 4 *ORDER MyOwnOrder
 |