1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313
|
AT_BANNER([MRSETS])
m4_define([DEFINE_MRSETS_DATA],
[DATA LIST NOTABLE /w x y z 1-4 a b c d 5-8 (a).
BEGIN DATA.
1234acbd
5678efgh
END DATA.])
m4_define([DEFINE_MRSETS],
[DEFINE_MRSETS_DATA
[VARIABLE LABEL
w 'duplicate variable label'
x 'Variable x'
z 'Duplicate variable label'.
VALUE LABELS
/w 1 'w value 1'
/y 1 'duplicate Value label'
/z 1 'duplicate value Label'
/a b c d 'a' 'burger' 'b' 'fries' 'c' 'shake' 'd' 'taco'.
ADD VALUE LABELS
/b 'b' 'Fries'
/c 'b' 'XXX'.
MRSETS
/MDGROUP NAME=$a
LABEL='First multiple dichotomy group'
CATEGORYLABELS=VARLABELS
VARIABLES=w x y z
VALUE=5
/MDGROUP NAME=$b
CATEGORYLABELS=COUNTEDVALUES
VARIABLES=z y
VALUE=123
/MDGROUP NAME=$c
LABELSOURCE=VARLABEL
CATEGORYLABELS=COUNTEDVALUES
VARIABLES=w x y z
VALUE=1
/MDGROUP NAME=$d
LABELSOURCE=VARLABEL
VARIABLES=a b c d
VALUE='c'
/MCGROUP NAME=$e
LABEL='First multiple category group'
VARIABLES=w x y z
/MCGROUP NAME=$f
VARIABLES=a b c d.
]])
m4_define([DEFINE_MRSETS_OUTPUT],
[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.
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.
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.
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.
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.
mrsets.sps:38: warning: MRSETS: MDGROUP subcommand for group $d specifies LABELSOURCE=VARLABEL but not CATEGORYLABELS=COUNTEDVALUES. Ignoring LABELSOURCE.
"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."
"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."
])
m4_define([MRSETS_DISPLAY_OUTPUT],
[Table: Multiple Response Sets
Name,Variables,Details
$a,"w
x
y
z
","Multiple dichotomy set
Label: First multiple dichotomy group
Label source: Provided by user
Counted value: 5
Category label source: Variable labels
"
$b,"z
y
","Multiple dichotomy set
Counted value: 123
Category label source: Value labels of counted value
"
$c,"w
x
y
z
","Multiple dichotomy set
Label: duplicate variable label
Label source: First variable label among variables
Counted value: 1
Category label source: Value labels of counted value
"
$d,"a
b
c
d
","Multiple dichotomy set
Counted value: `c'
Category label source: Variable labels
"
$e,"w
x
y
z
","Multiple category set
Label: First multiple category group
"
$f,"a
b
c
d
","Multiple category set
"
])
AT_SETUP([MRSETS add, display, delete])
AT_DATA([mrsets.sps],
[DEFINE_MRSETS
[MRSETS
/DISPLAY NAME=[$a]
/DISPLAY NAME=ALL
/DELETE NAME=[$c]
/DISPLAY NAME=ALL
/DELETE NAME=ALL
/DISPLAY NAME=ALL.
]])
AT_CHECK([pspp -O format=csv mrsets.sps], [0],
[DEFINE_MRSETS_OUTPUT
Table: Multiple Response Sets
Name,Variables,Details
$a,"w
x
y
z
","Multiple dichotomy set
Label: First multiple dichotomy group
Label source: Provided by user
Counted value: 5
Category label source: Variable labels
"
MRSETS_DISPLAY_OUTPUT
Table: Multiple Response Sets
Name,Variables,Details
$a,"w
x
y
z
","Multiple dichotomy set
Label: First multiple dichotomy group
Label source: Provided by user
Counted value: 5
Category label source: Variable labels
"
$b,"z
y
","Multiple dichotomy set
Counted value: 123
Category label source: Value labels of counted value
"
$d,"a
b
c
d
","Multiple dichotomy set
Counted value: `c'
Category label source: Variable labels
"
$e,"w
x
y
z
","Multiple category set
Label: First multiple category group
"
$f,"a
b
c
d
","Multiple category set
"
mrsets.sps:50: note: MRSETS: The active dataset dictionary does not contain any multiple response sets.
])
AT_CLEANUP
AT_SETUP([MRSETS read and write])
AT_DATA([mrsets.sps],
[DEFINE_MRSETS
SAVE OUTFILE='mrsets.sav'.
])
AT_CHECK([pspp -O format=csv mrsets.sps], [0], [DEFINE_MRSETS_OUTPUT])
AT_DATA([mrsets2.sps],
[GET FILE='mrsets.sav'.
MRSETS /DISPLAY NAME=ALL.
])
AT_CHECK([pspp -O format=csv mrsets2.sps], [0], [MRSETS_DISPLAY_OUTPUT],
[], [hd mrsets.sav])
AT_CLEANUP
AT_SETUP([MRSETS names must begin with $])
AT_DATA([mrsets.sps],
[DEFINE_MRSETS_DATA
MRSETS /MCGROUP NAME=x.
])
AT_CHECK([pspp -O format=csv mrsets.sps], [1],
[mrsets.sps:6: error: MRSETS: x is not a valid name for a multiple response set. Multiple response set names must begin with `$'.
])
AT_CLEANUP
AT_SETUP([MRSETS must have at least 2 variables])
AT_DATA([mrsets.sps],
[DEFINE_MRSETS_DATA
MRSETS /MCGROUP NAME=$x VARIABLES=a.
])
AT_CHECK([pspp -O format=csv mrsets.sps], [1],
["mrsets.sps:6: error: MRSETS: VARIABLES specified only variable a on MCGROUP, but at least two variables are required."
])
AT_CLEANUP
AT_SETUP([MRSETS does not allow noninteger VALUE])
AT_DATA([mrsets.sps],
[DEFINE_MRSETS_DATA
MRSETS /MDGROUP VALUE=1.5.
])
AT_CHECK([pspp -O format=csv mrsets.sps], [1],
[mrsets.sps:6: error: MRSETS: Numeric VALUE must be an integer.
])
AT_CLEANUP
AT_SETUP([MRSETS requires NAME to define a group])
AT_DATA([mrsets.sps],
[DEFINE_MRSETS_DATA
MRSETS /MCGROUP VARIABLES=a b c.
])
AT_CHECK([pspp -O format=csv mrsets.sps], [1],
[mrsets.sps:6.32: error: MRSETS: Syntax error at end of command: Required MCGROUP specification missing from NAME subcommand.
])
AT_CLEANUP
AT_SETUP([MRSETS requires VARIABLES to define a group])
AT_DATA([mrsets.sps],
[DEFINE_MRSETS_DATA
MRSETS /MCGROUP NAME=$Mcgroup.
])
AT_CHECK([pspp -O format=csv mrsets.sps], [1],
[mrsets.sps:6.30: error: MRSETS: Syntax error at end of command: Required MCGROUP specification missing from VARIABLES subcommand.
])
AT_CLEANUP
AT_SETUP([MRSETS variables must be same type])
AT_DATA([mrsets.sps],
[DEFINE_MRSETS_DATA
MRSETS /MCGROUP NAME=$mygroup VARIABLES=a b x y.
])
AT_CHECK([pspp -O format=csv mrsets.sps], [1],
[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.
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.
])
AT_CLEANUP
AT_SETUP([MRSETS variables and VALUE must be same type])
AT_DATA([mrsets.sps],
[DEFINE_MRSETS_DATA
MRSETS /MDGROUP NAME=$group1 VARIABLES=a b VALUE=1.
MRSETS /MDGROUP NAME=$group2 VARIABLES=x y VALUE='abc'.
])
AT_CHECK([pspp -O format=csv mrsets.sps], [1],
["mrsets.sps:6: error: MRSETS: MDGROUP subcommand for group $group1 specifies a string VALUE, but the variables specified for this group are numeric."
"mrsets.sps:7: error: MRSETS: MDGROUP subcommand for group $group2 specifies a string VALUE, but the variables specified for this group are numeric."
])
AT_CLEANUP
AT_SETUP([MRSETS VALUE must not be too wide])
AT_DATA([mrsets.sps],
[DEFINE_MRSETS_DATA
MRSETS /MDGROUP NAME=$group1 VARIABLES=a b VALUE='abc'.
])
AT_CHECK([pspp -O format=csv mrsets.sps], [1],
["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."
])
AT_CLEANUP
AT_SETUP([MRSETS LABEL and LABELSOURCE are exclusive])
AT_DATA([mrsets.sps],
[DEFINE_MRSETS_DATA
MRSETS /MDGROUP NAME=$group1 VARIABLES=a b VALUE='a'
LABEL='label' LABELSOURCE=VARLABEL.
])
AT_CHECK([pspp -O format=csv mrsets.sps], [0],
[mrsets.sps:7: warning: MRSETS: MDGROUP subcommand for group $group1 specifies LABELSOURCE=VARLABEL but not CATEGORYLABELS=COUNTEDVALUES. Ignoring LABELSOURCE.
])
AT_CLEANUP
AT_SETUP([MRSETS DISPLAY or DELETE unknown group])
AT_DATA([mrsets.sps],
[DEFINE_MRSETS_DATA
[MRSETS /DISPLAY NAME=[$x].
MRSETS /DELETE NAME=[$y].
]])
AT_CHECK([pspp -O format=csv mrsets.sps], [1],
[mrsets.sps:6: error: MRSETS: No multiple response set named $x.
mrsets.sps:7: error: MRSETS: No multiple response set named $y.
])
AT_CLEANUP
|