dnl PSPP - a program for statistical analysis.
dnl Copyright (C) 2017 Free Software Foundation, Inc.
-dnl
+dnl
dnl This program is free software: you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation, either version 3 of the License, or
dnl (at your option) any later version.
-dnl
+dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
-dnl
+dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
dnl
y (11 THRU 15)
z (11 THRU 16).
-AUTORECODE u v w x y z INTO a b c d e f.
+AUTORECODE u v w x y z INTO a b c d e f/print.
LIST.
DISPLAY VARIABLES/VARIABLES=a TO f.
])
AT_CHECK([pspp -O format=csv autorecode.sps], [0], [dnl
+Table: Recoding u into a.
+Old Value,New Value,Value Label
+12,1,12
+13,2,13
+14,3,14
+15,4,15
+16,5,16
+11,6,11
+
+Table: Recoding v into b.
+Old Value,New Value,Value Label
+13,1,13
+14,2,14
+15,3,15
+16,4,16
+11,5,11
+12,6,12
+
+Table: Recoding w into c.
+Old Value,New Value,Value Label
+14,1,14
+15,2,15
+16,3,16
+11,4,11
+12,5,12
+13,6,13
+
+Table: Recoding x into d.
+Old Value,New Value,Value Label
+15,1,15
+16,2,16
+11,3,11
+12,4,12
+13,5,13
+14,6,14
+
+Table: Recoding y into e.
+Old Value,New Value,Value Label
+16,1,16
+11,2,11
+12,3,12
+13,4,13
+14,5,14
+15,6,15
+
+Table: Recoding z into f.
+Old Value,New Value,Value Label
+11,1,11
+12,2,12
+13,3,13
+14,4,14
+15,5,15
+16,6,16
+
Table: Data List
u,v,w,x,y,z,a,b,c,d,e,f
11,11,11,11,11,11,6,5,4,3,2,1
missing values x('asdfk') y(9).
-autorecode x y into A B/descend.
+autorecode x y into A B/descend/print.
list.
compute Z=trunc(y/2).
AT_CHECK([pspp -O format=csv autorecode.sps], [0],
[Table: Reading 1 record from INLINE.
Variable,Record,Columns,Format
-X,1,1- 5,A5
-Y,1,7- 7,F1.0
+X,1,1-5,A5
+Y,1,7-7,F1.0
+
+Table: Recoding X into A.
+Old Value,New Value,Value Label
+lasdj,1,lasdj
+lajks,2,lajks
+asdfj,3,asdfj
+asdfk,4,asdfk
+
+Table: Recoding Y into B.
+Old Value,New Value,Value Label
+2,1,2
+1,2,1
+0,3,0
+9,4,9
Table: Data List
X,Y,A,B
])
AT_CLEANUP
-
-
AT_SETUP([AUTORECODE long strings and check the value labels])
AT_DATA([ar.sps],
[data list notable list /s (a16) x (f1.0).
variable labels s 'tracking my stuff'.
value labels /s 'thingummies' 'Funny sticky things'.
-autorecode s into new.
+autorecode s into new/print.
list.
])
AT_CHECK([pspp -O format=csv ar.sps], [0],
- [Table: Data List
+ [Table: Recoding s into new (tracking my stuff).
+Old Value,New Value,Value Label
+oojars,1,oojars
+oojimiflips,2,oojimiflips
+thingummies,3,Funny sticky things
+widgets,4,widgets
+
+Table: Data List
s,x,new
widgets,1,4
thingummies,2,3
oojimiflips,7,2
Table: Variables
-Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
-new,3,tracking my stuff,Scale,Input,8,Right,F1.0,F1.0,
+Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format
+new,3,tracking my stuff,Nominal,Input,8,Right,F1.0,F1.0
Table: Value Labels
Variable Value,,Label
[data list notable list /x y (f8.0).
begin data.
11 10
-12 12
+12 12
13 15
14 11
15 12
missing values y (12).
-autorecode
+autorecode
x y into a b
- /group.
+ /group
+ /print.
list.
display variables /variables=a b.
])
AT_CHECK([pspp -O format=csv ar-group.sps], [0],
-[Table: Data List
+[Table: Recoding grouped variables.
+Old Value,New Value,Value Label
+10,1,10
+11,2,11
+13,3,13
+14,4,14
+15,5,15
+16,6,16
+18,7,18
+12,8,12
+
+Table: Data List
x,y,a,b
11,10,2,1
12,12,8,8
autorecode x y into a b
- /group.
+ /group
+ /print.
delete variables x y.
])
AT_CHECK([pspp -O format=csv strings.sps], [0],
-[Table: Data List
+[Table: Recoding grouped variables.
+Old Value,New Value,Value Label
+,1,
+bert,2,bert
+charlie,3,charlie
+delta,4,delta
+echo,5,echo
+fred,6,fred
+nothing,7,nothing
+windows,8,windows
+
+Table: Data List
a,b
6,2
3,1
begin data.
one nine
two ten
-three eleven
+three eleven
four nought
end data.
-autorecode a b into x y
- /group.
+autorecode a b into x y
+ /group
+ /print.
list.
])
-AT_CHECK([pspp -O format=csv ar-strings.sps], [0],
-[dnl
+AT_CHECK([pspp -O format=csv ar-strings.sps], [0], [dnl
+Table: Recoding grouped variables.
+Old Value,New Value,Value Label
+eleven,1,eleven
+four,2,four
+nine,3,nine
+nought,4,nought
+one,5,one
+ten,6,ten
+three,7,three
+two,8,two
+
Table: Data List
a,b,x,y
one,nine,5,3
three 2 charliebrown
end data.
-autorecode variables x y z into a b c /blank=missing.
+autorecode variables x y z into a b c /blank=missing /print.
list a b c y.
])
AT_CHECK([pspp -O format=csv auto-blank.sps], [0], [dnl
+Table: Recoding x into a.
+Old Value,New Value,Value Label
+one,1,one
+three,2,three
+two,3,two
+
+Table: Recoding y into b.
+Old Value,New Value,Value Label
+2,1,2
+4,2,4
+
+Table: Recoding z into c.
+Old Value,New Value,Value Label
+charliebrown,1,charliebrown
+fred,2,fred
+
Table: Data List
a,b,c,y
1,1,2,2
temporary.
select if y > 1.
-autorecode x y into A B/descend.
+autorecode x y into A B/descend/print.
list.
])
-AT_CHECK([pspp -O format=csv autorecode.sps], [0],
- [Table: Reading 1 record from INLINE.
+AT_CHECK([pspp -O format=csv autorecode.sps], [0], [dnl
+Table: Reading 1 record from INLINE.
Variable,Record,Columns,Format
-X,1,1- 5,A5
-Y,1,7- 7,F1.0
+X,1,1-5,A5
+Y,1,7-7,F1.0
+
+Table: Recoding X into A.
+Old Value,New Value,Value Label
+lajks,1,lajks
+asdfk,2,asdfk
+asdfj,3,asdfj
+
+Table: Recoding Y into B.
+Old Value,New Value,Value Label
+9,1,9
+2,2,2
Table: Data List
X,Y,A,B
8
end data.
-autorecode x /into y.
+autorecode x /into y /print.
list.
])
AT_CHECK([pspp -O format=csv autorecode.sps], [0],
-[Table: Data List
+[Table: Recoding x into y.
+Old Value,New Value,Value Label
+-901,1,-901
+1,2,1
+4,3,4
+8,4,8
+99,5,99
+
+Table: Data List
x,y
1,2
8,4
8,4
])
AT_CLEANUP
+
+
+AT_SETUP([AUTORECODE with /BLANK without specifier])
+
+AT_DATA([autorecode.sps], [data list notable list /x (a18).
+begin data
+one
+two
+three
+end data.
+
+* /BLANK should be either =MISSING or =VALID
+autorecode x /into y
+ /blank
+
+execute.
+])
+
+AT_CHECK([pspp -O format=csv autorecode.sps], [1], [ignore])
+
+AT_CLEANUP