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/>.
17 AT_BANNER([AUTORECODE procedure])
19 AT_SETUP([AUTORECODE numbers and short strings])
20 AT_DATA([autorecode.sps],
21 [data list /X 1-5(a) Y 7.
34 autorecode x y into A B/descend.
41 AT_CHECK([pspp -O format=csv autorecode.sps], [0],
42 [Table: Reading 1 record from INLINE.
43 Variable,Record,Columns,Format
61 lasdj,1,1.00,3.00,.00,1.00
62 asdfk,0,3.00,4.00,.00,1.00
63 asdfj,2,4.00,2.00,1.00,2.00
64 asdfj,1,4.00,3.00,.00,1.00
65 asdfk,2,3.00,2.00,1.00,2.00
66 asdfj,9,4.00,1.00,4.00,3.00
67 lajks,9,2.00,1.00,4.00,3.00
68 asdfk,0,3.00,4.00,.00,1.00
69 asdfk,1,3.00,3.00,.00,1.00
75 AT_SETUP([AUTORECODE long strings and check the value labels])
77 [data list notable list /s (a16) x *.
88 autorecode s into new.
95 AT_CHECK([pspp -O format=csv ar.sps], [0],
103 thingummies,6.00,3.00
104 oojimiflips,7.00,2.00
107 Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
108 s,1,,Nominal,Input,16,Left,A16,A16,
109 x,2,,Scale,Input,8,Right,F8.2,F8.2,
110 new,3,,Scale,Input,8,Right,F8.2,F8.2,
113 Variable Value,,Label
123 AT_SETUP([AUTORECODE group subcommand])
124 AT_DATA([ar-group.sps],
125 [data list notable list /x * y *.
142 AT_CHECK([pspp -O format=csv ar-group.sps], [0],
145 11.00,10.00,2.00,1.00
146 12.00,12.00,3.00,3.00
147 13.00,15.00,4.00,6.00
148 14.00,11.00,5.00,2.00
149 15.00,12.00,6.00,3.00
150 16.00,18.00,7.00,8.00
157 AT_SETUP([AUTORECODE group - string variables])
158 AT_DATA([strings.sps],
159 [data list notable list /x (a8) y (a16).
169 autorecode x y into a b
172 delete variables x y.
178 AT_CHECK([pspp -O format=csv strings.sps], [0],
191 dnl Tests for a crash which happened when the /GROUP subcommand
192 dnl appeared with string variables of different widths.
193 AT_SETUP([AUTORECODE group vs. strings])
194 AT_DATA([ar-strings.sps],
195 [data list notable list /a (a12) b (a6).
203 autorecode a b into x y
209 AT_CHECK([pspp -O format=csv ar-strings.sps], [0],
215 three,eleven,7.00,1.00
216 four,nought,2.00,4.00
223 AT_SETUP([AUTORECODE /blank])
225 AT_DATA([auto-blank.sps], [dnl
226 data list notable list /x (a8) y * z (a16).
235 autorecode variables x y z into a b c /blank=missing.
240 AT_CHECK([pspp -O format=csv auto-blank.sps], [0], [dnl
252 dnl AUTORECODE had a use-after-free error when TEMPORARY was in use.
254 AT_SETUP([AUTORECODE with TEMPORARY])
255 AT_DATA([autorecode.sps],
256 [data list /X 1-5(a) Y 7.
271 autorecode x y into A B/descend.
274 AT_CHECK([pspp -O format=csv autorecode.sps], [0],
275 [Table: Reading 1 record from INLINE.
276 Variable,Record,Columns,Format
295 dnl For compatibility, make sure that /INTO (with leading slash) is accepted
297 AT_SETUP([AUTORECODE with /INTO])
298 AT_DATA([autorecode.sps],
299 [data list list notable /x .
310 autorecode x /into y.
314 AT_CHECK([pspp -O format=csv autorecode.sps], [0],