29 |
@cindex language, tokens |
@cindex language, tokens |
30 |
@cindex tokens |
@cindex tokens |
31 |
@cindex lexical analysis |
@cindex lexical analysis |
|
@cindex lexemes |
|
32 |
|
|
33 |
PSPP divides most syntax file lines into series of short chunks |
PSPP divides most syntax file lines into series of short chunks |
34 |
called @dfn{tokens}, @dfn{lexical elements}, or @dfn{lexemes}. These |
called @dfn{tokens}. |
35 |
tokens are then grouped to form commands, each of which tells |
Tokens are then grouped to form commands, each of which tells |
36 |
PSPP to take some action---read in data, write out data, perform |
PSPP to take some action---read in data, write out data, perform |
37 |
a statistical procedure, etc. The process of dividing input into tokens |
a statistical procedure, etc. Each type of token is |
|
is @dfn{tokenization}, or @dfn{lexical analysis}. Each type of token is |
|
38 |
described below. |
described below. |
39 |
|
|
|
@cindex delimiters |
|
|
@cindex whitespace |
|
|
Tokens must be separated from each other by @dfn{delimiters}. |
|
|
Delimiters include whitespace (spaces, tabs, carriage returns, line |
|
|
feeds, vertical tabs), punctuation (commas, forward slashes, etc.), and |
|
|
operators (plus, minus, times, divide, etc.) Note that while whitespace |
|
|
only separates tokens, other delimiters are tokens in themselves. |
|
|
|
|
40 |
@table @strong |
@table @strong |
41 |
@cindex identifiers |
@cindex identifiers |
42 |
@item Identifiers |
@item Identifiers |
43 |
Identifiers are names that specify variable names, commands, or command |
Identifiers are names that typically specify variables, commands, or |
44 |
details. |
subcommands. The first character in an identifier must be a letter, |
45 |
|
@samp{#}, or @samp{@@}. The remaining characters in the identifier |
46 |
@itemize @bullet |
must be letters, digits, or one of the following special characters: |
|
@item |
|
|
The first character in an identifier must be a letter, @samp{#}, or |
|
|
@samp{@@}. Some system identifiers begin with @samp{$}, but |
|
|
user-defined variables' names may not begin with @samp{$}. |
|
|
|
|
|
@item |
|
|
The remaining characters in the identifier must be letters, digits, or |
|
|
one of the following special characters: |
|
47 |
|
|
48 |
@example |
@example |
49 |
. _ $ # @@ |
@center @. _ $ # @@ |
50 |
@end example |
@end example |
51 |
|
|
|
@item |
|
|
@cindex variable names |
|
|
@cindex names, variable |
|
|
Variable names may be up any length up to 64 bytes long. |
|
|
|
|
|
|
|
|
@item |
|
52 |
@cindex case-sensitivity |
@cindex case-sensitivity |
53 |
Identifiers are not case-sensitive: @code{foobar}, @code{Foobar}, |
Identifiers may be up any length, but only the first 64 bytes are |
54 |
@code{FooBar}, @code{FOOBAR}, and @code{FoObaR} are different |
significant. Identifiers are not case-sensitive: @code{foobar}, |
55 |
representations of the same identifier. |
@code{Foobar}, @code{FooBar}, @code{FOOBAR}, and @code{FoObaR} are |
56 |
|
different representations of the same identifier. |
57 |
@item |
|
58 |
@cindex keywords |
@cindex identifiers, reserved |
59 |
Identifiers other than variable names may be abbreviated to their first |
@cindex reserved identifiers |
60 |
3 characters if this abbreviation is unambiguous. These identifiers are |
Some identifiers are reserved. Reserved identifiers may not be used |
61 |
often called @dfn{keywords}. (Unique abbreviations of 3 or more |
in any context besides those explicitly described in this manual. The |
62 |
characters are also accepted: @samp{FRE}, @samp{FREQ}, and |
reserved identifiers are: |
|
@samp{FREQUENCIES} are equivalent when the last is a keyword.) |
|
|
|
|
|
@item |
|
|
Whether an identifier is a keyword depends on the context. |
|
|
|
|
|
@item |
|
|
@cindex keywords, reserved |
|
|
@cindex reserved keywords |
|
|
Some keywords are reserved. These keywords may not be used in any |
|
|
context besides those explicitly described in this manual. The reserved |
|
|
keywords are: |
|
63 |
|
|
64 |
@example |
@example |
65 |
ALL AND BY EQ GE GT LE LT NE NOT OR TO WITH |
@center ALL AND BY EQ GE GT LE LT NE NOT OR TO WITH |
66 |
@end example |
@end example |
67 |
|
|
68 |
@item |
@item Keywords |
69 |
Since keywords are identifiers, all the rules for identifiers apply. |
Keywords are a subclass of identifiers that form a fixed part of |
70 |
Specifically, they must be delimited as are other identifiers: |
command syntax. For example, command and subcommand names are |
71 |
@code{WITH} is a reserved keyword, but @code{WITHOUT} is a valid |
keywords. Keywords may be abbreviated to their first 3 characters if |
72 |
variable name. |
this abbreviation is unambiguous. (Unique abbreviations of 3 or more |
73 |
@end itemize |
characters are also accepted: @samp{FRE}, @samp{FREQ}, and |
74 |
|
@samp{FREQUENCIES} are equivalent when the last is a keyword.) |
75 |
|
|
76 |
@cindex @samp{.} |
Reserved identifiers are always used as keywords. Other identifiers |
77 |
@cindex period |
may be used both as keywords and as user-defined identifiers, such as |
78 |
@cindex variable names, ending with period |
variable names. |
|
@strong{Caution:} It is legal to end a variable name with a period, but |
|
|
@emph{don't do it!} The variable name will be misinterpreted when it is |
|
|
the final token on a line: @code{FOO.} will be divided into two separate |
|
|
tokens, @samp{FOO} and @samp{.}, the @dfn{terminal dot}. |
|
|
@xref{Commands, , Forming commands of tokens}. |
|
79 |
|
|
80 |
@item Numbers |
@item Numbers |
81 |
@cindex numbers |
@cindex numbers |
82 |
@cindex integers |
@cindex integers |
83 |
@cindex reals |
@cindex reals |
84 |
Numbers may be specified as integers or reals. Integers are internally |
Numbers are expressed in decimal. A decimal point is optional. |
85 |
converted into reals. Scientific notation is not supported. Here are |
Numbers may be expressed in scientific notation by adding @samp{e} and |
86 |
some examples of valid numbers: |
a base-10 exponent, so that @samp{1.234e3} has the value 1234. Here |
87 |
|
are some more examples of valid numbers: |
88 |
|
|
89 |
@example |
@example |
90 |
1234 3.14159265359 .707106781185 8945. |
-5 3.14159265359 1e100 -.707 8945. |
91 |
@end example |
@end example |
92 |
|
|
93 |
@strong{Caution:} The last example will be interpreted as two tokens, |
Negative numbers are expressed with a @samp{-} prefix. However, in |
94 |
@samp{8945} and @samp{.}, if it is the last token on a line. |
situations where a literal @samp{-} token is expected, what appears to |
95 |
|
be a negative number is treated as @samp{-} followed by a positive |
96 |
|
number. |
97 |
|
|
98 |
|
No white space is allowed within a number token, except for horizontal |
99 |
|
white space between @samp{-} and the rest of the number. |
100 |
|
|
101 |
|
The last example above, @samp{8945.} will be interpreted as two |
102 |
|
tokens, @samp{8945} and @samp{.}, if it is the last token on a line. |
103 |
|
@xref{Commands, , Forming commands of tokens}. |
104 |
|
|
105 |
@item Strings |
@item Strings |
106 |
@cindex strings |
@cindex strings |
107 |
@cindex @samp{'} |
@cindex @samp{'} |
108 |
@cindex @samp{"} |
@cindex @samp{"} |
109 |
@cindex case-sensitivity |
@cindex case-sensitivity |
110 |
Strings are literal sequences of characters enclosed in pairs of single |
Strings are literal sequences of characters enclosed in pairs of |
111 |
quotes (@samp{'}) or double quotes (@samp{"}). |
single quotes (@samp{'}) or double quotes (@samp{"}). To include the |
112 |
|
character used for quoting in the string, double it, e.g.@: |
113 |
@itemize @bullet |
@samp{'it''s an apostrophe'}. White space and case of letters are |
114 |
@item |
significant inside strings. |
115 |
Whitespace and case of letters @emph{are} significant inside strings. |
|
116 |
@item |
Strings can be concatenated using @samp{+}, so that @samp{"a" + 'b' + |
117 |
Whitespace characters inside a string are not delimiters. |
'c'} is equivalent to @samp{'abc'}. Concatenation is useful for |
118 |
@item |
splitting a single string across multiple source lines. The maximum |
119 |
To include single-quote characters in a string, enclose the string in |
length of a string, after concatenation, is 255 characters. |
120 |
double quotes. |
|
121 |
@item |
Strings may also be expressed as hexadecimal, octal, or binary |
122 |
To include double-quote characters in a string, enclose the string in |
character values by prefixing the initial quote character by @samp{X}, |
123 |
single quotes. |
@samp{O}, or @samp{B} or their lowercase equivalents. Each pair, |
124 |
@item |
triplet, or octet of characters, according to the radix, is |
125 |
It is not possible to put both single- and double-quote characters |
transformed into a single character with the given value. If there is |
126 |
inside one string. |
an incomplete group of characters, the missing final digits are |
127 |
@end itemize |
assumed to be @samp{0}. These forms of strings are nonportable |
128 |
|
because numeric values are associated with different characters by |
129 |
@item Hexstrings |
different operating systems. Therefore, their use should be confined |
130 |
@cindex hexstrings |
to syntax files that will not be widely distributed. |
|
Hexstrings are string variants that use hex digits to specify |
|
|
characters. |
|
|
|
|
|
@itemize @bullet |
|
|
@item |
|
|
A hexstring may be used anywhere that an ordinary string is allowed. |
|
|
|
|
|
@item |
|
|
@cindex @samp{X'} |
|
|
@cindex @samp{'} |
|
|
A hexstring begins with @samp{X'} or @samp{x'}, and ends with @samp{'}. |
|
|
|
|
|
@cindex whitespace |
|
|
@item |
|
|
No whitespace is allowed between the initial @samp{X} and @samp{'}. |
|
|
|
|
|
@item |
|
|
Double quotes @samp{"} may be used in place of single quotes @samp{'} if |
|
|
done in both places. |
|
|
|
|
|
@item |
|
|
Each pair of hex digits is internally changed into a single character |
|
|
with the given value. |
|
|
|
|
|
@item |
|
|
If there is an odd number of hex digits, the missing last digit is |
|
|
assumed to be @samp{0}. |
|
|
|
|
|
@item |
|
|
@cindex portability |
|
|
@strong{Please note:} Use of hexstrings is nonportable because the same |
|
|
numeric values are associated with different glyphs by different |
|
|
operating systems. Therefore, their use should be confined to syntax |
|
|
files that will not be widely distributed. |
|
131 |
|
|
|
@item |
|
132 |
@cindex characters, reserved |
@cindex characters, reserved |
133 |
@cindex 0 |
@cindex 0 |
134 |
@cindex whitespace |
@cindex white space |
135 |
@strong{Please note also:} The character with value 00 is reserved for |
The character with value 00 is reserved for |
136 |
internal use by PSPP. Its use in strings causes an error and |
internal use by PSPP. Its use in strings causes an error and |
137 |
replacement with a blank space (in ASCII, hex 20, decimal 32). |
replacement by a space character. |
|
@end itemize |
|
|
|
|
|
@item Punctuation |
|
|
@cindex punctuation |
|
|
Punctuation separates tokens; punctuators are delimiters. These are the |
|
|
punctuation characters: |
|
|
|
|
|
@example |
|
|
, / = ( ) |
|
|
@end example |
|
138 |
|
|
139 |
@item Operators |
@item Punctuators and Operators |
140 |
|
@cindex punctuators |
141 |
@cindex operators |
@cindex operators |
142 |
Operators describe mathematical operations. Some operators are delimiters: |
These tokens are the punctuators and operators: |
|
|
|
|
@example |
|
|
( ) + - * / ** |
|
|
@end example |
|
|
|
|
|
Many of the above operators are also punctuators. Punctuators are |
|
|
distinguished from operators by context. |
|
|
|
|
|
The other operators are all reserved keywords. None of these are |
|
|
delimiters: |
|
143 |
|
|
144 |
@example |
@example |
145 |
AND EQ GE GT LE LT NE OR |
@center , / = ( ) + - * / ** < <= <> > >= ~= & | . |
146 |
@end example |
@end example |
147 |
|
|
148 |
@item Terminal Dot |
Most of these appear within the syntax of commands, but the period |
149 |
@cindex terminal dot |
(@samp{.}) punctuator is used only at the end of a command. It is a |
150 |
@cindex dot, terminal |
punctuator only as the last character on a line (except white space). |
151 |
@cindex period |
When it is the last non-space character on a line, a period is not |
152 |
@cindex @samp{.} |
treated as part of another token, even if it would otherwise be part |
153 |
A period (@samp{.}) at the end of a line (except for whitespace) is one |
of e.g.@: an identifier or a floating-point number. |
154 |
type of a @dfn{terminal dot}, although not every terminal dot is a |
|
155 |
period at the end of a line. @xref{Commands, , Forming commands of |
Actually, the character that ends a command can be changed with |
156 |
tokens}. A period is a terminal dot @emph{only} |
@cmd{SET}'s ENDCMD subcommand (@pxref{SET}), but we do not recommend |
157 |
when it is at the end of a line; otherwise it is part of a |
doing so. Throughout the remainder of this manual we will assume that |
158 |
floating-point number. (A period outside a number in the middle of a |
the default setting is in effect. |
|
line is an error.) |
|
|
|
|
|
@quotation |
|
|
@cindex terminal dot, changing |
|
|
@cindex dot, terminal, changing |
|
|
@strong{Please note:} The character used for the @dfn{terminal dot} |
|
|
can be changed with @cmd{SET}'s ENDCMD subcommand (@pxref{SET}). This |
|
|
is strongly discouraged, and throughout all the remainder of this |
|
|
manual it will be assumed that the default setting is in effect. |
|
|
@end quotation |
|
|
|
|
159 |
@end table |
@end table |
160 |
|
|
161 |
@node Commands, Types of Commands, Tokens, Language |
@node Commands, Types of Commands, Tokens, Language |
165 |
@cindex language, command structure |
@cindex language, command structure |
166 |
@cindex commands, structure |
@cindex commands, structure |
167 |
|
|
168 |
Most PSPP commands share a common structure, diagrammed below: |
Most PSPP commands share a common structure. A command begins with a |
169 |
|
command name, such as @cmd{FREQUENCIES}, @cmd{DATA LIST}, or @cmd{N OF |
170 |
@example |
CASES}. The command name may be abbreviated to its first word, and |
171 |
@var{cmd}@dots{} [@var{sbc}[=][@var{spec} [[,]@var{spec}]@dots{}]] [[/[=][@var{spec} [[,]@var{spec}]@dots{}]]@dots{}]. |
each word in the command name may be abbreviated to its first three |
172 |
@end example |
or more characters, where these abbreviations are unambiguous. |
173 |
|
|
174 |
@cindex @samp{[ ]} |
The command name may be followed by one or more @dfn{subcommands}. |
175 |
In the above, rather daunting, expression, pairs of square brackets |
Each subcommand begins with a subcommand name, which may be |
176 |
(@samp{[ ]}) indicate optional elements, and names such as @var{cmd} |
abbreviated to its first three letters. Some subcommands accept a |
177 |
indicate parts of the syntax that vary from command to command. |
series of one or more specifications, which follow the subcommand name |
178 |
Ellipses (@samp{...}) indicate that the preceding part may be repeated |
and, optionally separated from it by an equals sign (@samp{=}), and |
179 |
an arbitrary number of times. Let's pick apart what it says above: |
optionally separated from each other by commas. Each subcommand must |
180 |
|
be separated from the next (if any) by a forward slash (@samp{/}). |
181 |
@itemize @bullet |
|
182 |
@cindex commands, names |
There are multiple ways to mark the end of a command. The most common |
183 |
@item |
way is to end the last line of the command with a period (@samp{.}) as |
184 |
A command begins with a command name of one or more keywords, such as |
described in the previous section (@pxref{Tokens}). A blank line, or |
185 |
@cmd{FREQUENCIES}, @cmd{DATA LIST}, or @cmd{N OF CASES}. @var{cmd} |
one that consists only of white space or comments, also ends a command |
186 |
may be abbreviated to its first word if that is unambiguous; each word |
by default, although you can use the NULLINE subcommand of @cmd{SET} |
187 |
in @var{cmd} may be abbreviated to a unique prefix of three or more |
to disable this feature (@pxref{SET}). |
188 |
characters as described above. |
|
189 |
|
In batch mode only, that is, when reading commands from a file instead |
190 |
@cindex subcommands |
of an interactive user, any line that contains a non-space character |
191 |
@item |
in the leftmost column begins a new command. Thus, each command |
192 |
The command name may be followed by one or more @dfn{subcommands}: |
consists of a flush-left line followed by any number of lines indented |
193 |
|
from the left margin. In this mode, a plus sign, minus sign, or |
194 |
@itemize @minus |
period (@samp{+}, @samp{@minus{}}, or @samp{.}) as the first character |
195 |
@item |
in a line is ignored and causes that line to begin a new command, |
196 |
Each subcommand begins with a unique keyword, indicated by @var{sbc} |
which allows for visual indentation of a command without that command |
197 |
above. This is analogous to the command name. |
being considered part of the previous command. |
|
|
|
|
@item |
|
|
The subcommand name is optionally followed by an equals sign (@samp{=}). |
|
|
|
|
|
@item |
|
|
Some subcommands accept a series of one or more specifications |
|
|
(@var{spec}), optionally separated by commas. |
|
|
|
|
|
@item |
|
|
Each subcommand must be separated from the next (if any) by a forward |
|
|
slash (@samp{/}). |
|
|
@end itemize |
|
|
|
|
|
@cindex dot, terminal |
|
|
@cindex terminal dot |
|
|
@item |
|
|
Each command must be terminated with a @dfn{terminal dot}. |
|
|
The terminal dot may be given one of three ways: |
|
|
|
|
|
@itemize @minus |
|
|
@item |
|
|
(most commonly) A period character at the very end of a line, as |
|
|
described above. |
|
|
|
|
|
@item |
|
|
(only if NULLINE is on: @xref{SET, , Setting user preferences}, for more |
|
|
details.) A completely blank line. |
|
|
|
|
|
@item |
|
|
(in batch mode only) Any line that is not indented from the left side of |
|
|
the page causes a terminal dot to be inserted before that line. |
|
|
Therefore, each command begins with a line that is flush left, followed |
|
|
by zero or more lines that are indented one or more characters from the |
|
|
left margin. |
|
|
|
|
|
In batch mode, PSPP will ignore a plus sign, minus sign, or period |
|
|
(@samp{+}, @samp{@minus{}}, or @samp{.}) as the first character in a |
|
|
line. Any of these characters as the first character on a line will |
|
|
begin a new command. This allows for visual indentation of a command |
|
|
without that command being considered part of the previous command. |
|
|
|
|
|
PSPP is in batch mode when it is reading input from a file, rather |
|
|
than from an interactive user. Note that the other forms of the |
|
|
terminal dot may also be used in batch mode. |
|
198 |
|
|
199 |
Sometimes, one encounters syntax files that are intended to be |
Sometimes, one encounters syntax files that are intended to be |
200 |
interpreted in interactive mode rather than batch mode (for instance, |
interpreted in interactive mode rather than batch mode. When this |
201 |
this can happen if a session log file is used directly as a syntax |
occurs, use the @samp{-i} command line option to force interpretation |
202 |
file). When this occurs, use the @samp{-i} command line option to force |
in interactive mode (@pxref{Language control options}). |
|
interpretation in interactive mode (@pxref{Language control options}). |
|
|
@end itemize |
|
|
@end itemize |
|
|
|
|
|
PSPP ignores empty commands when they are generated by the above |
|
|
rules. Note that, as a consequence of these rules, each command must |
|
|
begin on a new line. |
|
203 |
|
|
204 |
@node Types of Commands, Order of Commands, Commands, Language |
@node Types of Commands, Order of Commands, Commands, Language |
205 |
@section Types of Commands |
@section Types of Commands |
233 |
|
|
234 |
@item Restricted transformations |
@item Restricted transformations |
235 |
@cindex restricted transformations |
@cindex restricted transformations |
236 |
Same as transformations for most purposes. @xref{Order of Commands}, for a |
Transformations that cannot appear in certain contexts. @xref{Order |
237 |
detailed description of the differences. |
of Commands}, for details. |
238 |
|
|
239 |
@item Procedures |
@item Procedures |
240 |
@cindex procedures |
@cindex procedures |
249 |
@cindex commands, ordering |
@cindex commands, ordering |
250 |
@cindex order of commands |
@cindex order of commands |
251 |
|
|
252 |
PSPP does not place many restrictions on ordering of commands. |
PSPP does not place many restrictions on ordering of commands. The |
253 |
The main restriction is that variables must be defined with one of the |
main restriction is that variables must be defined they are otherwise |
254 |
file-definition commands before they are otherwise referred to. |
referenced. This section describes the details of command ordering, |
255 |
|
but most users will have no need to refer to them. |
256 |
|
|
|
Of course, there are specific rules, for those who are interested. |
|
257 |
PSPP possesses five internal states, called initial, INPUT PROGRAM, |
PSPP possesses five internal states, called initial, INPUT PROGRAM, |
258 |
FILE TYPE, transformation, and procedure states. (Please note the |
FILE TYPE, transformation, and procedure states. (Please note the |
259 |
distinction between the @cmd{INPUT PROGRAM} and @cmd{FILE TYPE} |
distinction between the @cmd{INPUT PROGRAM} and @cmd{FILE TYPE} |
267 |
@item Utility commands |
@item Utility commands |
268 |
@itemize @bullet |
@itemize @bullet |
269 |
@item |
@item |
270 |
Legal in all states. |
Valid in any state. |
271 |
@item |
@item |
272 |
Do not cause state transitions. Exception: when @cmd{N OF CASES} |
Do not cause state transitions. Exception: when @cmd{N OF CASES} |
273 |
is executed in the procedure state, it causes a transition to the |
is executed in the procedure state, it causes a transition to the |
277 |
@item @cmd{DATA LIST} |
@item @cmd{DATA LIST} |
278 |
@itemize @bullet |
@itemize @bullet |
279 |
@item |
@item |
280 |
Legal in all states. |
Valid in any state. |
281 |
@item |
@item |
282 |
When executed in the initial or procedure state, causes a transition to |
When executed in the initial or procedure state, causes a transition to |
283 |
the transformation state. |
the transformation state. |
350 |
PSPP includes special support for unknown numeric data values. |
PSPP includes special support for unknown numeric data values. |
351 |
Missing observations are assigned a special value, called the |
Missing observations are assigned a special value, called the |
352 |
@dfn{system-missing value}. This ``value'' actually indicates the |
@dfn{system-missing value}. This ``value'' actually indicates the |
353 |
absence of value; it means that the actual value is unknown. Procedures |
absence of a value; it means that the actual value is unknown. Procedures |
354 |
automatically exclude from analyses those observations or cases that |
automatically exclude from analyses those observations or cases that |
355 |
have missing values. Whether single observations or entire cases are |
have missing values. Details of missing value exclusion depend on the |
356 |
excluded depends on the procedure. |
procedure and can often be controlled by the user; refer to |
357 |
|
descriptions of individual procedures for details. |
358 |
|
|
359 |
The system-missing value exists only for numeric variables. String |
The system-missing value exists only for numeric variables. String |
360 |
variables always have a defined value, even if it is only a string of |
variables always have a defined value, even if it is only a string of |
398 |
|
|
399 |
@table @strong |
@table @strong |
400 |
@item Name |
@item Name |
401 |
This is an identifier. Each variable must have a different name. |
An identifier, up to 64 bytes long. Each variable must have a different name. |
402 |
@xref{Tokens}. |
@xref{Tokens}. |
403 |
|
|
404 |
|
Some system variable names begin with @samp{$}, but user-defined |
405 |
|
variables' names may not begin with @samp{$}. |
406 |
|
|
407 |
|
@cindex @samp{.} |
408 |
|
@cindex period |
409 |
|
@cindex variable names, ending with period |
410 |
|
The final character in a variable name should not be @samp{.}, because |
411 |
|
such an identifier will be misinterpreted when it is the final token |
412 |
|
on a line: @code{FOO.} will be divided into two separate tokens, |
413 |
|
@samp{FOO} and @samp{.}, indicating end-of-command. @xref{Tokens}. |
414 |
|
|
415 |
|
@cindex @samp{_} |
416 |
|
The final character in a variable name should not be @samp{_}, because |
417 |
|
some such identifiers are used for special purposes by PSPP |
418 |
|
procedures. |
419 |
|
|
420 |
|
As with all PSPP identifiers, variable names are not case-sensitive. |
421 |
|
PSPP capitalizes variable names on output the same way they were |
422 |
|
capitalized at their point of definition in the input. |
423 |
|
|
424 |
@cindex variables, type |
@cindex variables, type |
425 |
@cindex type of variables |
@cindex type of variables |
426 |
@item Type |
@item Type |
434 |
can be used in many procedures where @dfn{long string variables} (those |
can be used in many procedures where @dfn{long string variables} (those |
435 |
with widths greater than 8) are not allowed. |
with widths greater than 8) are not allowed. |
436 |
|
|
437 |
@quotation |
Certain systems may consider strings longer than 8 |
|
@strong{Please note:} Certain systems may consider strings longer than 8 |
|
438 |
characters to be short strings. Eight characters represents a minimum |
characters to be short strings. Eight characters represents a minimum |
439 |
figure for the maximum length of a short string. |
figure for the maximum length of a short string. |
|
@end quotation |
|
440 |
|
|
441 |
@item Position |
@item Position |
442 |
Variables in the dictionary are arranged in a specific order. |
Variables in the dictionary are arranged in a specific order. |
530 |
@cindex TO convention |
@cindex TO convention |
531 |
@cindex convention, TO |
@cindex convention, TO |
532 |
|
|
533 |
There are several ways to specify a set of variables: |
To refer to a set of variables, list their names one after another. |
534 |
|
Optionally, their names may be separated by commas. To include a |
535 |
@enumerate |
range of variables from the dictionary in the list, write the name of |
536 |
@item |
the first and last variable in the range, separated by @code{TO}. For |
537 |
(Most commonly.) List the variable names one after another, optionally |
instance, if the dictionary contains six variables with the names |
538 |
separating them by commas. |
@code{ID}, @code{X1}, @code{X2}, @code{GOAL}, @code{MET}, and |
|
|
|
|
@cindex @code{TO} |
|
|
@item |
|
|
(This method cannot be used on commands that define the dictionary, such |
|
|
as @cmd{DATA LIST}.) The syntax is the names of two existing variables, |
|
|
separated by the reserved keyword @code{TO}. The meaning is to include |
|
|
every variable in the dictionary between and including the variables |
|
|
specified. For instance, if the dictionary contains six variables with |
|
|
the names @code{ID}, @code{X1}, @code{X2}, @code{GOAL}, @code{MET}, and |
|
539 |
@code{NEXTGOAL}, in that order, then @code{X2 TO MET} would include |
@code{NEXTGOAL}, in that order, then @code{X2 TO MET} would include |
540 |
variables @code{X2}, @code{GOAL}, and @code{MET}. |
variables @code{X2}, @code{GOAL}, and @code{MET}. |
541 |
|
|
542 |
@item |
Commands that define variables, such as @cmd{DATA LIST}, give |
543 |
(This method can be used only on commands that define the dictionary, |
@code{TO} an alternate meaning. With these commands, @code{TO} define |
544 |
such as @cmd{DATA LIST}.) It is used to define sequences of variables |
sequences of variables whose names end in consecutive integers. The |
545 |
that end in consecutive integers. The syntax is two identifiers that |
syntax is two identifiers that begin with the same root and end with |
546 |
end in numbers. This method is best illustrated with examples: |
numbers, separated by @code{TO}. The syntax @code{X1 TO X5} defines 5 |
547 |
|
variables, named @code{X1}, @code{X2}, @code{X3}, @code{X4}, and |
548 |
|
@code{X5}. The syntax @code{ITEM0008 TO ITEM0013} defines 6 |
549 |
|
variables, named @code{ITEM0008}, @code{ITEM0009}, @code{ITEM0010}, |
550 |
|
@code{ITEM0011}, @code{ITEM0012}, and @code{ITEM00013}. The syntaxes |
551 |
|
@code{QUES001 TO QUES9} and @code{QUES6 TO QUES3} are invalid. |
552 |
|
|
553 |
@itemize @bullet |
After a set of variables has been defined with @cmd{DATA LIST} or |
554 |
@item |
another command with this method, the same set can be referenced on |
|
The syntax @code{X1 TO X5} defines 5 variables: |
|
|
|
|
|
@itemize @minus |
|
|
@item |
|
|
X1 |
|
|
@item |
|
|
X2 |
|
|
@item |
|
|
X3 |
|
|
@item |
|
|
X4 |
|
|
@item |
|
|
X5 |
|
|
@end itemize |
|
|
|
|
|
@item |
|
|
The syntax @code{ITEM0008 TO ITEM0013} defines 6 variables: |
|
|
|
|
|
@itemize @minus |
|
|
@item |
|
|
ITEM0008 |
|
|
@item |
|
|
ITEM0009 |
|
|
@item |
|
|
ITEM0010 |
|
|
@item |
|
|
ITEM0011 |
|
|
@item |
|
|
ITEM0012 |
|
|
@item |
|
|
ITEM0013 |
|
|
@end itemize |
|
|
|
|
|
@item |
|
|
Each of the syntaxes @code{QUES001 TO QUES9} and @code{QUES6 TO QUES3} |
|
|
are invalid, although for different reasons, which should be evident. |
|
|
@end itemize |
|
|
|
|
|
Note that after a set of variables has been defined with @cmd{DATA LIST} |
|
|
or another command with this method, the same set can be referenced on |
|
555 |
later commands using the same syntax. |
later commands using the same syntax. |
556 |
|
|
|
@item |
|
|
The above methods can be combined, either one after another or delimited |
|
|
by commas. For instance, the combined syntax @code{A Q5 TO Q8 X TO Z} |
|
|
is legal as long as each part @code{A}, @code{Q5 TO Q8}, @code{X TO Z} |
|
|
is individually legal. |
|
|
@end enumerate |
|
|
|
|
557 |
@node Input/Output Formats, Scratch Variables, Sets of Variables, Variables |
@node Input/Output Formats, Scratch Variables, Sets of Variables, Variables |
558 |
@subsection Input and Output Formats |
@subsection Input and Output Formats |
559 |
|
|
711 |
|
|
712 |
@table @dfn |
@table @dfn |
713 |
@item leader |
@item leader |
714 |
All formats accept an optional whitespace leader. |
All formats accept an optional white space leader. |
715 |
|
|
716 |
@item day |
@item day |
717 |
An integer between 1 and 31 representing the day of month. |
An integer between 1 and 31 representing the day of month. |
720 |
An integer representing a number of days. |
An integer representing a number of days. |
721 |
|
|
722 |
@item date-delimiter |
@item date-delimiter |
723 |
One or more characters of whitespace or the following characters: |
One or more characters of white space or the following characters: |
724 |
@code{- / . ,} |
@code{- / . ,} |
725 |
|
|
726 |
@item month |
@item month |
756 |
The letters @samp{wk} in any case. |
The letters @samp{wk} in any case. |
757 |
|
|
758 |
@item time-delimiter |
@item time-delimiter |
759 |
At least one characters of whitespace or @samp{:} or @samp{.}. |
At least one characters of white space or @samp{:} or @samp{.}. |
760 |
|
|
761 |
@item hour |
@item hour |
762 |
An integer greater than 0 representing an hour. |
An integer greater than 0 representing an hour. |
775 |
At least the first two characters of an English day word. |
At least the first two characters of an English day word. |
776 |
|
|
777 |
@item spaces |
@item spaces |
778 |
Any amount or no amount of whitespace. |
Any amount or no amount of white space. |
779 |
|
|
780 |
@item sign |
@item sign |
781 |
An optional positive or negative sign. |
An optional positive or negative sign. |
782 |
|
|
783 |
@item trailer |
@item trailer |
784 |
All formats accept an optional whitespace trailer. |
All formats accept an optional white space trailer. |
785 |
@end table |
@end table |
786 |
|
|
787 |
The date input formats are strung together from the above pieces. On |
The date input formats are strung together from the above pieces. On |
984 |
Operators and punctuators. |
Operators and punctuators. |
985 |
|
|
986 |
@cindex @code{.} |
@cindex @code{.} |
|
@cindex terminal dot |
|
|
@cindex dot, terminal |
|
987 |
@item @code{.} |
@item @code{.} |
988 |
The terminal dot. This is not necessarily an actual dot in the syntax |
The end of the command. This is not necessarily an actual dot in the |
989 |
file: @xref{Commands}, for more details. |
syntax file: @xref{Commands}, for more details. |
990 |
@end table |
@end table |
991 |
|
|
992 |
@item |
@item |