Autorecode: Add the /GROUP subcommand
[pspp] / tests / language / stats / autorecode.at
1 AT_BANNER([AUTORECODE procedure])
2
3 AT_SETUP([AUTORECODE numbers and short strings])
4 AT_DATA([autorecode.sps],
5   [data list /X 1-5(a) Y 7.
6 begin data.
7 lasdj 1
8 asdfk 0
9 asdfj 2
10 asdfj 1
11 asdfk 2
12 asdfj 9
13 lajks 9
14 asdfk 0
15 asdfk 1
16 end data.
17
18 autorecode x y into A B/descend.
19
20 list.
21 compute Z=trunc(y/2).
22 autorecode z into W.
23 list.
24 ])
25 AT_CHECK([pspp -O format=csv autorecode.sps], [0],
26   [Table: Reading 1 record from INLINE.
27 Variable,Record,Columns,Format
28 X,1,1-  5,A5
29 Y,1,7-  7,F1.0
30
31 Table: Data List
32 X,Y,A,B
33 lasdj,1,1.00,3.00
34 asdfk,0,3.00,4.00
35 asdfj,2,4.00,2.00
36 asdfj,1,4.00,3.00
37 asdfk,2,3.00,2.00
38 asdfj,9,4.00,1.00
39 lajks,9,2.00,1.00
40 asdfk,0,3.00,4.00
41 asdfk,1,3.00,3.00
42
43 Table: Data List
44 X,Y,A,B,Z,W
45 lasdj,1,1.00,3.00,.00,1.00
46 asdfk,0,3.00,4.00,.00,1.00
47 asdfj,2,4.00,2.00,1.00,2.00
48 asdfj,1,4.00,3.00,.00,1.00
49 asdfk,2,3.00,2.00,1.00,2.00
50 asdfj,9,4.00,1.00,4.00,3.00
51 lajks,9,2.00,1.00,4.00,3.00
52 asdfk,0,3.00,4.00,.00,1.00
53 asdfk,1,3.00,3.00,.00,1.00
54 ])
55 AT_CLEANUP
56
57
58
59 AT_SETUP([AUTORECODE long strings and check the value labels])
60 AT_DATA([ar.sps],
61   [data list notable list /s (a16) x *.
62 begin data.
63 widgets      1
64 thingummies  2
65 oojars       3
66 widgets      4
67 oojars       5
68 thingummies  6
69 oojimiflips  7
70 end data.
71
72 autorecode s into new.
73
74 list.
75
76 display dictionary.
77 ])
78
79 AT_CHECK([pspp -O format=csv ar.sps], [0],
80   [Table: Data List
81 s,x,new
82 widgets         ,1.00,4.00
83 thingummies     ,2.00,3.00
84 oojars          ,3.00,1.00
85 widgets         ,4.00,4.00
86 oojars          ,5.00,1.00
87 thingummies     ,6.00,3.00
88 oojimiflips     ,7.00,2.00
89
90 Variable,Description,,Position
91 s,Format: A16,,1
92 ,Measure: Nominal,,
93 ,Display Alignment: Left,,
94 ,Display Width: 16,,
95 x,Format: F8.2,,2
96 ,Measure: Scale,,
97 ,Display Alignment: Right,,
98 ,Display Width: 8,,
99 new,Format: F8.2,,3
100 ,Measure: Scale,,
101 ,Display Alignment: Right,,
102 ,Display Width: 8,,
103 ,1,oojars,
104 ,2,oojimiflips,
105 ,3,thingummies,
106 ,4,widgets,
107 ])
108
109 AT_CLEANUP
110
111
112 AT_SETUP([AUTORECODE group subcommand])
113 AT_DATA([ar-group.sps],
114 [data list notable list /x * y *.
115 begin data.
116 11 10
117 12 12 
118 13 15
119 14 11
120 15 12
121 16 18
122 end data.
123
124 autorecode 
125         x y into a b
126         /group.
127
128 list.
129 ])
130
131 AT_CHECK([pspp -O format=csv ar-group.sps], [0],
132 [Table: Data List
133 x,y,a,b
134 11.00,10.00,2.00,1.00
135 12.00,12.00,3.00,3.00
136 13.00,15.00,4.00,6.00
137 14.00,11.00,5.00,2.00
138 15.00,12.00,6.00,3.00
139 16.00,18.00,7.00,8.00
140 ])
141
142 AT_CLEANUP