Documentation: New example for the temporary command
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 28 Nov 2020 10:11:11 +0000 (11:11 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Sat, 28 Nov 2020 10:11:11 +0000 (11:11 +0100)
doc/automake.mk
doc/data-selection.texi
doc/pspp-figures/temporary.sps [new file with mode: 0644]

index 65e21642205db7971adb08164cb979fdf6d19d43..2325e236a599afa48789a54bbe51988796176e74 100644 (file)
@@ -123,6 +123,7 @@ FIGURE_SYNTAX = \
  doc/pspp-figures/independent-samples-t.sps \
  doc/pspp-figures/reliability.sps \
  doc/pspp-figures/split.sps \
+ doc/pspp-figures/temporary.sps \
  doc/pspp-figures/tutorial1.sps \
  doc/pspp-figures/tutorial2.sps \
  doc/pspp-figures/tutorial3.sps \
index 71b4e3de5aa45a8b4c72a67ff8725157446731f4..17c039c88d16d3b3f95111c95212f8dc9eb2f2a1 100644 (file)
@@ -249,31 +249,30 @@ procedure-like commands.
 
 Scratch variables cannot be used following @cmd{TEMPORARY}.
 
-An example may help to clarify:
+@subsection Example Temporary
 
-@example
-DATA LIST /X 1-2.
-BEGIN DATA.
- 2
- 4
-10
-15
-20
-24
-END DATA.
+In @ref{temporary:ex} there are two @cmd{COMPUTE} transformation.  One
+of them immediatly follows a @cmd{TEMPORARY} command, and therefore has
+effect only for the next procedure, which in this case is the first
+@cmd{DESCRIPTIVES} command.
 
-COMPUTE X=X/2.
+@float Example, temporary:ex
+@psppsyntax {temporary.sps}
+@caption {Running a @cmd{COMPUTE} transformation after @cmd{TEMPORARY}}
+@end float
 
-TEMPORARY.
-COMPUTE X=X+3.
+The data read by the first @cmd{DESCRIPTIVES} procedure are 4, 5, 8,
+10.5, 13, 15.  The data read by the second @cmd{DESCRIPTIVES} procedure are 1, 2,
+5, 7.5, 10, 12.   This is because the second @cmd{COMPUTE} transformation
+has no effect on the second @cmd{DESCRIPTIVES} procedure.   You can check these
+figures in @ref{temporary:res}.
 
-DESCRIPTIVES X.
-DESCRIPTIVES X.
-@end example
+@float Result, temporary:res
+@psppoutput {temporary}
+@caption {The results of running two consecutive @cmd{DESCRIPTIVES} commands after
+         a temporary transformation}
+@end float
 
-The data read by the first @cmd{DESCRIPTIVES} are 4, 5, 8,
-10.5, 13, 15.  The data read by the first @cmd{DESCRIPTIVES} are 1, 2,
-5, 7.5, 10, 12.
 
 @node WEIGHT
 @section WEIGHT
diff --git a/doc/pspp-figures/temporary.sps b/doc/pspp-figures/temporary.sps
new file mode 100644 (file)
index 0000000..1582806
--- /dev/null
@@ -0,0 +1,17 @@
+data list notable /x 1-2.
+begin data.
+ 2
+ 4
+10
+15
+20
+24
+end data.
+
+compute x=x/2.
+
+temporary.
+compute x=x+3.
+
+descriptives x.
+descriptives x.