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 # This checks for regression against a crash reported as bug #38482
41 # that occurred when multiple variables were specified without any
42 # rank specifications.
43 AT_SETUP([RANK multiple variables with defaults])
44 AT_DATA([rank.sps], [dnl
45 DATA LIST LIST NOTABLE /x * y * z *.
55 AT_CHECK([pspp -o pspp.csv rank.sps])
56 AT_CHECK([cat pspp.csv], [0], [dnl
57 Variables Created By RANK
69 1.00,2.00,3.00,1.000,1.000,1.000
70 4.00,5.00,6.00,2.000,2.000,2.000
74 AT_SETUP([RANK with RANK, RFRACTION, N])
75 AT_DATA([rank.sps], [dnl
76 DATA LIST LIST NOTABLE /a * b *.
102 AT_CHECK([pspp -o pspp.csv rank.sps])
103 AT_CHECK([cat pspp.csv], [0], [dnl
104 Variables Created By RANK
112 a into RFR001(RFRACTION of a)
114 b into RFR002(RFRACTION of b)
120 Variable,Description,,Position
123 ,Display Alignment: Right,,
127 ,Display Alignment: Right,,
132 ,Display Alignment: Right,,
134 RFR001,RFRACTION of a,,4
137 ,Display Alignment: Right,,
142 ,Display Alignment: Right,,
147 ,Display Alignment: Right,,
149 RFR002,RFRACTION of b,,7
152 ,Display Alignment: Right,,
157 ,Display Alignment: Right,,
161 a,b,Ra,RFR001,count,Rb,RFR002,Nb
162 .00,24.00,10.000,1.0000,10,8.000,.8889,9
163 1.00,32.00,9.000,.9000,10,4.000,.4444,9
164 2.00,31.00,8.000,.8000,10,5.000,.5556,9
165 2.00,32.00,8.000,.8000,10,4.000,.4444,9
166 4.00,30.00,6.000,.6000,10,6.000,.6667,9
167 5.00,29.00,5.000,.5000,10,7.000,.7778,9
168 6.00,1.00,4.000,.4000,10,9.000,1.0000,9
169 7.00,43.00,3.000,.3000,10,2.000,.2222,9
170 8.00,. ,2.000,.2000,10,. ,. ,.
171 9.00,45.00,1.000,.1000,10,1.000,.1111,9
175 AT_SETUP([RANK with SAVAGE, PERCENT, PROPORTION, NTILES])
176 AT_DATA([rank.sps], [dnl
177 DATA LIST LIST NOTABLE /a * b *.
203 AT_CHECK([pspp -o pspp.csv rank.sps])
204 AT_CHECK([cat pspp.csv], [0], [dnl
205 Variables Created By RANK
209 a into Sa(SAVAGE of a)
211 a into Pa(PERCENT of a)
213 a into PRO001(PROPORTION of a using BLOM)
215 a into Na(NTILES of a)
217 a into NOR001(NORMAL of a using BLOM)
220 a,b,Sa,Pa,PRO001,Na,NOR001
221 .00,24.00,-.9000,10.00,.0610,1,-1.547
222 1.00,32.00,-.7889,20.00,.1585,1,-1.000
223 2.00,31.00,-.5925,30.00,.2561,2,-.6554
224 2.00,32.00,-.5925,30.00,.2561,2,-.6554
225 4.00,30.00,-.3544,40.00,.3537,2,-.3755
226 5.00,29.00,-.1544,50.00,.4512,2,-.1226
227 6.00,1.00,.0956,60.00,.5488,3,.1226
228 7.00,43.00,.4290,70.00,.6463,3,.3755
229 8.00,8.00,.9290,80.00,.7439,3,.6554
230 9.00,45.00,1.9290,90.00,.8415,4,1.0005
234 AT_SETUP([RANK with SPLIT FILE])
235 AT_DATA([rank.sps], [dnl
236 DATA LIST LIST NOTABLE /a * g1 g2 *.
282 AT_CHECK([pspp -o pspp.csv rank.sps])
283 AT_CHECK([cat pspp.csv], [0], [dnl
284 Variables Created By RANK
288 a into Ra(RANK of a BY g2 g1)
290 a into Na(NORMAL of a using RANKIT BY g2 g1)
292 Variables Created By RANK
296 a into RAN001(RANK of a BY g2)
298 a into NOR001(NORMAL of a using RANKIT BY g2)
301 a,g1,g2,Ra,Na,RAN001,NOR001
302 2.00,1.00,2.00,8.000,.9674,4.000,.5244
303 2.00,1.00,2.00,8.000,.9674,4.000,.5244
304 3.00,1.00,2.00,7.000,.5895,3.000,.0000
305 4.00,1.00,2.00,6.000,.2822,2.000,-.5244
306 5.00,1.00,2.00,5.000,.0000,1.000,-1.282
307 1.00,.00,2.00,8.000,1.5341,8.000,1.5341
308 2.00,.00,2.00,7.000,.8871,7.000,.8871
309 3.00,.00,2.00,6.000,.4888,6.000,.4888
310 4.00,.00,2.00,5.000,.1573,5.000,.1573
311 5.00,.00,2.00,4.000,-.1573,4.000,-.1573
312 6.00,.00,2.00,3.000,-.4888,3.000,-.4888
313 7.00,.00,2.00,2.000,-.8871,2.000,-.8871
314 8.00,.00,2.00,1.000,-1.534,1.000,-1.534
315 6.00,1.00,2.00,4.000,-.2822,4.000,1.1503
316 7.00,1.00,2.00,2.000,-.9674,2.000,-.3186
317 7.00,1.00,2.00,2.000,-.9674,2.000,-.3186
318 8.00,1.00,2.00,1.000,-1.593,1.000,-1.150
319 9.00,1.00,1.00,1.000,.0000,1.000,.0000
323 # Also tests small ranks for special case of SAVAGE ranks.
324 AT_SETUP([RANK with fractional ranks])
325 AT_DATA([rank.sps], [dnl
326 DATA LIST LIST NOTABLE /a * w * .
348 AT_CHECK([pspp -o pspp.csv rank.sps])
349 AT_CHECK([cat pspp.csv], [0], [dnl
350 Variables Created By RANK
354 a into Pa(PROPORTION of a using TUKEY)
356 a into Sa(SAVAGE of a)
360 1.00,1.50,.1285,-.8016
361 2.00,.20,.1776,-.6905
362 3.00,.10,.1986,-.6905
363 4.00,1.00,.3458,-.5305
364 5.00,1.00,.4860,-.2905
365 6.00,1.00,.6262,.0262
366 7.00,1.00,.7664,.4929
367 8.00,1.00,.9065,1.3929
371 AT_SETUP([RANK all-ties due to tiny weights])
372 AT_DATA([rank.sps], [dnl
373 DATA LIST LIST NOTABLE /x * w *.
409 AT_CHECK([pspp -o pspp.csv rank.sps])
410 AT_CHECK([cat pspp.csv], [0], [dnl
411 Variables Created By RANK
417 Variables Created By RANK
423 Variables Created By RANK
429 Variables Created By RANK
433 x into Nx(NORMAL of x using VW)
437 1.00,.10,.000,.100,1.000,-1.938
438 2.00,.10,.100,.200,2.000,-1.412
439 3.00,.10,.200,.300,3.000,-1.119
440 4.00,.20,.300,.500,4.000,-.8046
441 5.00,.10,.500,.600,5.000,-.5549
442 6.00,.10,.600,.700,6.000,-.4067
443 7.00,.10,.700,.800,7.000,-.2670
444 8.00,.10,.800,.900,8.000,-.1323
448 AT_SETUP([RANK and TEMPORARY])
449 AT_DATA([rank.sps], [dnl
450 DATA LIST LIST NOTABLE /age (f2) gender (a1).
466 SELECT IF gender = 'm'.
467 RANK age /RANK INTO Rm.
470 SELECT IF gender = 'f'.
471 RANK age /RANK INTO Rf.
475 AT_CHECK([pspp -O format=csv rank.sps], [0], [dnl
476 Variables Created By RANK
480 age into Rm(RANK of age)
482 Variables Created By RANK
486 age into Rf(RANK of age)
504 AT_SETUP([RANK variable name fallback])
505 AT_DATA([rank.sps], [dnl
506 DATA LIST LIST NOTABLE /foo * rfoo * ran003 *.
525 AT_CHECK([pspp -o pspp.csv rank.sps])
526 AT_CHECK([cat pspp.csv], [0], [dnl
527 Variables Created By RANK
531 foo into RAN001(RANK of foo)
533 Variable,Description,,Position
536 ,Display Alignment: Right,,
540 ,Display Alignment: Right,,
542 ran003,Format: F8.2,,3
544 ,Display Alignment: Right,,
546 RAN001,RANK of foo,,4
549 ,Display Alignment: Right,,
554 AT_SETUP([RANK robust variable name creation])
555 AT_DATA([rank.sps], [dnl
556 DATA LIST LIST notable /x * rx * ran001 TO ran999.
569 DELETE VAR ran001 TO ran999.
573 AT_CHECK([pspp -O format=csv rank.sps], [0], [dnl
574 "rank.sps:3: warning: Missing value(s) for all variables from rx onward. These will be filled with the system-missing value or blanks, as appropriate."
576 "rank.sps:4: warning: Missing value(s) for all variables from rx onward. These will be filled with the system-missing value or blanks, as appropriate."
578 "rank.sps:5: warning: Missing value(s) for all variables from rx onward. These will be filled with the system-missing value or blanks, as appropriate."
580 "rank.sps:6: warning: Missing value(s) for all variables from rx onward. These will be filled with the system-missing value or blanks, as appropriate."
582 "rank.sps:7: warning: Missing value(s) for all variables from rx onward. These will be filled with the system-missing value or blanks, as appropriate."
584 "rank.sps:8: warning: Missing value(s) for all variables from rx onward. These will be filled with the system-missing value or blanks, as appropriate."
586 "rank.sps:9: warning: Missing value(s) for all variables from rx onward. These will be filled with the system-missing value or blanks, as appropriate."
588 Variables Created By RANK
592 x into RNKRA01(RANK of x)
606 dnl Test for proper behaviour in the face of invalid input.
607 AT_SETUP([RANK handling of invalid input])
608 AT_DATA([rank.sps], [dnl
609 DATA LIST LIST NOTABLE /x * a (a2).
624 AT_CHECK([pspp -O format=csv --testing-mode rank.sps], [1], [dnl
625 Variables Created By RANK
631 rank.sps:14: error: RANK: DEBUG XFORM FAIL transformation executed
635 AT_SETUP([RANK handling of invalid syntax])
636 AT_DATA([rank.sps], [dnl
637 DATA LIST LIST NOTABLE /x * a (a2).
648 * invalid NTILES (no parameter)
653 * invalid NTILES (not an integer)
659 * destination variable already exists
664 * Too many variables in INTO
666 /RANK INTO foo bar wiz.
668 AT_CHECK([pspp -O format=csv rank.sps], [1], [dnl
669 rank.sps:15.1: error: RANK: Syntax error at end of command: expecting `@{:@'.
671 rank.sps:19.11: error: RANK: Syntax error at `d': expecting integer.
673 rank.sps:25: error: RANK: Variable x already exists.
675 rank.sps:30: error: RANK: Too many variables in INTO clause.