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
125 RFR001,"Label: RFRACTION of a
131 RFR002,"Label: RFRACTION of b
137 a,b,Ra,RFR001,count,Rb,RFR002,Nb
138 .00,24.00,10.000,1.0000,10,8.000,.8889,9
139 1.00,32.00,9.000,.9000,10,4.000,.4444,9
140 2.00,31.00,8.000,.8000,10,5.000,.5556,9
141 2.00,32.00,8.000,.8000,10,4.000,.4444,9
142 4.00,30.00,6.000,.6000,10,6.000,.6667,9
143 5.00,29.00,5.000,.5000,10,7.000,.7778,9
144 6.00,1.00,4.000,.4000,10,9.000,1.0000,9
145 7.00,43.00,3.000,.3000,10,2.000,.2222,9
146 8.00,. ,2.000,.2000,10,. ,. ,.
147 9.00,45.00,1.000,.1000,10,1.000,.1111,9
151 AT_SETUP([RANK with SAVAGE, PERCENT, PROPORTION, NTILES])
152 AT_DATA([rank.sps], [dnl
153 DATA LIST LIST NOTABLE /a * b *.
179 AT_CHECK([pspp -o pspp.csv rank.sps])
180 AT_CHECK([cat pspp.csv], [0], [dnl
181 Variables Created By RANK
185 a into Sa(SAVAGE of a)
187 a into Pa(PERCENT of a)
189 a into PRO001(PROPORTION of a using BLOM)
191 a into Na(NTILES of a)
193 a into NOR001(NORMAL of a using BLOM)
196 a,b,Sa,Pa,PRO001,Na,NOR001
197 .00,24.00,-.9000,10.00,.0610,1,-1.547
198 1.00,32.00,-.7889,20.00,.1585,1,-1.000
199 2.00,31.00,-.5925,30.00,.2561,2,-.6554
200 2.00,32.00,-.5925,30.00,.2561,2,-.6554
201 4.00,30.00,-.3544,40.00,.3537,2,-.3755
202 5.00,29.00,-.1544,50.00,.4512,2,-.1226
203 6.00,1.00,.0956,60.00,.5488,3,.1226
204 7.00,43.00,.4290,70.00,.6463,3,.3755
205 8.00,8.00,.9290,80.00,.7439,3,.6554
206 9.00,45.00,1.9290,90.00,.8415,4,1.0005
210 AT_SETUP([RANK with SPLIT FILE])
211 AT_DATA([rank.sps], [dnl
212 DATA LIST LIST NOTABLE /a * g1 g2 *.
258 AT_CHECK([pspp -o pspp.csv rank.sps])
259 AT_CHECK([cat pspp.csv], [0], [dnl
260 Variables Created By RANK
264 a into Ra(RANK of a BY g2 g1)
266 a into Na(NORMAL of a using RANKIT BY g2 g1)
268 Variables Created By RANK
272 a into RAN001(RANK of a BY g2)
274 a into NOR001(NORMAL of a using RANKIT BY g2)
277 a,g1,g2,Ra,Na,RAN001,NOR001
278 2.00,1.00,2.00,8.000,.9674,4.000,.5244
279 2.00,1.00,2.00,8.000,.9674,4.000,.5244
280 3.00,1.00,2.00,7.000,.5895,3.000,.0000
281 4.00,1.00,2.00,6.000,.2822,2.000,-.5244
282 5.00,1.00,2.00,5.000,.0000,1.000,-1.282
283 1.00,.00,2.00,8.000,1.5341,8.000,1.5341
284 2.00,.00,2.00,7.000,.8871,7.000,.8871
285 3.00,.00,2.00,6.000,.4888,6.000,.4888
286 4.00,.00,2.00,5.000,.1573,5.000,.1573
287 5.00,.00,2.00,4.000,-.1573,4.000,-.1573
288 6.00,.00,2.00,3.000,-.4888,3.000,-.4888
289 7.00,.00,2.00,2.000,-.8871,2.000,-.8871
290 8.00,.00,2.00,1.000,-1.534,1.000,-1.534
291 6.00,1.00,2.00,4.000,-.2822,4.000,1.1503
292 7.00,1.00,2.00,2.000,-.9674,2.000,-.3186
293 7.00,1.00,2.00,2.000,-.9674,2.000,-.3186
294 8.00,1.00,2.00,1.000,-1.593,1.000,-1.150
295 9.00,1.00,1.00,1.000,.0000,1.000,.0000
299 # Also tests small ranks for special case of SAVAGE ranks.
300 AT_SETUP([RANK with fractional ranks])
301 AT_DATA([rank.sps], [dnl
302 DATA LIST LIST NOTABLE /a * w * .
324 AT_CHECK([pspp -o pspp.csv rank.sps])
325 AT_CHECK([cat pspp.csv], [0], [dnl
326 Variables Created By RANK
330 a into Pa(PROPORTION of a using TUKEY)
332 a into Sa(SAVAGE of a)
336 1.00,1.50,.1285,-.8016
337 2.00,.20,.1776,-.6905
338 3.00,.10,.1986,-.6905
339 4.00,1.00,.3458,-.5305
340 5.00,1.00,.4860,-.2905
341 6.00,1.00,.6262,.0262
342 7.00,1.00,.7664,.4929
343 8.00,1.00,.9065,1.3929
347 AT_SETUP([RANK all-ties due to tiny weights])
348 AT_DATA([rank.sps], [dnl
349 DATA LIST LIST NOTABLE /x * w *.
385 AT_CHECK([pspp -o pspp.csv rank.sps])
386 AT_CHECK([cat pspp.csv], [0], [dnl
387 Variables Created By RANK
393 Variables Created By RANK
399 Variables Created By RANK
405 Variables Created By RANK
409 x into Nx(NORMAL of x using VW)
413 1.00,.10,.000,.100,1.000,-1.938
414 2.00,.10,.100,.200,2.000,-1.412
415 3.00,.10,.200,.300,3.000,-1.119
416 4.00,.20,.300,.500,4.000,-.8046
417 5.00,.10,.500,.600,5.000,-.5549
418 6.00,.10,.600,.700,6.000,-.4067
419 7.00,.10,.700,.800,7.000,-.2670
420 8.00,.10,.800,.900,8.000,-.1323
424 AT_SETUP([RANK and TEMPORARY])
425 AT_DATA([rank.sps], [dnl
426 DATA LIST LIST NOTABLE /age (f2) gender (a1).
442 SELECT IF gender = 'm'.
443 RANK age /RANK INTO Rm.
446 SELECT IF gender = 'f'.
447 RANK age /RANK INTO Rf.
451 AT_CHECK([pspp -O format=csv rank.sps], [0], [dnl
452 Variables Created By RANK
456 age into Rm(RANK of age)
458 Variables Created By RANK
462 age into Rf(RANK of age)
480 AT_SETUP([RANK variable name fallback])
481 AT_DATA([rank.sps], [dnl
482 DATA LIST LIST NOTABLE /foo * rfoo * ran003 *.
501 AT_CHECK([pspp -o pspp.csv rank.sps])
502 AT_CHECK([cat pspp.csv], [0], [dnl
503 Variables Created By RANK
507 foo into RAN001(RANK of foo)
509 Variable,Description,Position
512 ran003,Format: F8.2,3
513 RAN001,"Label: RANK of foo
518 AT_SETUP([RANK robust variable name creation])
519 AT_DATA([rank.sps], [dnl
520 DATA LIST LIST notable /x * rx * ran001 TO ran999.
533 DELETE VAR ran001 TO ran999.
537 AT_CHECK([pspp -O format=csv rank.sps], [0], [dnl
538 "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."
540 "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."
542 "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."
544 "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."
546 "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."
548 "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."
550 "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."
552 Variables Created By RANK
556 x into RNKRA01(RANK of x)
570 dnl Test for proper behaviour in the face of invalid input.
571 AT_SETUP([RANK handling of invalid input])
572 AT_DATA([rank.sps], [dnl
573 DATA LIST LIST NOTABLE /x * a (a2).
588 AT_CHECK([pspp -O format=csv --testing-mode rank.sps], [1], [dnl
589 Variables Created By RANK
595 rank.sps:14: error: RANK: DEBUG XFORM FAIL transformation executed
599 AT_SETUP([RANK handling of invalid syntax])
600 AT_DATA([rank.sps], [dnl
601 DATA LIST LIST NOTABLE /x * a (a2).
612 * invalid NTILES (no parameter)
617 * invalid NTILES (not an integer)
623 * destination variable already exists
628 * Too many variables in INTO
630 /RANK INTO foo bar wiz.
632 AT_CHECK([pspp -O format=csv rank.sps], [1], [dnl
633 rank.sps:15.1: error: RANK: Syntax error at end of command: expecting `@{:@'.
635 rank.sps:19.11: error: RANK: Syntax error at `d': expecting integer.
637 rank.sps:25: error: RANK: Variable x already exists.
639 rank.sps:30: error: RANK: Too many variables in INTO clause.