fae03a50cb870b67b3c8fd6f6dc7d5a641e5e469
[pspp] / tests / language / dictionary / variable-display.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
17 AT_BANNER([variable display attributes])
18
19 AT_SETUP([variable display attribute commands])
20 AT_DATA([var-display.sps], [dnl
21 DATA LIST FREE /x y z.
22 VARIABLE ALIGNMENT x (LEFT)/y (RIGHT)/z (CENTER).
23 VARIABLE WIDTH x (10)/y (12)/z (14).
24 VARIABLE LEVEL x (SCALE)/y (ORDINAL)/z (NOMINAL).
25 VARIABLE ROLE /TARGET x /BOTH y /NONE z.
26 DISPLAY DICTIONARY.
27 ])
28 AT_CHECK([pspp -o pspp.csv var-display.sps])
29 AT_CHECK([cat pspp.csv], [0], [dnl
30 Table: Variables
31 Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format
32 x,1,Scale,Output,10,Left,F8.2,F8.2
33 y,2,Ordinal,Both,12,Right,F8.2,F8.2
34 z,3,Nominal,None,14,Center,F8.2,F8.2
35 ])
36 AT_CLEANUP
37
38
39 AT_BANNER([VARIABLE LABELS])
40
41 AT_SETUP([variable labels])
42
43 dnl The following test is to make sure the TVARS command works and that
44 dnl variables are displayed accordingly.
45 AT_DATA([var-labels.sps], [dnl
46 DATA LIST LIST NOTABLE /x * y *.
47 BEGIN DATA.
48 1 100
49 2 200
50 3 300
51 4 400
52 END DATA.
53
54 * While no labels have been set, the TVARS is irrelevant.
55 SET TVARS=NAMES.
56 DESCRIPTIVES ALL.
57
58 SET TVARS=LABELS.
59 DESCRIPTIVES ALL.
60
61 SET TVARS=BOTH.
62 DESCRIPTIVES ALL.
63
64 VARIABLE LABEL x 'foo' y 'bar'.
65
66 * Now, the TVARS setting should have effect
67
68 SET TVARS=NAMES.
69 DESCRIPTIVES ALL.
70
71 SET TVARS=LABELS.
72 DESCRIPTIVES ALL.
73
74 SET TVARS=BOTH.
75 DESCRIPTIVES ALL.
76 ])
77
78 AT_CHECK([pspp -o pspp.csv -o pspp.txt var-labels.sps])
79 AT_CHECK([cat pspp.csv], [0],[dnl
80 Table: Descriptive Statistics
81 ,N,Mean,Std Dev,Minimum,Maximum
82 x,4,2.50,1.29,1.00,4.00
83 y,4,250.00,129.10,100.00,400.00
84 Valid N (listwise),4,,,,
85 Missing N (listwise),0,,,,
86
87 Table: Descriptive Statistics
88 ,N,Mean,Std Dev,Minimum,Maximum
89 x,4,2.50,1.29,1.00,4.00
90 y,4,250.00,129.10,100.00,400.00
91 Valid N (listwise),4,,,,
92 Missing N (listwise),0,,,,
93
94 Table: Descriptive Statistics
95 ,N,Mean,Std Dev,Minimum,Maximum
96 x,4,2.50,1.29,1.00,4.00
97 y,4,250.00,129.10,100.00,400.00
98 Valid N (listwise),4,,,,
99 Missing N (listwise),0,,,,
100
101 Table: Descriptive Statistics
102 ,N,Mean,Std Dev,Minimum,Maximum
103 x,4,2.50,1.29,1.00,4.00
104 y,4,250.00,129.10,100.00,400.00
105 Valid N (listwise),4,,,,
106 Missing N (listwise),0,,,,
107
108 Table: Descriptive Statistics
109 ,N,Mean,Std Dev,Minimum,Maximum
110 foo,4,2.50,1.29,1.00,4.00
111 bar,4,250.00,129.10,100.00,400.00
112 Valid N (listwise),4,,,,
113 Missing N (listwise),0,,,,
114
115 Table: Descriptive Statistics
116 ,N,Mean,Std Dev,Minimum,Maximum
117 x foo,4,2.50,1.29,1.00,4.00
118 y bar,4,250.00,129.10,100.00,400.00
119 Valid N (listwise),4,,,,
120 Missing N (listwise),0,,,,
121 ])
122
123 AT_CLEANUP