79ae15545587fb07c6f145c4d61fb2a893801577
[pspp] / tests / language / xforms / count.at
1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 Free Software Foundation, Inc.
3 dnl 
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.
8 dnl 
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.
13 dnl 
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([COUNT])
17
18 AT_SETUP([COUNT -- numeric data])
19 AT_DATA([count.sps], [dnl
20 DATA LIST LIST /x y.
21 BEGIN DATA.
22 1 2
23 2 3
24 4 5
25 2 2
26 5 6
27 7 2
28 . 2
29 END DATA.
30
31 MISSING VALUES x(7)/y(3).
32
33 COUNT c=x y (2)/d=x y(7)/e=x y(missing)/f=x y(sysmis).
34
35 FORMATS ALL(F1).
36
37 LIST.
38 ])
39 AT_CHECK([pspp -O format=csv count.sps], [0], [dnl
40 Table: Reading free-form data from INLINE.
41 Variable,Format
42 x,F8.0
43 y,F8.0
44
45 Table: Data List
46 x,y,c,d,e,f
47 1,2,1,0,0,0
48 2,3,1,0,1,0
49 4,5,0,0,0,0
50 2,2,2,0,0,0
51 5,6,0,0,0,0
52 7,2,1,1,1,0
53 .,2,1,0,1,1
54 ])
55 AT_CLEANUP
56
57 AT_SETUP([COUNT -- string data])
58 AT_DATA([count.sps], [dnl
59 TITLE 'Test COUNT transformation'.
60
61 DATA LIST /v1 to v2 1-4(a).
62 BEGIN DATA.
63 1234
64 321 
65 2 13
66 4121
67 1104
68 03 4
69 0193
70 END DATA.
71 COUNT c=v1 to v2('2',' 4','1').
72 LIST.
73 ])
74 AT_CHECK([pspp -O format=csv count.sps], [0], [dnl
75 Title: Test COUNT transformation
76
77 Table: Reading 1 record from INLINE.
78 Variable,Record,Columns,Format
79 v1,1,1-  2,A2
80 v2,1,3-  4,A2
81
82 Table: Data List
83 v1,v2,c
84 12,34,.00
85 32,1 ,1.00
86 2 ,13,1.00
87 41,21,.00
88 11,04,.00
89 03,4,1.00
90 01,93,.00
91 ])
92 AT_CLEANUP