3 m4_define([DEFINE_MRSETS_DATA],
4 [DATA LIST NOTABLE /w x y z 1-4 a b c d 5-8 (a).
10 m4_define([DEFINE_MRSETS],
14 w 'duplicate variable label'
16 z 'Duplicate variable label'.
19 /y 1 'duplicate Value label'
20 /z 1 'duplicate value Label'
21 /a b c d 'a' 'burger' 'b' 'fries' 'c' 'shake' 'd' 'taco'.
27 LABEL='First multiple dichotomy group'
28 CATEGORYLABELS=VARLABELS
32 CATEGORYLABELS=COUNTEDVALUES
37 CATEGORYLABELS=COUNTEDVALUES
45 LABEL='First multiple category group'
51 m4_define([DEFINE_MRSETS_OUTPUT],
52 [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.
54 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.
56 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.
58 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.
60 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 the group's counted value. These categories will not be distinguishable in output.
62 mrsets.sps:38: warning: MRSETS: MDGROUP subcommand for group $d specifies LABELSOURCE=VARLABEL but not CATEGORYLABELS=COUNTEDVALUES. Ignoring LABELSOURCE.
64 "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."
66 "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."
69 m4_define([MRSETS_DISPLAY_OUTPUT],
70 [Table: Multiple Response Sets
71 Name,Variables,Details
76 ","Multiple dichotomy set
77 Label: First multiple dichotomy group
78 Label source: Provided by user
80 Category label source: Variable labels
84 ","Multiple dichotomy set
86 Category label source: Value labels of counted value
92 ","Multiple dichotomy set
93 Label: duplicate variable label
94 Label source: First variable label among variables
96 Category label source: Value labels of counted value
102 ","Multiple dichotomy set
104 Category label source: Variable labels
110 ","Multiple category set
111 Label: First multiple category group
117 ","Multiple category set
121 AT_SETUP([MRSETS add, display, delete])
122 AT_DATA([mrsets.sps],
132 AT_CHECK([pspp -O format=csv mrsets.sps], [0],
133 [DEFINE_MRSETS_OUTPUT
134 Table: Multiple Response Sets
135 Name,Variables,Details
140 ","Multiple dichotomy set
141 Label: First multiple dichotomy group
142 Label source: Provided by user
144 Category label source: Variable labels
147 MRSETS_DISPLAY_OUTPUT
148 Table: Multiple Response Sets
149 Name,Variables,Details
154 ","Multiple dichotomy set
155 Label: First multiple dichotomy group
156 Label source: Provided by user
158 Category label source: Variable labels
162 ","Multiple dichotomy set
164 Category label source: Value labels of counted value
170 ","Multiple dichotomy set
172 Category label source: Variable labels
178 ","Multiple category set
179 Label: First multiple category group
185 ","Multiple category set
188 mrsets.sps:50: note: MRSETS: The active file dictionary does not contain any multiple response sets.
192 AT_SETUP([MRSETS read and write])
193 AT_DATA([mrsets.sps],
195 SAVE OUTFILE='mrsets.sav'.
197 AT_CHECK([pspp -O format=csv mrsets.sps], [0], [DEFINE_MRSETS_OUTPUT])
198 AT_DATA([mrsets2.sps],
199 [GET FILE='mrsets.sav'.
200 MRSETS /DISPLAY NAME=ALL.
202 AT_CHECK([pspp -O format=csv mrsets2.sps], [0], [MRSETS_DISPLAY_OUTPUT],
206 AT_SETUP([MRSETS names must begin with $])
207 AT_DATA([mrsets.sps],
209 MRSETS /MCGROUP NAME=x.
211 AT_CHECK([pspp -O format=csv mrsets.sps], [1],
212 [mrsets.sps:6: error: MRSETS: x is not a valid name for a multiple response set. Multiple response set names must begin with `$'.
216 AT_SETUP([MRSETS must have at least 2 variables])
217 AT_DATA([mrsets.sps],
219 MRSETS /MCGROUP NAME=$x VARIABLES=a.
221 AT_CHECK([pspp -O format=csv mrsets.sps], [1],
222 ["mrsets.sps:6: error: MRSETS: VARIABLES specified only variable a on MCGROUP, but at least two variables are required."
226 AT_SETUP([MRSETS does not allow noninteger VALUE])
227 AT_DATA([mrsets.sps],
229 MRSETS /MDGROUP VALUE=1.5.
231 AT_CHECK([pspp -O format=csv mrsets.sps], [1],
232 [mrsets.sps:6: error: MRSETS: Numeric VALUE must be an integer.
236 AT_SETUP([MRSETS requires NAME to define a group])
237 AT_DATA([mrsets.sps],
239 MRSETS /MCGROUP VARIABLES=a b c.
241 AT_CHECK([pspp -O format=csv mrsets.sps], [1],
242 [mrsets.sps:6: error: MRSETS: Required NAME specification missing from MCGROUP subcommand.
246 AT_SETUP([MRSETS requires VARIABLES to define a group])
247 AT_DATA([mrsets.sps],
249 MRSETS /MCGROUP NAME=$Mcgroup.
251 AT_CHECK([pspp -O format=csv mrsets.sps], [1],
252 [mrsets.sps:6: error: MRSETS: Required VARIABLES specification missing from MCGROUP subcommand.
256 AT_SETUP([MRSETS variables must be same type])
257 AT_DATA([mrsets.sps],
259 MRSETS /MCGROUP NAME=$mygroup VARIABLES=a b x y.
261 AT_CHECK([pspp -O format=csv mrsets.sps], [1],
262 [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.
264 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.
268 AT_SETUP([MRSETS variables and VALUE must be same type])
269 AT_DATA([mrsets.sps],
271 MRSETS /MDGROUP NAME=$group1 VARIABLES=a b VALUE=1.
272 MRSETS /MDGROUP NAME=$group2 VARIABLES=x y VALUE='abc'.
274 AT_CHECK([pspp -O format=csv mrsets.sps], [1],
275 ["mrsets.sps:6: error: MRSETS: MDGROUP subcommand for group $group1 specifies a string VALUE, but the variables specified for this group are numeric."
277 "mrsets.sps:7: error: MRSETS: MDGROUP subcommand for group $group2 specifies a string VALUE, but the variables specified for this group are numeric."
281 AT_SETUP([MRSETS VALUE must not be too wide])
282 AT_DATA([mrsets.sps],
284 MRSETS /MDGROUP NAME=$group1 VARIABLES=a b VALUE='abc'.
286 AT_CHECK([pspp -O format=csv mrsets.sps], [1],
287 ["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."
291 AT_SETUP([MRSETS LABEL and LABELSOURCE are exclusive])
292 AT_DATA([mrsets.sps],
294 MRSETS /MDGROUP NAME=$group1 VARIABLES=a b VALUE='a'
295 LABEL='label' LABELSOURCE=VARLABEL.
297 AT_CHECK([pspp -O format=csv mrsets.sps], [0],
298 [mrsets.sps:7: warning: MRSETS: MDGROUP subcommand for group $group1 specifies LABELSOURCE=VARLABEL but not CATEGORYLABELS=COUNTEDVALUES. Ignoring LABELSOURCE.
302 AT_SETUP([MRSETS DISPLAY or DELETE unknown group])
303 AT_DATA([mrsets.sps],
305 [MRSETS /DISPLAY NAME=[$x].
306 MRSETS /DELETE NAME=[$y].
308 AT_CHECK([pspp -O format=csv mrsets.sps], [1],
309 [mrsets.sps:6: error: MRSETS: No multiple response set named $x.
311 mrsets.sps:7: error: MRSETS: No multiple response set named $y.