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], [dnl
68 "mrsets.sps:23.16-23.22: 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.
69 23 | VARIABLES=w x y z
72 "mrsets.sps:27.16-27.18: 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.
76 "mrsets.sps:27.16-27.18: 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.
80 "mrsets.sps:32.16-32.22: 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.
81 32 | VARIABLES=w x y z
84 "mrsets.sps:32.16-32.22: 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.
85 32 | VARIABLES=w x y z
88 "mrsets.sps:35.6-35.25: warning: MRSETS: MDGROUP subcommand for group $d specifies LABELSOURCE=VARLABEL but not CATEGORYLABELS=COUNTEDVALUES. Ignoring LABELSOURCE.
89 35 | LABELSOURCE=VARLABEL
90 | ^~~~~~~~~~~~~~~~~~~~"
92 "mrsets.sps:40.16-40.22: 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.
93 40 | VARIABLES=w x y z
96 "mrsets.sps:42.16-42.22: 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.
97 42 | VARIABLES=a b c d.
101 m4_define([MRSETS_DISPLAY_OUTPUT], [dnl
102 Table: Multiple Response Sets
103 Name,Label,Encoding,Counted Value,Member Variables
104 $a,First multiple dichotomy group,Dichotomies,5,"w
108 $b,,Dichotomies,123,"z
110 $c,duplicate variable label,Dichotomies,1,"w
118 $e,First multiple category group,Categories,,"w
128 AT_SETUP([MRSETS add, display, delete])
129 AT_DATA([mrsets.sps],
139 AT_CHECK([pspp -o - -O format=csv -o mrsets.csv -o mrsets.txt mrsets.sps], [0],
140 [DEFINE_MRSETS_OUTPUT
141 Table: Multiple Response Sets
142 Name,Label,Encoding,Counted Value,Member Variables
143 $a,First multiple dichotomy group,Dichotomies,5,"w
148 Table: Multiple Response Sets
149 Name,Label,Encoding,Counted Value,Member Variables
150 $a,First multiple dichotomy group,Dichotomies,5,"w
154 $b,,Dichotomies,123,"z
156 $c,duplicate variable label,Dichotomies,1,"w
164 $e,First multiple category group,Categories,,"w
173 Table: Multiple Response Sets
174 Name,Label,Encoding,Counted Value,Member Variables
175 $a,First multiple dichotomy group,Dichotomies,5,"w
179 $b,,Dichotomies,123,"z
185 $e,First multiple category group,Categories,,"w
194 "mrsets.sps:50.19-50.21: note: MRSETS: The active dataset dictionary does not contain any multiple response sets.
195 50 | /DISPLAY NAME=ALL.
200 AT_SETUP([MRSETS read and write])
201 AT_DATA([mrsets.sps],
203 SAVE OUTFILE='mrsets.sav'.
205 AT_CHECK([pspp -O format=csv mrsets.sps], [0], [DEFINE_MRSETS_OUTPUT])
206 AT_DATA([mrsets2.sps],
207 [GET FILE='mrsets.sav'.
208 MRSETS /DISPLAY NAME=ALL.
210 AT_CHECK([pspp -O format=csv mrsets2.sps], [0], [MRSETS_DISPLAY_OUTPUT],
214 AT_SETUP([MRSETS syntax errors])
215 AT_DATA([mrsets.sps], [dnl
216 DATA LIST NOTABLE /w x y z 1-4 a b c d 5-8 (a).
222 w 'duplicate variable label'
224 z 'Duplicate variable label'.
227 /y 1 'duplicate Value label'
228 /z 1 'duplicate value Label'
229 /a b c d 'a' 'burger' 'b' 'fries' 'c' 'shake' 'd' 'taco'.
234 MRSETS /MDGROUP NAME **.
235 MRSETS /MDGROUP NAME=**.
236 MRSETS /MDGROUP NAME=x.
237 MRSETS /MDGROUP VARIABLES **.
238 MRSETS /MDGROUP VARIABLES=**.
239 MRSETS /MDGROUP VARIABLES=a.
240 MRSETS /MDGROUP LABEL **.
241 MRSETS /MDGROUP LABEL=**.
242 MRSETS /MDGROUP LABELSOURCE=**.
243 MRSETS /MDGROUP VALUE **.
244 MRSETS /MDGROUP VALUE=1.5.
245 MRSETS /MDGROUP VALUE=**.
246 MRSETS /MDGROUP CATEGORYLABELS **.
247 MRSETS /MDGROUP CATEGORYLABELS=**.
251 MRSETS /MDGROUP NAME=[$x].
252 MRSETS /MDGROUP NAME=[$x] VARIABLES=a b VALUE=1.
253 MRSETS /MDGROUP NAME=[$x] VARIABLES=x y VALUE='a'.
254 MRSETS /MDGROUP NAME=[$x] VARIABLES=a b VALUE='xyzzy'.
255 MRSETS /MDGROUP NAME=[$x] VARIABLES=a b VALUE='y' LABELSOURCE=VARLABEL.
256 MRSETS /MDGROUP NAME=[$x] VARIABLES=w z VALUE=1 CATEGORYLABELS=VARLABELS.
257 MRSETS /MDGROUP NAME=[$x] VARIABLES=a b VALUE='y'
258 LABELSOURCE=VARLABEL CATEGORYLABELS=COUNTEDVALUES
260 MRSETS /MDGROUP NAME=[$x] VARIABLES=y z VALUE=1
261 LABELSOURCE=VARLABEL CATEGORYLABELS=COUNTEDVALUES.
262 MRSETS /MCGROUP NAME=[$x] VARIABLES=w x y z.
265 MRSETS /DELETE NAME**.
266 MRSETS /DELETE NAME=[[**]].
267 MRSETS /DELETE NAME=[[$x]].
268 MRSETS /DELETE NAME=**.
270 MRSETS /DISPLAY NAME=ALL.
272 AT_CHECK([pspp -O format=csv mrsets.sps], [1], [dnl
273 "mrsets.sps:19.22-19.23: error: MRSETS: Syntax error expecting `='.
274 19 | MRSETS /MDGROUP NAME **.
277 "mrsets.sps:20.22-20.23: error: MRSETS: Syntax error expecting identifier.
278 20 | MRSETS /MDGROUP NAME=**.
281 "mrsets.sps:21.22: error: MRSETS: x is not a valid name for a multiple response set. Multiple response set names must begin with `$'.
282 21 | MRSETS /MDGROUP NAME=x.
285 "mrsets.sps:22.27-22.28: error: MRSETS: Syntax error expecting `='.
286 22 | MRSETS /MDGROUP VARIABLES **.
289 "mrsets.sps:23.27-23.28: error: MRSETS: Syntax error expecting variable name.
290 23 | MRSETS /MDGROUP VARIABLES=**.
293 "mrsets.sps:24.27: error: MRSETS: At least two variables are required.
294 24 | MRSETS /MDGROUP VARIABLES=a.
297 "mrsets.sps:25.23-25.24: error: MRSETS: Syntax error expecting `='.
298 25 | MRSETS /MDGROUP LABEL **.
301 "mrsets.sps:26.23-26.24: error: MRSETS: Syntax error expecting string.
302 26 | MRSETS /MDGROUP LABEL=**.
305 "mrsets.sps:27.28-27.30: error: MRSETS: Syntax error expecting `=VARLABEL'.
306 27 | MRSETS /MDGROUP LABELSOURCE=**.
309 "mrsets.sps:28.23-28.24: error: MRSETS: Syntax error expecting `='.
310 28 | MRSETS /MDGROUP VALUE **.
313 "mrsets.sps:29.23-29.25: error: MRSETS: Numeric VALUE must be an integer.
314 29 | MRSETS /MDGROUP VALUE=1.5.
317 "mrsets.sps:30.23-30.24: error: MRSETS: Syntax error expecting integer or string.
318 30 | MRSETS /MDGROUP VALUE=**.
321 "mrsets.sps:31.32-31.33: error: MRSETS: Syntax error expecting `='.
322 31 | MRSETS /MDGROUP CATEGORYLABELS **.
325 "mrsets.sps:32.32-32.33: error: MRSETS: Syntax error expecting VARLABELS or COUNTEDVALUES.
326 32 | MRSETS /MDGROUP CATEGORYLABELS=**.
329 "mrsets.sps:33.17-33.18: error: MRSETS: Syntax error expecting NAME, VARIABLES, LABEL, LABELSOURCE, VALUE, or CATEGORYLABELS.
330 33 | MRSETS /MDGROUP **.
333 "mrsets.sps:34.17-34.18: error: MRSETS: Syntax error expecting NAME, VARIABLES, or LABEL.
334 34 | MRSETS /MCGROUP **.
337 "mrsets.sps:35.16: error: MRSETS: Required NAME specification missing from MDGROUP subcommand.
338 35 | MRSETS /MDGROUP.
341 "mrsets.sps:36.24: error: MRSETS: Required VARIABLES specification missing from MDGROUP subcommand.
342 36 | MRSETS /MDGROUP NAME=$x.
345 mrsets.sps:37: error: MRSETS: VARIABLES and VALUE must have the same type.
347 "mrsets.sps:37.35-37.37: note: MRSETS: These are string variables.
348 37 | MRSETS /MDGROUP NAME=$x VARIABLES=a b VALUE=1.
351 "mrsets.sps:37.45: note: MRSETS: This is a numeric value.
352 37 | MRSETS /MDGROUP NAME=$x VARIABLES=a b VALUE=1.
355 mrsets.sps:38: error: MRSETS: VARIABLES and VALUE must have the same type.
357 "mrsets.sps:38.35-38.37: note: MRSETS: These are numeric variables.
358 38 | MRSETS /MDGROUP NAME=$x VARIABLES=x y VALUE='a'.
361 "mrsets.sps:38.45-38.47: note: MRSETS: This is a string value.
362 38 | MRSETS /MDGROUP NAME=$x VARIABLES=x y VALUE='a'.
365 mrsets.sps:39: error: MRSETS: The VALUE string must be no longer than the narrowest variable in the group.
367 "mrsets.sps:39.45-39.51: note: MRSETS: The VALUE string is 5 bytes long.
368 39 | MRSETS /MDGROUP NAME=$x VARIABLES=a b VALUE='xyzzy'.
371 "mrsets.sps:39.35-39.37: note: MRSETS: Variable a has a width of 1 bytes.
372 39 | MRSETS /MDGROUP NAME=$x VARIABLES=a b VALUE='xyzzy'.
375 "mrsets.sps:40.49-40.68: warning: MRSETS: MDGROUP subcommand for group $x specifies LABELSOURCE=VARLABEL but not CATEGORYLABELS=COUNTEDVALUES. Ignoring LABELSOURCE.
376 40 | MRSETS /MDGROUP NAME=$x VARIABLES=a b VALUE='y' LABELSOURCE=VARLABEL.
377 | ^~~~~~~~~~~~~~~~~~~~"
379 "mrsets.sps:41.35-41.37: warning: MRSETS: Variables w and z specified as part of multiple dichotomy group $x have the same variable label. Categories represented by these variables will not be distinguishable in output.
380 41 | MRSETS /MDGROUP NAME=$x VARIABLES=w z VALUE=1 CATEGORYLABELS=VARLABELS.
383 "mrsets.sps:44: warning: MRSETS: MDGROUP subcommand for group $x specifies both LABEL and LABELSOURCE, but only one of these subcommands may be used at a time. Ignoring LABELSOURCE."
385 "mrsets.sps:44.3-44.13: note: MRSETS: Here is the LABEL setting.
389 "mrsets.sps:43.3-43.22: note: MRSETS: Here is the LABELSOURCE setting.
390 43 | LABELSOURCE=VARLABEL CATEGORYLABELS=COUNTEDVALUES
391 | ^~~~~~~~~~~~~~~~~~~~"
393 "mrsets.sps:42.35-42.37: warning: MRSETS: Variable a specified as part of multiple dichotomy group $x (which has CATEGORYLABELS=COUNTEDVALUES) has no value label for its counted value. This category will not be distinguishable in output.
394 42 | MRSETS /MDGROUP NAME=$x VARIABLES=a b VALUE='y'
397 "mrsets.sps:42.35-42.37: warning: MRSETS: Variable b specified as part of multiple dichotomy group $x (which has CATEGORYLABELS=COUNTEDVALUES) has no value label for its counted value. This category will not be distinguishable in output.
398 42 | MRSETS /MDGROUP NAME=$x VARIABLES=a b VALUE='y'
401 "mrsets.sps:45.35-45.37: warning: MRSETS: Variables y and z specified as part of multiple dichotomy group $x (which has CATEGORYLABELS=COUNTEDVALUES) have the same value label for the group's counted value. These categories will not be distinguishable in output.
402 45 | MRSETS /MDGROUP NAME=$x VARIABLES=y z VALUE=1
405 "mrsets.sps:47.35-47.41: warning: MRSETS: Variables specified on MCGROUP should have the same categories, but w and y (and possibly others) in multiple category group $x have different value labels for value 1.
406 47 | MRSETS /MCGROUP NAME=$x VARIABLES=w x y z.
409 "mrsets.sps:49.16-49.17: error: MRSETS: Syntax error expecting `NAME='.
410 49 | MRSETS /DELETE **.
413 "mrsets.sps:50.16-50.21: error: MRSETS: Syntax error expecting `NAME='.
414 50 | MRSETS /DELETE NAME**.
417 "mrsets.sps:51.22-51.23: error: MRSETS: Syntax error expecting identifier.
418 51 | MRSETS /DELETE NAME=[[**]].
421 "mrsets.sps:53.21-53.22: error: MRSETS: Syntax error expecting `@<:@' or ALL.
422 53 | MRSETS /DELETE NAME=**.
425 "mrsets.sps:55.22-55.24: note: MRSETS: The active dataset dictionary does not contain any multiple response sets.
426 55 | MRSETS /DISPLAY NAME=ALL.