1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 Free Software Foundation, Inc.
4 dnl This program is free software: you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation, either version 3 of the License, or
7 dnl (at your option) any later version.
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 dnl GNU General Public License for more details.
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
16 dnl AT_BANNER([AUTORECODE procedure])
18 AT_SETUP([AUTORECODE numbers and short strings])
19 AT_DATA([autorecode.sps],
20 [data list /X 1-5(a) Y 7.
33 autorecode x y into A B/descend.
40 AT_CHECK([pspp -O format=csv autorecode.sps], [0],
41 [Table: Reading 1 record from INLINE.
42 Variable,Record,Columns,Format
60 lasdj,1,1.00,3.00,.00,1.00
61 asdfk,0,3.00,4.00,.00,1.00
62 asdfj,2,4.00,2.00,1.00,2.00
63 asdfj,1,4.00,3.00,.00,1.00
64 asdfk,2,3.00,2.00,1.00,2.00
65 asdfj,9,4.00,1.00,4.00,3.00
66 lajks,9,2.00,1.00,4.00,3.00
67 asdfk,0,3.00,4.00,.00,1.00
68 asdfk,1,3.00,3.00,.00,1.00
74 AT_SETUP([AUTORECODE long strings and check the value labels])
76 [data list notable list /s (a16) x *.
87 autorecode s into new.
94 AT_CHECK([pspp -O format=csv ar.sps], [0],
98 thingummies ,2.00,3.00
102 thingummies ,6.00,3.00
103 oojimiflips ,7.00,2.00
105 Variable,Description,Position
120 AT_SETUP([AUTORECODE group subcommand])
121 AT_DATA([ar-group.sps],
122 [data list notable list /x * y *.
139 AT_CHECK([pspp -O format=csv ar-group.sps], [0],
142 11.00,10.00,2.00,1.00
143 12.00,12.00,3.00,3.00
144 13.00,15.00,4.00,6.00
145 14.00,11.00,5.00,2.00
146 15.00,12.00,6.00,3.00
147 16.00,18.00,7.00,8.00
154 AT_SETUP([AUTORECODE group - string variables])
155 AT_DATA([strings.sps],
156 [data list notable list /x (a8) y (a16).
166 autorecode x y into a b
169 delete variables x y.
175 AT_CHECK([pspp -O format=csv strings.sps], [0],
188 dnl Tests for a crash which happened when the /GROUP subcommand
189 dnl appeared with string variables of different widths.
190 AT_SETUP([AUTORECODE group vs. strings])
191 AT_DATA([ar-strings.sps],
192 [data list notable list /a (a12) b (a6).
200 autorecode a b into x y
206 AT_CHECK([pspp -O format=csv ar-strings.sps], [0],
212 three ,eleven,7.00,1.00
213 four ,nought,2.00,4.00
220 AT_SETUP([AUTORECODE /blank])
222 AT_DATA([auto-blank.sps], [dnl
223 data list notable list /x (a8) y * z (a16).
232 autorecode variables x y z into a b c /blank=missing.
237 AT_CHECK([pspp -O format=csv auto-blank.sps], [0], [dnl
249 dnl AUTORECODE had a use-after-free error when TEMPORARY was in use.
251 AT_SETUP([AUTORECODE with TEMPORARY])
252 AT_DATA([autorecode.sps],
253 [data list /X 1-5(a) Y 7.
268 autorecode x y into A B/descend.
271 AT_CHECK([pspp -O format=csv autorecode.sps], [0],
272 [Table: Reading 1 record from INLINE.
273 Variable,Record,Columns,Format
292 dnl For compatibility, make sure that /INTO (with leading slash) is accepted
294 AT_SETUP([AUTORECODE with /INTO])
295 AT_DATA([autorecode.sps],
296 [data list list notable /x .
307 autorecode x /into y.
311 AT_CHECK([pspp -O format=csv autorecode.sps], [0],