3 AT_SETUP([RANK simple case with defaults])
4 AT_DATA([rank.sps], [dnl
5 DATA LIST LIST NOTABLE /x (f8).
20 AT_CHECK([pspp -o pspp.csv rank.sps])
21 AT_CHECK([cat pspp.csv], [0], [dnl
22 Variables Created By RANK
40 AT_SETUP([RANK with RANK, RFRACTION, N])
41 AT_DATA([rank.sps], [dnl
42 DATA LIST LIST NOTABLE /a * b *.
68 AT_CHECK([pspp -o pspp.csv rank.sps])
69 AT_CHECK([cat pspp.csv], [0], [dnl
70 Variables Created By RANK
78 a into RFR001(RFRACTION of a)
80 b into RFR002(RFRACTION of b)
86 Variable,Description,,Position
89 ,Display Alignment: Right,,
93 ,Display Alignment: Right,,
98 ,Display Alignment: Right,,
103 ,Display Alignment: Right,,
108 ,Display Alignment: Right,,
110 RFR001,RFRACTION of a,,6
113 ,Display Alignment: Right,,
115 RFR002,RFRACTION of b,,7
118 ,Display Alignment: Right,,
123 ,Display Alignment: Right,,
127 a,b,count,Ra,Rb,RFR001,RFR002,Nb
128 .00,24.00,10,10.000,8.000,1.0000,.8889,9
129 1.00,32.00,10,9.000,4.000,.9000,.4444,9
130 2.00,31.00,10,8.000,5.000,.8000,.5556,9
131 2.00,32.00,10,8.000,4.000,.8000,.4444,9
132 4.00,30.00,10,6.000,6.000,.6000,.6667,9
133 5.00,29.00,10,5.000,7.000,.5000,.7778,9
134 6.00,1.00,10,4.000,9.000,.4000,1.0000,9
135 7.00,43.00,10,3.000,2.000,.3000,.2222,9
136 8.00,. ,10,2.000,. ,.2000,. ,.
137 9.00,45.00,10,1.000,1.000,.1000,.1111,9
141 AT_SETUP([RANK with SAVAGE, PERCENT, PROPORTION, NTILES])
142 AT_DATA([rank.sps], [dnl
143 DATA LIST LIST NOTABLE /a * b *.
169 AT_CHECK([pspp -o pspp.csv rank.sps])
170 AT_CHECK([cat pspp.csv], [0], [dnl
171 Variables Created By RANK
175 a into Sa(SAVAGE of a)
177 a into Pa(PERCENT of a)
179 a into PRO001(PROPORTION of a using BLOM)
181 a into Na(NTILES of a)
183 a into NOR001(NORMAL of a using BLOM)
186 a,b,Sa,Pa,PRO001,Na,NOR001
187 .00,24.00,-.9000,10.00,.0610,1,-1.547
188 1.00,32.00,-.7889,20.00,.1585,1,-1.000
189 2.00,31.00,-.5925,30.00,.2561,2,-.6554
190 2.00,32.00,-.5925,30.00,.2561,2,-.6554
191 4.00,30.00,-.3544,40.00,.3537,2,-.3755
192 5.00,29.00,-.1544,50.00,.4512,2,-.1226
193 6.00,1.00,.0956,60.00,.5488,3,.1226
194 7.00,43.00,.4290,70.00,.6463,3,.3755
195 8.00,8.00,.9290,80.00,.7439,3,.6554
196 9.00,45.00,1.9290,90.00,.8415,4,1.0005
200 AT_SETUP([RANK with SPLIT FILE])
201 AT_DATA([rank.sps], [dnl
202 DATA LIST LIST NOTABLE /a * g1 g2 *.
248 AT_CHECK([pspp -o pspp.csv rank.sps])
249 AT_CHECK([cat pspp.csv], [0], [dnl
250 Variables Created By RANK
254 a into Ra(RANK of a BY g2 g1)
256 a into Na(NORMAL of a using RANKIT BY g2 g1)
258 Variables Created By RANK
262 a into RAN001(RANK of a BY g2)
264 a into NOR001(NORMAL of a using RANKIT BY g2)
267 a,g1,g2,Ra,Na,RAN001,NOR001
268 2.00,1.00,2.00,8.000,.9674,4.000,.5244
269 2.00,1.00,2.00,8.000,.9674,4.000,.5244
270 3.00,1.00,2.00,7.000,.5895,3.000,.0000
271 4.00,1.00,2.00,6.000,.2822,2.000,-.5244
272 5.00,1.00,2.00,5.000,.0000,1.000,-1.282
273 1.00,.00,2.00,8.000,1.5341,8.000,1.5341
274 2.00,.00,2.00,7.000,.8871,7.000,.8871
275 3.00,.00,2.00,6.000,.4888,6.000,.4888
276 4.00,.00,2.00,5.000,.1573,5.000,.1573
277 5.00,.00,2.00,4.000,-.1573,4.000,-.1573
278 6.00,.00,2.00,3.000,-.4888,3.000,-.4888
279 7.00,.00,2.00,2.000,-.8871,2.000,-.8871
280 8.00,.00,2.00,1.000,-1.534,1.000,-1.534
281 6.00,1.00,2.00,4.000,-.2822,4.000,1.1503
282 7.00,1.00,2.00,2.000,-.9674,2.000,-.3186
283 7.00,1.00,2.00,2.000,-.9674,2.000,-.3186
284 8.00,1.00,2.00,1.000,-1.593,1.000,-1.150
285 9.00,1.00,1.00,1.000,.0000,1.000,.0000
289 # Also tests small ranks for special case of SAVAGE ranks.
290 AT_SETUP([RANK with fractional ranks])
291 AT_DATA([rank.sps], [dnl
292 DATA LIST LIST NOTABLE /a * w * .
314 AT_CHECK([pspp -o pspp.csv rank.sps])
315 AT_CHECK([cat pspp.csv], [0], [dnl
316 Variables Created By RANK
320 a into Pa(PROPORTION of a using TUKEY)
322 a into Sa(SAVAGE of a)
326 1.00,1.50,.1285,-.8016
327 2.00,.20,.1776,-.6905
328 3.00,.10,.1986,-.6905
329 4.00,1.00,.3458,-.5305
330 5.00,1.00,.4860,-.2905
331 6.00,1.00,.6262,.0262
332 7.00,1.00,.7664,.4929
333 8.00,1.00,.9065,1.3929
337 AT_SETUP([RANK all-ties due to tiny weights])
338 AT_DATA([rank.sps], [dnl
339 DATA LIST LIST NOTABLE /x * w *.
375 AT_CHECK([pspp -o pspp.csv rank.sps])
376 AT_CHECK([cat pspp.csv], [0], [dnl
377 Variables Created By RANK
383 Variables Created By RANK
389 Variables Created By RANK
395 Variables Created By RANK
399 x into Nx(NORMAL of x using VW)
403 1.00,.10,.000,.100,1.000,-1.938
404 2.00,.10,.100,.200,2.000,-1.412
405 3.00,.10,.200,.300,3.000,-1.119
406 4.00,.20,.300,.500,4.000,-.8046
407 5.00,.10,.500,.600,5.000,-.5549
408 6.00,.10,.600,.700,6.000,-.4067
409 7.00,.10,.700,.800,7.000,-.2670
410 8.00,.10,.800,.900,8.000,-.1323
414 AT_SETUP([RANK variable name fallback])
415 AT_DATA([rank.sps], [dnl
416 DATA LIST LIST NOTABLE /foo * rfoo * ran003 *.
435 AT_CHECK([pspp -o pspp.csv rank.sps])
436 AT_CHECK([cat pspp.csv], [0], [dnl
437 Variables Created By RANK
441 foo into RAN001(RANK of foo)
443 Variable,Description,,Position
446 ,Display Alignment: Right,,
450 ,Display Alignment: Right,,
452 ran003,Format: F8.2,,3
454 ,Display Alignment: Right,,
456 RAN001,RANK of foo,,4
459 ,Display Alignment: Right,,
464 AT_SETUP([RANK robust variable name creation])
465 AT_DATA([rank.sps], [dnl
466 DATA LIST LIST notable /x * rx * ran001 TO ran999.
479 DELETE VAR ran001 TO ran999.
483 AT_CHECK([pspp -O format=csv rank.sps], [0], [dnl
484 "rank.sps:3: warning: BEGIN DATA: Missing value(s) for all variables from rx onward. These will be filled with the system-missing value or blanks, as appropriate."
486 "rank.sps:4: warning: BEGIN DATA: Missing value(s) for all variables from rx onward. These will be filled with the system-missing value or blanks, as appropriate."
488 "rank.sps:5: warning: BEGIN DATA: Missing value(s) for all variables from rx onward. These will be filled with the system-missing value or blanks, as appropriate."
490 "rank.sps:6: warning: BEGIN DATA: Missing value(s) for all variables from rx onward. These will be filled with the system-missing value or blanks, as appropriate."
492 "rank.sps:7: warning: BEGIN DATA: Missing value(s) for all variables from rx onward. These will be filled with the system-missing value or blanks, as appropriate."
494 "rank.sps:8: warning: BEGIN DATA: Missing value(s) for all variables from rx onward. These will be filled with the system-missing value or blanks, as appropriate."
496 "rank.sps:9: warning: BEGIN DATA: Missing value(s) for all variables from rx onward. These will be filled with the system-missing value or blanks, as appropriate."
498 Variables Created By RANK
502 x into RNKRA01(RANK of x)
516 dnl Test for proper behaviour in the face of invalid input.
517 AT_SETUP([RANK handling of invalid input])
518 AT_DATA([rank.sps], [dnl
519 DATA LIST LIST NOTABLE /x * a (a2).
534 AT_CHECK([pspp -O format=csv --testing-mode rank.sps], [1], [dnl
535 Variables Created By RANK
541 rank.sps:14: error: RANK: DEBUG XFORM FAIL transformation executed
545 AT_SETUP([RANK handling of invalid syntax])
546 AT_DATA([rank.sps], [dnl
547 DATA LIST LIST NOTABLE /x * a (a2).
558 * invalid NTILES (no parameter)
563 * invalid NTILES (not an integer)
569 * destination variable already exists
574 * Too many variables in INTO
576 /RANK INTO foo bar wiz.
578 AT_CHECK([pspp -O format=csv rank.sps], [1], [dnl
579 rank.sps:15.1: error: RANK: Syntax error at end of command: expecting `@{:@'.
581 rank.sps:19.11: error: RANK: Syntax error at `d': expecting integer.
583 rank.sps:25: error: RANK: Variable x already exists.
585 rank.sps:30: error: RANK: Too many variables in INTO clause.