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/>.
19 m4_define([DEFINE_MRSETS_DATA],
20 [DATA LIST NOTABLE /w x y z 1-4 a b c d 5-8 (a).
26 m4_define([DEFINE_MRSETS],
30 w 'duplicate variable label'
32 z 'Duplicate variable label'.
35 /y 1 'duplicate Value label'
36 /z 1 'duplicate value Label'
37 /a b c d 'a' 'burger' 'b' 'fries' 'c' 'shake' 'd' 'taco'.
43 LABEL='First multiple dichotomy group'
44 CATEGORYLABELS=VARLABELS
48 CATEGORYLABELS=COUNTEDVALUES
53 CATEGORYLABELS=COUNTEDVALUES
61 LABEL='First multiple category group'
67 m4_define([DEFINE_MRSETS_OUTPUT],
68 [mrsets.sps:25: warning: MRSETS: Variables w and z specified as part of multiple dichotomy group $a have the same variable label. Categories represented by these variables will not be distinguishable in output.
70 mrsets.sps:29: warning: MRSETS: Variable z specified as part of multiple dichotomy group $b (which has CATEGORYLABELS=COUNTEDVALUES) has no value label for its counted value. This category will not be distinguishable in output.
72 mrsets.sps:29: warning: MRSETS: Variable y specified as part of multiple dichotomy group $b (which has CATEGORYLABELS=COUNTEDVALUES) has no value label for its counted value. This category will not be distinguishable in output.
74 mrsets.sps:34: warning: MRSETS: Variable x specified as part of multiple dichotomy group $c (which has CATEGORYLABELS=COUNTEDVALUES) has no value label for its counted value. This category will not be distinguishable in output.
76 mrsets.sps:34: warning: MRSETS: Variables y and z specified as part of multiple dichotomy group $c (which has CATEGORYLABELS=COUNTEDVALUES) have the same value label for the group's counted value. These categories will not be distinguishable in output.
78 mrsets.sps:38: warning: MRSETS: MDGROUP subcommand for group $d specifies LABELSOURCE=VARLABEL but not CATEGORYLABELS=COUNTEDVALUES. Ignoring LABELSOURCE.
80 "mrsets.sps:41: warning: MRSETS: Variables specified on MCGROUP should have the same categories, but w and y (and possibly others) in multiple category group $e have different value labels for value 1."
82 "mrsets.sps:42: warning: MRSETS: Variables specified on MCGROUP should have the same categories, but a and c (and possibly others) in multiple category group $f have different value labels for value b."
85 m4_define([MRSETS_DISPLAY_OUTPUT],
86 [Table: Multiple Response Sets
87 Name,Variables,Details
92 ","Multiple dichotomy set
93 Label: First multiple dichotomy group
94 Label source: Provided by user
96 Category label source: Variable labels
100 ","Multiple dichotomy set
102 Category label source: Value labels of counted value
108 ","Multiple dichotomy set
109 Label: duplicate variable label
110 Label source: First variable label among variables
112 Category label source: Value labels of counted value
118 ","Multiple dichotomy set
120 Category label source: Variable labels
126 ","Multiple category set
127 Label: First multiple category group
133 ","Multiple category set
137 AT_SETUP([MRSETS add, display, delete])
138 AT_DATA([mrsets.sps],
148 AT_CHECK([pspp -O format=csv mrsets.sps], [0],
149 [DEFINE_MRSETS_OUTPUT
150 Table: Multiple Response Sets
151 Name,Variables,Details
156 ","Multiple dichotomy set
157 Label: First multiple dichotomy group
158 Label source: Provided by user
160 Category label source: Variable labels
163 MRSETS_DISPLAY_OUTPUT
164 Table: Multiple Response Sets
165 Name,Variables,Details
170 ","Multiple dichotomy set
171 Label: First multiple dichotomy group
172 Label source: Provided by user
174 Category label source: Variable labels
178 ","Multiple dichotomy set
180 Category label source: Value labels of counted value
186 ","Multiple dichotomy set
188 Category label source: Variable labels
194 ","Multiple category set
195 Label: First multiple category group
201 ","Multiple category set
204 mrsets.sps:50: note: MRSETS: The active dataset dictionary does not contain any multiple response sets.
208 AT_SETUP([MRSETS read and write])
209 AT_DATA([mrsets.sps],
211 SAVE OUTFILE='mrsets.sav'.
213 AT_CHECK([pspp -O format=csv mrsets.sps], [0], [DEFINE_MRSETS_OUTPUT])
214 AT_DATA([mrsets2.sps],
215 [GET FILE='mrsets.sav'.
216 MRSETS /DISPLAY NAME=ALL.
218 AT_CHECK([pspp -O format=csv mrsets2.sps], [0], [MRSETS_DISPLAY_OUTPUT],
222 AT_SETUP([MRSETS names must begin with $])
223 AT_DATA([mrsets.sps],
225 MRSETS /MCGROUP NAME=x.
227 AT_CHECK([pspp -O format=csv mrsets.sps], [1],
228 [mrsets.sps:6: error: MRSETS: x is not a valid name for a multiple response set. Multiple response set names must begin with `$'.
232 AT_SETUP([MRSETS must have at least 2 variables])
233 AT_DATA([mrsets.sps],
235 MRSETS /MCGROUP NAME=$x VARIABLES=a.
237 AT_CHECK([pspp -O format=csv mrsets.sps], [1],
238 ["mrsets.sps:6: error: MRSETS: VARIABLES specified only variable a on MCGROUP, but at least two variables are required."
242 AT_SETUP([MRSETS does not allow noninteger VALUE])
243 AT_DATA([mrsets.sps],
245 MRSETS /MDGROUP VALUE=1.5.
247 AT_CHECK([pspp -O format=csv mrsets.sps], [1],
248 [mrsets.sps:6: error: MRSETS: Numeric VALUE must be an integer.
252 AT_SETUP([MRSETS requires NAME to define a group])
253 AT_DATA([mrsets.sps],
255 MRSETS /MCGROUP VARIABLES=a b c.
257 AT_CHECK([pspp -O format=csv mrsets.sps], [1],
258 [mrsets.sps:6.32: error: MRSETS: Syntax error at end of command: Required MCGROUP specification missing from NAME subcommand.
262 AT_SETUP([MRSETS requires VARIABLES to define a group])
263 AT_DATA([mrsets.sps],
265 MRSETS /MCGROUP NAME=$Mcgroup.
267 AT_CHECK([pspp -O format=csv mrsets.sps], [1],
268 [mrsets.sps:6.30: error: MRSETS: Syntax error at end of command: Required MCGROUP specification missing from VARIABLES subcommand.
272 AT_SETUP([MRSETS variables must be same type])
273 AT_DATA([mrsets.sps],
275 MRSETS /MCGROUP NAME=$mygroup VARIABLES=a b x y.
277 AT_CHECK([pspp -O format=csv mrsets.sps], [1],
278 [mrsets.sps:6: error: MRSETS: a and x are not the same type. All variables in this variable list must be of the same type. x will be omitted from the list.
280 mrsets.sps:6: error: MRSETS: a and y are not the same type. All variables in this variable list must be of the same type. y will be omitted from the list.
284 AT_SETUP([MRSETS variables and VALUE must be same type])
285 AT_DATA([mrsets.sps],
287 MRSETS /MDGROUP NAME=$group1 VARIABLES=a b VALUE=1.
288 MRSETS /MDGROUP NAME=$group2 VARIABLES=x y VALUE='abc'.
290 AT_CHECK([pspp -O format=csv mrsets.sps], [1],
291 ["mrsets.sps:6: error: MRSETS: MDGROUP subcommand for group $group1 specifies a string VALUE, but the variables specified for this group are numeric."
293 "mrsets.sps:7: error: MRSETS: MDGROUP subcommand for group $group2 specifies a string VALUE, but the variables specified for this group are numeric."
297 AT_SETUP([MRSETS VALUE must not be too wide])
298 AT_DATA([mrsets.sps],
300 MRSETS /MDGROUP NAME=$group1 VARIABLES=a b VALUE='abc'.
302 AT_CHECK([pspp -O format=csv mrsets.sps], [1],
303 ["mrsets.sps:6: error: MRSETS: VALUE string on MDGROUP subcommand for group $group1 is 3 bytes long, but it must be no longer than the narrowest variable in the group, which is a with a width of 1 bytes."
307 AT_SETUP([MRSETS LABEL and LABELSOURCE are exclusive])
308 AT_DATA([mrsets.sps],
310 MRSETS /MDGROUP NAME=$group1 VARIABLES=a b VALUE='a'
311 LABEL='label' LABELSOURCE=VARLABEL.
313 AT_CHECK([pspp -O format=csv mrsets.sps], [0],
314 [mrsets.sps:7: warning: MRSETS: MDGROUP subcommand for group $group1 specifies LABELSOURCE=VARLABEL but not CATEGORYLABELS=COUNTEDVALUES. Ignoring LABELSOURCE.
318 AT_SETUP([MRSETS DISPLAY or DELETE unknown group])
319 AT_DATA([mrsets.sps],
321 [MRSETS /DISPLAY NAME=[$x].
322 MRSETS /DELETE NAME=[$y].
324 AT_CHECK([pspp -O format=csv mrsets.sps], [1],
325 [mrsets.sps:6: error: MRSETS: No multiple response set named $x.
327 mrsets.sps:7: error: MRSETS: No multiple response set named $y.