pivot table procedure conceptually works
[pspp] / examples / pivot.sps
diff --git a/examples/pivot.sps b/examples/pivot.sps
new file mode 100644 (file)
index 0000000..bad932c
--- /dev/null
@@ -0,0 +1,74 @@
+* Based on the tutorial at http://www.ats.ucla.edu/stat/spss/library/sp_pivot.htm.
+data list list notable/sex tumor dose statistics (f1) data (f5.1).
+value labels
+      /sex 0 'Female' 1 'Male'
+      /tumor 0 'Absent' 1 'Present' 2 'Total'
+      /dose 0 'Control' 1 'Low' 2 'Medium' 3 'High' 4 'Total'
+      /statistics 0 'Count' 1 'Tumor%'.
+begin data.
+0 0 0 0  6
+0 0 0 1 21.4
+0 0 1 0 11
+0 0 1 1 39.3
+0 0 2 0  6
+0 0 2 1 21.4
+0 0 3 0  5
+0 0 3 1 17.9
+0 0 4 0 28
+0 0 4 1  100
+0 1 0 0  6
+0 1 0 1 26.1
+0 1 1 0  5
+0 1 1 1 21.7
+0 1 2 0  6
+0 1 2 1 26.1
+0 1 3 0  6
+0 1 3 1 26.1
+0 1 4 0 23
+0 1 4 1  100
+0 2 0 0 12
+0 2 0 1 23.5
+0 2 1 0 16
+0 2 1 1 31.4
+0 2 2 0 12
+0 2 2 1 23.5
+0 2 3 0 11
+0 2 3 1 21.6
+0 2 4 0 51
+0 2 4 1  100
+1 0 0 0 18
+1 0 0 1 30.5
+1 0 1 0 11
+1 0 1 1 18.6
+1 0 2 0 17
+1 0 2 1 28.8
+1 0 3 0 13
+1 0 3 1 22.0
+1 0 4 0 59
+1 0 4 1  100
+1 1 0 0  3
+1 1 0 1 25.0
+1 1 1 0  3
+1 1 1 1 25.0
+1 1 2 0  2
+1 1 2 1 16.7
+1 1 3 0  4
+1 1 3 1 33.3
+1 1 4 0 12
+1 1 4 1  100
+1 2 0 0 21
+1 2 0 1 29.6
+1 2 1 0 14
+1 2 1 1 19.7
+1 2 2 0 19
+1 2 2 1 26.8
+1 2 3 0 17
+1 2 3 1 23.9
+1 2 4 0 71
+1 2 4 1  100
+end data.
+
+format sex tumor dose(f1).
+*select if tumor=1 and statistics=1.
+debug pivot /rows=sex tumor statistics/columns=dose/data=data.
+