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 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 9072 9073 9074 9075 9076 9077 9078 9079 9080 9081 9082 9083 9084 9085 9086 9087 9088 9089 9090 9091 9092 9093 9094 9095 9096 9097 9098 9099 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109 9110 9111 9112 9113 9114 9115 9116 9117 9118 9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 9144 9145 9146 9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 9385 9386 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 9505 9506 9507 9508 9509 9510 9511 9512 9513 9514 9515 9516 9517 9518 9519 9520 9521 9522 9523 9524 9525 9526 9527 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538 9539 9540 9541 9542 9543 9544 9545 9546 9547 9548 9549 9550 9551 9552 9553 9554 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 9569 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 9591 9592 9593 9594 9595 9596 9597 9598 9599 9600 9601 9602 9603 9604 9605 9606 9607 9608 9609 9610 9611 9612 9613 9614 9615 9616 9617 9618 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 9648 9649 9650 9651 9652 9653 9654 9655 9656 9657 9658 9659 9660 9661 9662 9663 9664 9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 9680 9681 9682 9683 9684 9685 9686 9687 9688 9689 9690 9691 9692 9693 9694 9695 9696 9697 9698 9699 9700 9701 9702 9703 9704 9705 9706 9707 9708 9709 9710 9711 9712 9713 9714 9715 9716 9717 9718 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 9732 9733 9734 9735 9736 9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 9788 9789 9790 9791 9792 9793 9794 9795 9796 9797 9798 9799 9800 9801 9802 9803 9804 9805 9806 9807 9808 9809 9810 9811 9812 9813 9814 9815 9816 9817 9818 9819 9820 9821 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9954 9955 9956 9957 9958 9959 9960 9961 9962 9963 9964 9965 9966 9967 9968 9969 9970 9971 9972 9973 9974 9975 9976 9977 9978 9979 9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 9995 9996 9997 9998 9999 10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011 10012 10013 10014 10015 10016 10017 10018 10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 10044 10045 10046 10047 10048 10049 10050 10051 10052 10053 10054 10055 10056 10057 10058 10059 10060 10061 10062 10063 10064 10065 10066 10067 10068 10069 10070 10071 10072 10073 10074 10075 10076 10077 10078 10079 10080 10081 10082 10083 10084 10085 10086 10087 10088 10089 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 10102 10103 10104 10105 10106 10107 10108 10109 10110 10111 10112 10113 10114 10115 10116 10117 10118 10119 10120 10121 10122 10123 10124 10125 10126 10127 10128 10129 10130 10131 10132 10133 10134 10135 10136 10137 10138 10139 10140 10141 10142 10143 10144 10145 10146 10147 10148 10149 10150 10151 10152 10153 10154 10155 10156 10157 10158 10159 10160 10161 10162 10163 10164 10165 10166 10167 10168 10169 10170 10171 10172 10173 10174 10175 10176 10177 10178 10179 10180 10181 10182 10183 10184 10185 10186 10187 10188 10189 10190 10191 10192 10193 10194 10195 10196 10197 10198 10199 10200 10201 10202 10203 10204 10205 10206 10207 10208 10209 10210 10211 10212 10213 10214 10215 10216 10217 10218 10219 10220 10221 10222 10223 10224 10225 10226 10227 10228 10229 10230 10231 10232 10233 10234 10235 10236 10237 10238 10239 10240 10241 10242 10243 10244 10245 10246 10247 10248 10249 10250 10251 10252 10253 10254 10255 10256 10257 10258 10259 10260 10261 10262 10263 10264 10265 10266 10267 10268 10269 10270 10271 10272 10273 10274 10275 10276 10277 10278 10279 10280 10281 10282 10283 10284 10285 10286 10287 10288 10289 10290 10291 10292 10293 10294 10295 10296 10297 10298 10299 10300 10301 10302 10303 10304 10305 10306 10307 10308 10309 10310 10311 10312 10313 10314 10315 10316 10317 10318 10319 10320 10321 10322 10323 10324 10325 10326 10327 10328 10329 10330 10331 10332 10333 10334 10335 10336 10337 10338 10339 10340 10341 10342 10343 10344 10345 10346 10347 10348 10349 10350 10351 10352 10353 10354 10355 10356 10357 10358 10359 10360 10361 10362 10363 10364 10365 10366 10367 10368 10369 10370 10371 10372 10373 10374 10375 10376 10377 10378 10379 10380 10381 10382 10383 10384 10385 10386 10387 10388 10389 10390 10391 10392 10393 10394 10395 10396 10397 10398 10399 10400 10401 10402 10403 10404 10405 10406 10407 10408 10409 10410 10411 10412 10413 10414 10415 10416 10417 10418 10419 10420 10421 10422 10423 10424 10425 10426 10427 10428 10429 10430 10431 10432 10433 10434 10435 10436 10437 10438 10439 10440 10441 10442 10443 10444 10445 10446 10447 10448 10449 10450 10451 10452 10453 10454 10455 10456 10457 10458 10459 10460 10461 10462 10463 10464 10465 10466 10467 10468 10469 10470 10471 10472 10473 10474 10475 10476 10477 10478 10479 10480 10481 10482 10483 10484 10485 10486 10487 10488 10489 10490 10491 10492 10493 10494 10495 10496 10497 10498 10499 10500 10501 10502 10503 10504 10505 10506 10507 10508 10509 10510 10511 10512 10513 10514 10515 10516 10517 10518 10519 10520 10521 10522 10523 10524 10525 10526 10527 10528 10529 10530 10531 10532 10533 10534 10535 10536 10537 10538 10539 10540 10541 10542 10543 10544 10545 10546 10547 10548 10549 10550 10551 10552 10553 10554 10555 10556 10557 10558 10559 10560 10561 10562 10563 10564 10565 10566 10567 10568 10569 10570 10571 10572 10573 10574 10575 10576 10577 10578 10579 10580 10581 10582 10583 10584 10585 10586 10587 10588 10589 10590 10591 10592 10593 10594 10595 10596 10597 10598 10599 10600 10601 10602 10603 10604 10605 10606 10607 10608 10609 10610 10611 10612 10613 10614 10615 10616 10617 10618 10619 10620 10621 10622 10623 10624 10625 10626 10627 10628 10629 10630 10631 10632 10633 10634 10635 10636 10637 10638 10639 10640 10641 10642 10643 10644 10645 10646 10647 10648 10649 10650 10651 10652 10653 10654 10655 10656 10657 10658 10659 10660 10661 10662 10663 10664 10665 10666 10667 10668 10669 10670 10671 10672 10673 10674 10675 10676 10677 10678 10679 10680 10681 10682 10683 10684 10685 10686 10687 10688 10689 10690 10691 10692 10693 10694 10695 10696 10697 10698 10699 10700 10701 10702 10703 10704 10705 10706 10707 10708 10709 10710 10711 10712 10713 10714 10715 10716 10717 10718 10719 10720 10721 10722 10723 10724 10725 10726 10727 10728 10729 10730 10731 10732 10733 10734 10735 10736 10737 10738 10739 10740 10741 10742 10743 10744 10745 10746 10747 10748 10749 10750 10751 10752 10753 10754 10755 10756 10757 10758 10759 10760 10761 10762 10763 10764 10765 10766 10767 10768 10769 10770 10771 10772 10773 10774 10775 10776 10777 10778 10779 10780 10781 10782 10783 10784 10785 10786 10787 10788 10789 10790 10791 10792 10793 10794 10795 10796 10797 10798 10799 10800 10801 10802 10803 10804 10805 10806 10807 10808 10809 10810 10811 10812 10813 10814 10815 10816 10817 10818 10819 10820 10821 10822 10823 10824 10825 10826 10827 10828 10829 10830 10831 10832 10833 10834 10835 10836 10837 10838 10839 10840 10841 10842 10843 10844 10845 10846 10847 10848 10849 10850 10851 10852 10853 10854 10855 10856 10857 10858 10859 10860 10861 10862 10863 10864 10865 10866 10867 10868 10869 10870 10871 10872 10873 10874 10875 10876 10877 10878 10879 10880 10881 10882 10883 10884 10885 10886 10887 10888 10889 10890 10891 10892 10893 10894 10895 10896 10897 10898 10899 10900 10901 10902 10903 10904 10905 10906 10907 10908 10909 10910 10911 10912 10913 10914 10915 10916 10917 10918 10919 10920 10921 10922 10923 10924 10925 10926 10927 10928 10929 10930 10931 10932 10933 10934 10935 10936 10937 10938 10939 10940 10941 10942 10943 10944 10945 10946 10947 10948 10949 10950 10951 10952 10953 10954 10955 10956 10957 10958 10959 10960 10961 10962 10963 10964 10965 10966 10967 10968 10969 10970 10971 10972 10973 10974 10975 10976 10977 10978 10979 10980 10981 10982 10983 10984 10985 10986 10987 10988 10989 10990 10991 10992 10993 10994 10995 10996 10997 10998 10999 11000 11001 11002 11003 11004 11005 11006 11007 11008 11009 11010 11011 11012 11013 11014 11015 11016 11017 11018 11019 11020 11021 11022 11023 11024 11025 11026 11027 11028 11029 11030 11031 11032 11033 11034 11035 11036 11037 11038 11039 11040 11041 11042 11043 11044 11045 11046 11047 11048 11049 11050 11051 11052 11053 11054 11055 11056 11057 11058 11059 11060 11061 11062 11063 11064 11065 11066 11067 11068 11069 11070 11071 11072 11073 11074 11075 11076 11077 11078 11079 11080 11081 11082 11083 11084 11085 11086 11087 11088 11089 11090 11091 11092 11093 11094 11095 11096 11097 11098 11099 11100 11101 11102 11103 11104 11105 11106 11107 11108 11109 11110 11111 11112 11113 11114 11115 11116 11117 11118 11119 11120 11121 11122 11123 11124 11125 11126 11127 11128 11129 11130 11131 11132 11133 11134 11135 11136 11137 11138 11139 11140 11141 11142 11143 11144 11145 11146 11147 11148 11149 11150 11151 11152 11153 11154 11155 11156 11157 11158 11159 11160 11161 11162 11163 11164 11165 11166 11167 11168 11169 11170 11171 11172 11173 11174 11175 11176 11177 11178 11179 11180 11181 11182 11183 11184 11185 11186 11187 11188 11189 11190 11191 11192 11193 11194 11195 11196 11197 11198 11199 11200 11201 11202 11203 11204 11205 11206 11207 11208 11209 11210 11211 11212 11213 11214 11215 11216 11217 11218 11219 11220 11221 11222 11223 11224 11225 11226 11227 11228 11229 11230 11231 11232 11233 11234 11235 11236 11237 11238 11239 11240 11241 11242 11243 11244 11245 11246 11247 11248 11249 11250 11251 11252 11253 11254 11255 11256 11257 11258 11259 11260 11261 11262 11263 11264 11265 11266 11267 11268 11269 11270 11271 11272 11273 11274 11275 11276 11277 11278 11279 11280 11281 11282 11283 11284 11285 11286 11287 11288 11289 11290 11291 11292 11293 11294 11295 11296 11297 11298 11299 11300 11301 11302 11303 11304 11305 11306 11307 11308 11309 11310 11311 11312 11313 11314 11315 11316 11317 11318 11319 11320 11321 11322 11323 11324 11325 11326 11327 11328 11329 11330 11331 11332 11333 11334 11335 11336 11337 11338 11339 11340 11341 11342 11343 11344 11345 11346 11347 11348 11349 11350 11351 11352 11353 11354 11355 11356 11357 11358 11359 11360 11361 11362 11363 11364 11365 11366 11367 11368 11369 11370 11371 11372 11373 11374 11375 11376 11377 11378 11379 11380 11381 11382 11383 11384 11385 11386 11387 11388 11389 11390 11391 11392 11393 11394 11395 11396 11397 11398 11399 11400 11401 11402 11403 11404 11405 11406 11407 11408 11409 11410 11411 11412 11413 11414 11415 11416 11417 11418 11419 11420 11421 11422 11423 11424 11425 11426 11427 11428 11429 11430 11431 11432 11433 11434 11435 11436 11437 11438 11439 11440 11441 11442 11443 11444 11445 11446 11447 11448 11449 11450 11451 11452 11453 11454 11455 11456 11457 11458 11459 11460 11461 11462 11463 11464 11465 11466 11467 11468 11469 11470 11471 11472 11473 11474 11475 11476 11477 11478 11479 11480 11481 11482 11483 11484 11485 11486 11487 11488 11489 11490 11491 11492 11493 11494 11495 11496 11497 11498 11499 11500 11501 11502 11503 11504 11505 11506 11507 11508 11509 11510 11511 11512 11513 11514 11515 11516 11517 11518 11519 11520 11521 11522 11523 11524 11525 11526 11527 11528 11529 11530 11531 11532 11533 11534 11535 11536 11537 11538 11539 11540 11541 11542 11543 11544 11545 11546 11547 11548 11549 11550 11551 11552 11553 11554 11555 11556 11557 11558 11559 11560 11561 11562 11563 11564 11565 11566 11567 11568 11569 11570 11571 11572 11573 11574 11575 11576 11577 11578 11579 11580 11581 11582 11583 11584 11585 11586 11587 11588 11589 11590 11591 11592 11593 11594 11595 11596 11597 11598 11599 11600 11601 11602 11603 11604 11605 11606 11607 11608 11609 11610 11611 11612 11613 11614 11615 11616 11617 11618 11619 11620 11621 11622 11623 11624 11625 11626 11627 11628 11629 11630 11631 11632 11633 11634 11635 11636 11637 11638 11639 11640 11641 11642 11643 11644 11645 11646 11647 11648 11649 11650 11651 11652 11653 11654 11655 11656 11657 11658 11659 11660 11661 11662 11663 11664 11665 11666 11667 11668 11669 11670 11671 11672 11673 11674 11675 11676 11677 11678 11679 11680 11681 11682 11683 11684 11685 11686 11687 11688 11689 11690 11691 11692 11693 11694 11695 11696 11697 11698 11699 11700 11701 11702 11703 11704 11705 11706 11707 11708 11709 11710 11711 11712 11713 11714 11715 11716 11717 11718 11719 11720 11721 11722 11723 11724 11725 11726 11727 11728 11729 11730 11731 11732 11733 11734 11735 11736 11737 11738 11739 11740 11741 11742 11743 11744 11745 11746 11747 11748 11749 11750 11751 11752 11753 11754 11755 11756 11757 11758 11759 11760 11761 11762 11763 11764 11765 11766 11767 11768 11769 11770 11771 11772 11773 11774 11775 11776 11777 11778 11779 11780 11781 11782 11783 11784 11785 11786 11787 11788 11789 11790 11791 11792 11793 11794 11795 11796 11797 11798 11799 11800 11801 11802 11803 11804 11805 11806 11807 11808 11809 11810 11811 11812 11813 11814 11815 11816 11817 11818 11819 11820 11821 11822 11823 11824 11825 11826 11827 11828 11829 11830 11831 11832 11833 11834 11835 11836 11837 11838 11839 11840 11841 11842 11843 11844 11845 11846 11847 11848 11849 11850 11851 11852 11853 11854 11855 11856 11857 11858 11859 11860 11861 11862 11863 11864 11865 11866 11867 11868 11869 11870 11871 11872 11873 11874 11875 11876 11877 11878 11879 11880 11881 11882 11883 11884 11885 11886 11887 11888 11889 11890 11891 11892 11893 11894 11895 11896 11897 11898 11899 11900 11901 11902 11903 11904 11905 11906 11907 11908 11909 11910 11911 11912 11913 11914 11915 11916 11917 11918 11919 11920 11921 11922 11923 11924 11925 11926 11927 11928 11929 11930 11931 11932 11933 11934 11935 11936 11937 11938 11939 11940 11941 11942 11943 11944 11945 11946 11947 11948 11949 11950 11951 11952 11953 11954 11955 11956 11957 11958 11959 11960 11961 11962 11963 11964 11965 11966 11967 11968 11969 11970 11971 11972 11973 11974 11975 11976 11977 11978 11979 11980 11981 11982 11983 11984 11985 11986 11987 11988 11989 11990 11991 11992 11993 11994 11995 11996 11997 11998 11999 12000 12001 12002 12003 12004 12005 12006 12007 12008 12009 12010 12011 12012 12013 12014 12015 12016 12017 12018 12019 12020 12021 12022 12023 12024 12025 12026 12027 12028 12029 12030 12031 12032 12033 12034 12035 12036 12037 12038 12039 12040 12041 12042 12043 12044 12045 12046 12047 12048 12049 12050 12051 12052 12053 12054 12055 12056 12057 12058 12059 12060 12061 12062 12063 12064 12065 12066 12067 12068 12069 12070 12071 12072 12073 12074 12075 12076 12077 12078 12079 12080 12081 12082 12083 12084 12085 12086 12087 12088 12089 12090 12091 12092 12093 12094 12095 12096 12097 12098 12099 12100 12101 12102 12103 12104 12105 12106 12107 12108 12109 12110 12111 12112 12113 12114 12115 12116 12117 12118 12119 12120 12121 12122 12123 12124 12125 12126 12127 12128 12129 12130 12131 12132 12133 12134 12135 12136 12137 12138 12139 12140 12141 12142 12143 12144 12145 12146 12147 12148 12149 12150 12151 12152 12153 12154 12155 12156 12157 12158 12159 12160 12161 12162 12163 12164 12165 12166 12167 12168 12169 12170 12171 12172 12173 12174 12175 12176 12177 12178 12179 12180 12181 12182 12183 12184 12185 12186 12187 12188 12189 12190 12191 12192 12193 12194 12195 12196 12197 12198 12199 12200 12201 12202 12203 12204 12205 12206 12207 12208 12209 12210 12211 12212 12213 12214 12215 12216 12217 12218 12219 12220 12221 12222 12223 12224 12225 12226 12227 12228 12229 12230 12231 12232 12233 12234 12235 12236 12237 12238 12239 12240 12241 12242 12243 12244 12245 12246 12247 12248 12249 12250 12251 12252 12253 12254 12255 12256 12257 12258 12259 12260 12261 12262 12263 12264 12265 12266 12267 12268 12269 12270 12271 12272 12273 12274 12275 12276 12277 12278 12279 12280 12281 12282 12283 12284 12285 12286 12287 12288 12289 12290 12291 12292 12293 12294 12295 12296 12297 12298 12299 12300 12301 12302 12303 12304 12305 12306 12307 12308 12309 12310 12311 12312 12313 12314 12315 12316 12317 12318 12319 12320 12321 12322 12323 12324 12325 12326 12327 12328 12329 12330 12331 12332 12333 12334 12335 12336 12337 12338 12339 12340 12341 12342 12343 12344 12345 12346 12347 12348 12349 12350 12351 12352 12353 12354 12355 12356 12357 12358 12359 12360 12361 12362 12363 12364 12365 12366 12367 12368 12369 12370 12371 12372 12373 12374 12375 12376 12377 12378 12379 12380 12381 12382 12383 12384 12385 12386 12387 12388 12389 12390 12391 12392 12393 12394 12395 12396 12397 12398 12399 12400 12401 12402 12403 12404 12405 12406 12407 12408 12409 12410 12411 12412 12413 12414 12415 12416 12417 12418 12419 12420 12421 12422 12423 12424 12425 12426 12427 12428 12429 12430 12431 12432 12433 12434 12435 12436 12437 12438 12439 12440 12441 12442 12443 12444 12445 12446 12447 12448 12449 12450 12451 12452 12453 12454 12455 12456 12457 12458 12459 12460 12461 12462 12463 12464 12465 12466 12467 12468 12469 12470 12471 12472 12473 12474 12475 12476 12477 12478 12479 12480 12481 12482 12483 12484 12485 12486 12487 12488 12489 12490 12491 12492 12493 12494 12495 12496 12497 12498 12499 12500 12501 12502 12503 12504 12505 12506 12507 12508 12509 12510 12511 12512 12513 12514 12515 12516 12517 12518 12519 12520 12521 12522 12523 12524 12525 12526 12527 12528 12529 12530 12531 12532 12533 12534 12535 12536 12537 12538 12539 12540 12541 12542 12543 12544 12545 12546 12547 12548 12549 12550 12551 12552 12553 12554 12555 12556 12557 12558 12559 12560 12561 12562 12563 12564 12565 12566 12567 12568 12569 12570 12571 12572 12573 12574 12575 12576 12577 12578 12579 12580 12581 12582 12583 12584 12585 12586 12587 12588 12589 12590 12591 12592 12593 12594 12595 12596 12597 12598 12599 12600 12601 12602 12603 12604 12605 12606 12607 12608 12609 12610 12611 12612 12613 12614 12615 12616 12617 12618 12619 12620 12621 12622 12623 12624 12625 12626 12627 12628 12629 12630 12631 12632 12633 12634 12635 12636 12637 12638 12639 12640 12641 12642 12643 12644 12645 12646 12647 12648 12649 12650 12651 12652 12653 12654 12655 12656 12657 12658 12659 12660 12661 12662 12663 12664 12665 12666 12667 12668 12669 12670 12671 12672 12673 12674 12675 12676 12677 12678 12679 12680 12681 12682 12683 12684 12685 12686 12687 12688 12689 12690 12691 12692 12693 12694 12695 12696 12697 12698 12699 12700 12701 12702 12703 12704 12705 12706 12707 12708 12709 12710 12711 12712 12713 12714 12715 12716 12717 12718 12719 12720 12721 12722 12723 12724 12725 12726 12727 12728 12729 12730 12731 12732 12733 12734 12735 12736 12737 12738 12739 12740 12741 12742 12743 12744 12745 12746 12747 12748 12749 12750 12751 12752 12753 12754 12755 12756 12757 12758 12759 12760 12761 12762 12763 12764 12765 12766 12767 12768 12769 12770 12771 12772 12773 12774 12775 12776 12777 12778 12779 12780 12781 12782 12783 12784 12785 12786 12787 12788 12789 12790 12791 12792 12793 12794 12795 12796 12797 12798 12799 12800 12801 12802 12803 12804 12805 12806 12807 12808 12809 12810 12811 12812 12813 12814 12815 12816 12817 12818 12819 12820 12821 12822 12823 12824 12825 12826 12827 12828 12829 12830 12831 12832 12833 12834 12835 12836 12837 12838 12839 12840 12841 12842 12843 12844 12845 12846 12847 12848 12849 12850 12851 12852 12853 12854 12855 12856 12857 12858 12859 12860 12861 12862 12863 12864 12865 12866 12867 12868 12869 12870 12871 12872 12873 12874 12875 12876 12877 12878 12879 12880 12881 12882 12883 12884 12885 12886 12887 12888 12889 12890 12891 12892 12893 12894 12895 12896 12897 12898 12899 12900 12901 12902 12903 12904 12905 12906 12907 12908 12909 12910 12911 12912 12913 12914 12915 12916 12917 12918 12919 12920 12921 12922 12923 12924 12925 12926 12927 12928 12929 12930 12931 12932 12933 12934 12935 12936 12937 12938 12939 12940 12941 12942 12943 12944 12945 12946 12947 12948 12949 12950 12951 12952 12953 12954 12955 12956 12957 12958 12959 12960 12961 12962 12963 12964 12965 12966 12967 12968 12969 12970 12971 12972 12973 12974 12975 12976 12977 12978 12979 12980 12981 12982 12983 12984 12985 12986 12987 12988 12989 12990 12991 12992 12993 12994 12995 12996 12997 12998 12999 13000 13001 13002 13003 13004 13005 13006 13007 13008 13009 13010 13011 13012 13013 13014 13015 13016 13017 13018 13019 13020 13021 13022 13023 13024 13025 13026 13027 13028 13029 13030 13031 13032 13033 13034 13035 13036 13037 13038 13039 13040 13041 13042 13043 13044 13045 13046 13047 13048 13049 13050 13051 13052 13053 13054 13055 13056 13057 13058 13059 13060 13061 13062 13063 13064 13065 13066 13067 13068 13069 13070 13071 13072 13073 13074 13075 13076 13077 13078 13079 13080 13081 13082 13083 13084 13085 13086 13087 13088 13089 13090 13091 13092 13093 13094 13095 13096 13097 13098 13099 13100 13101 13102 13103 13104 13105 13106 13107 13108 13109 13110 13111 13112 13113 13114 13115 13116 13117 13118 13119 13120 13121 13122 13123 13124 13125 13126 13127 13128 13129 13130 13131 13132 13133 13134 13135 13136 13137 13138 13139 13140 13141 13142 13143 13144 13145 13146 13147 13148 13149 13150 13151 13152 13153 13154 13155 13156 13157 13158 13159 13160 13161 13162 13163 13164 13165 13166 13167 13168 13169 13170 13171 13172 13173 13174 13175 13176 13177 13178 13179 13180 13181 13182 13183 13184 13185 13186 13187 13188 13189 13190 13191 13192 13193 13194 13195 13196 13197 13198 13199 13200 13201 13202 13203 13204 13205 13206 13207 13208 13209 13210 13211 13212 13213 13214 13215 13216 13217 13218 13219 13220 13221 13222 13223 13224 13225 13226 13227 13228 13229 13230 13231 13232 13233 13234 13235 13236 13237 13238 13239 13240 13241 13242 13243 13244 13245 13246 13247 13248 13249 13250 13251 13252 13253 13254 13255 13256 13257 13258 13259 13260 13261 13262 13263 13264 13265 13266 13267 13268 13269 13270 13271 13272 13273 13274 13275 13276 13277 13278 13279 13280 13281 13282 13283 13284 13285 13286 13287 13288 13289 13290 13291 13292 13293 13294 13295 13296 13297 13298 13299 13300 13301 13302 13303 13304 13305 13306 13307 13308 13309 13310 13311 13312 13313 13314 13315 13316 13317 13318 13319 13320 13321 13322 13323 13324 13325 13326 13327 13328 13329 13330 13331 13332 13333 13334 13335 13336 13337 13338 13339 13340 13341 13342 13343 13344 13345 13346 13347 13348 13349 13350 13351 13352 13353 13354 13355 13356 13357 13358 13359 13360 13361 13362 13363 13364 13365 13366 13367 13368 13369 13370 13371 13372 13373 13374 13375 13376 13377 13378 13379 13380 13381 13382 13383 13384 13385 13386 13387 13388 13389 13390 13391 13392 13393 13394 13395 13396 13397 13398 13399 13400 13401 13402 13403 13404 13405 13406 13407 13408 13409 13410 13411 13412 13413 13414 13415 13416 13417 13418 13419 13420 13421 13422 13423 13424 13425 13426 13427 13428 13429 13430 13431 13432 13433 13434 13435 13436 13437 13438 13439 13440 13441 13442 13443 13444 13445 13446 13447 13448 13449 13450 13451 13452 13453 13454 13455 13456 13457 13458 13459 13460 13461 13462 13463 13464 13465 13466 13467 13468 13469 13470 13471 13472 13473 13474 13475 13476 13477 13478 13479 13480 13481 13482 13483 13484 13485 13486 13487 13488 13489 13490 13491 13492 13493 13494 13495 13496 13497 13498 13499 13500 13501 13502 13503 13504 13505 13506 13507 13508 13509 13510 13511 13512 13513 13514 13515 13516 13517 13518 13519 13520 13521 13522 13523 13524 13525 13526 13527 13528 13529 13530 13531 13532 13533 13534 13535 13536 13537 13538 13539 13540 13541 13542 13543 13544 13545 13546 13547 13548 13549 13550 13551 13552 13553 13554 13555 13556 13557 13558 13559 13560 13561 13562 13563 13564 13565 13566 13567 13568 13569 13570 13571 13572 13573 13574 13575 13576 13577 13578 13579 13580 13581 13582 13583 13584 13585 13586 13587 13588 13589 13590 13591 13592 13593 13594 13595 13596 13597 13598 13599 13600 13601 13602 13603 13604 13605 13606 13607 13608 13609 13610 13611 13612 13613 13614 13615 13616 13617 13618 13619 13620 13621 13622 13623 13624 13625 13626 13627 13628 13629 13630 13631 13632 13633 13634 13635 13636 13637 13638 13639 13640 13641 13642 13643 13644 13645 13646 13647 13648 13649 13650 13651 13652 13653 13654 13655 13656 13657 13658 13659 13660 13661 13662 13663 13664 13665 13666 13667 13668 13669 13670 13671 13672 13673 13674 13675 13676 13677 13678 13679 13680 13681 13682 13683 13684 13685 13686 13687 13688 13689 13690 13691 13692 13693 13694 13695 13696 13697 13698 13699 13700 13701 13702 13703 13704 13705 13706 13707 13708 13709 13710 13711 13712 13713 13714 13715 13716 13717 13718 13719 13720 13721 13722 13723 13724 13725 13726 13727 13728 13729 13730 13731 13732 13733 13734 13735 13736 13737 13738 13739 13740 13741 13742 13743 13744 13745 13746 13747 13748 13749 13750 13751 13752 13753 13754 13755 13756 13757 13758 13759 13760 13761 13762 13763 13764 13765 13766 13767 13768 13769 13770 13771 13772 13773 13774 13775 13776 13777 13778 13779 13780 13781 13782 13783 13784 13785 13786 13787 13788 13789 13790 13791 13792 13793 13794 13795 13796 13797 13798 13799 13800 13801 13802 13803 13804 13805 13806 13807 13808 13809 13810 13811 13812 13813 13814 13815 13816 13817 13818 13819 13820 13821 13822 13823 13824 13825 13826 13827 13828 13829 13830 13831 13832 13833 13834 13835 13836 13837 13838 13839 13840 13841 13842 13843 13844 13845 13846 13847 13848 13849 13850 13851 13852 13853 13854 13855 13856 13857 13858 13859 13860 13861 13862 13863 13864 13865 13866 13867 13868 13869 13870 13871 13872 13873 13874 13875 13876 13877 13878 13879 13880 13881 13882 13883 13884 13885 13886 13887 13888 13889 13890 13891 13892 13893 13894 13895 13896 13897 13898 13899 13900 13901 13902 13903 13904 13905 13906 13907 13908 13909 13910 13911 13912 13913 13914 13915 13916 13917 13918 13919 13920 13921 13922 13923 13924 13925 13926 13927 13928 13929 13930 13931 13932 13933 13934 13935 13936 13937 13938 13939 13940 13941 13942 13943 13944 13945 13946 13947 13948 13949 13950 13951 13952 13953 13954 13955 13956 13957 13958 13959 13960 13961 13962 13963 13964 13965 13966 13967 13968 13969 13970 13971 13972 13973 13974 13975 13976 13977 13978 13979 13980 13981 13982 13983 13984 13985 13986 13987 13988 13989 13990 13991 13992 13993 13994 13995 13996 13997 13998 13999 14000 14001 14002 14003 14004 14005 14006 14007 14008 14009 14010 14011 14012 14013 14014 14015 14016 14017 14018 14019 14020 14021 14022 14023 14024 14025 14026 14027 14028 14029 14030 14031 14032 14033 14034 14035 14036 14037 14038 14039 14040 14041 14042 14043 14044 14045 14046 14047 14048 14049 14050 14051 14052 14053 14054 14055 14056 14057 14058 14059 14060 14061 14062 14063 14064 14065 14066 14067 14068 14069 14070 14071 14072 14073 14074 14075 14076 14077 14078 14079 14080 14081 14082 14083 14084 14085 14086 14087 14088 14089 14090 14091 14092 14093 14094 14095 14096 14097 14098 14099 14100 14101 14102 14103 14104 14105 14106 14107 14108 14109 14110 14111 14112 14113 14114 14115 14116 14117 14118 14119 14120 14121 14122 14123 14124 14125 14126 14127 14128 14129 14130 14131 14132 14133 14134 14135 14136 14137 14138 14139 14140 14141 14142 14143 14144 14145 14146 14147 14148 14149 14150 14151 14152 14153 14154 14155 14156 14157 14158 14159 14160 14161 14162 14163 14164 14165 14166 14167 14168 14169 14170 14171 14172 14173 14174 14175 14176 14177 14178 14179 14180 14181 14182 14183 14184 14185 14186 14187 14188 14189 14190 14191 14192 14193 14194 14195 14196 14197 14198 14199 14200 14201 14202 14203 14204 14205 14206 14207 14208 14209 14210 14211 14212 14213 14214 14215 14216 14217 14218 14219 14220 14221 14222 14223 14224 14225 14226 14227 14228 14229 14230 14231 14232 14233 14234 14235 14236 14237 14238 14239 14240 14241 14242 14243 14244 14245 14246 14247 14248 14249 14250 14251 14252 14253 14254 14255 14256 14257 14258 14259 14260 14261 14262 14263 14264 14265 14266 14267 14268 14269 14270 14271 14272 14273 14274 14275 14276 14277 14278 14279 14280 14281 14282 14283 14284 14285 14286 14287 14288 14289 14290 14291 14292 14293 14294 14295 14296 14297 14298 14299 14300 14301 14302 14303 14304 14305 14306 14307 14308 14309 14310 14311 14312 14313 14314 14315 14316 14317 14318 14319 14320 14321 14322 14323 14324 14325 14326 14327 14328 14329 14330 14331 14332 14333 14334 14335 14336 14337 14338 14339 14340 14341 14342 14343 14344 14345 14346 14347 14348 14349 14350 14351 14352 14353 14354 14355 14356 14357 14358 14359 14360 14361 14362 14363 14364 14365 14366 14367 14368 14369 14370 14371 14372 14373 14374 14375 14376 14377 14378 14379 14380 14381 14382 14383 14384 14385 14386 14387 14388 14389 14390 14391 14392 14393 14394 14395 14396 14397 14398 14399 14400 14401 14402 14403 14404 14405 14406 14407 14408 14409 14410 14411 14412 14413 14414 14415 14416 14417 14418 14419 14420 14421 14422 14423 14424 14425 14426 14427 14428 14429 14430 14431 14432 14433 14434 14435 14436 14437 14438 14439 14440 14441 14442 14443 14444 14445 14446 14447 14448 14449 14450 14451 14452 14453 14454 14455 14456 14457 14458 14459 14460 14461 14462 14463 14464 14465 14466 14467 14468 14469 14470 14471 14472 14473 14474 14475 14476 14477 14478 14479 14480 14481 14482 14483 14484 14485 14486 14487 14488 14489 14490 14491 14492 14493 14494 14495 14496 14497 14498 14499 14500 14501 14502 14503 14504 14505 14506 14507 14508 14509 14510 14511 14512 14513 14514 14515 14516 14517 14518 14519 14520 14521 14522 14523 14524 14525 14526 14527 14528 14529 14530 14531 14532 14533 14534 14535 14536 14537 14538 14539 14540 14541 14542 14543 14544 14545 14546 14547 14548 14549 14550 14551 14552 14553 14554 14555 14556 14557 14558 14559 14560 14561 14562 14563 14564 14565 14566 14567 14568 14569 14570 14571 14572 14573 14574 14575 14576 14577 14578 14579 14580 14581 14582 14583 14584 14585 14586 14587 14588 14589 14590 14591 14592 14593 14594 14595 14596 14597 14598 14599 14600 14601 14602 14603 14604 14605 14606 14607 14608 14609 14610 14611 14612 14613 14614 14615 14616 14617 14618 14619 14620 14621 14622 14623 14624 14625 14626 14627 14628 14629 14630 14631 14632 14633 14634 14635 14636 14637 14638 14639 14640 14641 14642 14643 14644 14645 14646 14647 14648 14649 14650 14651 14652 14653 14654 14655 14656 14657 14658 14659 14660 14661 14662 14663 14664 14665 14666 14667 14668 14669 14670 14671 14672 14673 14674 14675 14676 14677 14678 14679 14680 14681 14682 14683 14684 14685 14686 14687 14688 14689 14690 14691 14692 14693 14694 14695 14696 14697 14698 14699 14700 14701 14702 14703 14704 14705 14706 14707 14708 14709 14710 14711 14712 14713 14714 14715 14716 14717 14718 14719 14720 14721 14722 14723 14724 14725 14726 14727 14728 14729 14730 14731 14732 14733 14734 14735 14736 14737 14738 14739 14740 14741 14742 14743 14744 14745 14746 14747 14748 14749 14750 14751 14752 14753 14754 14755 14756 14757 14758 14759 14760 14761 14762 14763 14764 14765 14766 14767 14768 14769 14770 14771 14772 14773 14774 14775 14776 14777 14778 14779 14780 14781 14782 14783 14784 14785 14786 14787 14788 14789 14790 14791 14792 14793 14794 14795 14796 14797 14798 14799 14800 14801 14802 14803 14804 14805 14806 14807 14808 14809 14810 14811 14812 14813 14814 14815 14816 14817 14818 14819 14820 14821 14822 14823 14824 14825 14826 14827 14828 14829 14830 14831 14832 14833 14834 14835 14836 14837 14838 14839 14840 14841 14842 14843 14844 14845 14846 14847 14848 14849 14850 14851 14852 14853 14854 14855 14856 14857 14858 14859 14860 14861 14862 14863 14864 14865 14866 14867 14868 14869 14870 14871 14872 14873 14874 14875 14876 14877 14878 14879 14880 14881 14882 14883 14884 14885 14886 14887 14888 14889 14890 14891 14892 14893 14894 14895 14896 14897 14898 14899 14900 14901 14902 14903 14904 14905 14906 14907 14908 14909 14910 14911 14912 14913 14914 14915 14916 14917 14918 14919 14920 14921 14922 14923 14924 14925 14926 14927 14928 14929 14930 14931 14932 14933 14934 14935 14936 14937 14938 14939 14940 14941 14942 14943 14944 14945 14946 14947 14948 14949 14950 14951 14952 14953 14954 14955 14956 14957 14958 14959 14960 14961 14962 14963 14964 14965 14966 14967 14968 14969 14970 14971 14972 14973 14974 14975 14976 14977 14978 14979 14980 14981 14982 14983 14984 14985 14986 14987 14988 14989 14990 14991 14992 14993 14994 14995 14996 14997 14998 14999 15000 15001 15002 15003 15004 15005 15006 15007 15008 15009 15010 15011 15012 15013 15014 15015 15016 15017 15018 15019 15020 15021 15022 15023 15024 15025 15026 15027 15028 15029 15030 15031 15032 15033 15034 15035 15036 15037 15038 15039 15040 15041 15042 15043 15044 15045 15046 15047 15048 15049 15050 15051 15052 15053 15054 15055 15056 15057 15058 15059 15060 15061 15062 15063 15064 15065 15066 15067 15068 15069 15070 15071 15072 15073 15074 15075 15076 15077 15078 15079 15080 15081 15082 15083 15084 15085 15086 15087 15088 15089 15090 15091 15092 15093 15094 15095 15096 15097 15098 15099 15100 15101 15102 15103 15104 15105 15106 15107 15108 15109 15110 15111 15112 15113 15114 15115 15116 15117 15118 15119 15120 15121 15122 15123 15124 15125 15126 15127 15128 15129 15130 15131 15132 15133 15134 15135 15136 15137 15138 15139 15140 15141 15142 15143 15144 15145 15146 15147 15148 15149 15150 15151 15152 15153 15154 15155 15156 15157 15158 15159 15160 15161 15162 15163 15164 15165 15166 15167 15168 15169 15170 15171 15172 15173 15174 15175 15176 15177 15178 15179 15180 15181 15182 15183 15184 15185 15186 15187 15188 15189 15190 15191 15192 15193 15194 15195 15196 15197 15198 15199 15200 15201 15202 15203 15204 15205 15206 15207 15208 15209 15210 15211 15212 15213 15214 15215 15216 15217 15218 15219 15220 15221 15222 15223 15224 15225 15226 15227 15228 15229 15230 15231 15232 15233 15234 15235 15236 15237 15238 15239 15240 15241 15242 15243 15244 15245 15246 15247 15248 15249 15250 15251 15252 15253 15254 15255 15256 15257 15258 15259 15260 15261 15262 15263 15264 15265 15266 15267 15268 15269 15270 15271 15272 15273 15274 15275 15276 15277 15278 15279 15280 15281 15282 15283 15284 15285 15286 15287 15288 15289 15290 15291 15292 15293 15294 15295 15296 15297 15298 15299 15300 15301 15302 15303 15304 15305 15306 15307 15308 15309 15310 15311 15312 15313 15314 15315 15316 15317 15318 15319 15320 15321 15322 15323 15324 15325 15326 15327 15328 15329 15330 15331 15332 15333 15334 15335 15336 15337 15338 15339 15340 15341 15342 15343 15344 15345 15346 15347 15348 15349 15350 15351 15352 15353 15354 15355 15356 15357 15358 15359 15360 15361 15362 15363 15364 15365 15366 15367 15368 15369 15370 15371 15372 15373 15374 15375 15376 15377 15378 15379 15380 15381 15382 15383 15384 15385 15386 15387 15388 15389 15390 15391 15392 15393 15394 15395 15396 15397 15398 15399 15400 15401 15402 15403 15404 15405 15406 15407 15408 15409 15410 15411 15412 15413 15414 15415 15416 15417 15418 15419 15420 15421 15422 15423 15424 15425 15426 15427 15428 15429 15430 15431 15432 15433 15434 15435 15436 15437 15438 15439 15440 15441 15442 15443 15444 15445 15446 15447 15448 15449 15450 15451 15452 15453 15454 15455 15456 15457 15458 15459 15460 15461 15462 15463 15464 15465 15466 15467 15468 15469 15470 15471 15472 15473 15474 15475 15476 15477 15478 15479 15480 15481 15482 15483 15484 15485 15486 15487 15488 15489 15490 15491 15492 15493 15494 15495 15496 15497 15498 15499 15500 15501 15502 15503 15504 15505 15506 15507 15508 15509 15510 15511 15512 15513 15514 15515 15516 15517 15518 15519 15520 15521 15522 15523 15524 15525 15526 15527 15528 15529 15530 15531 15532 15533 15534 15535 15536 15537 15538 15539 15540 15541 15542 15543 15544 15545 15546 15547 15548 15549 15550 15551 15552 15553 15554 15555 15556 15557 15558 15559 15560 15561 15562 15563 15564 15565 15566 15567 15568 15569 15570 15571 15572 15573 15574 15575 15576 15577 15578 15579 15580 15581 15582 15583 15584 15585 15586 15587 15588 15589 15590 15591 15592 15593 15594 15595 15596 15597 15598 15599 15600 15601 15602 15603 15604 15605 15606 15607 15608 15609 15610 15611 15612 15613 15614 15615 15616 15617 15618 15619 15620 15621 15622 15623 15624 15625 15626 15627 15628 15629 15630 15631 15632 15633 15634 15635 15636 15637 15638 15639 15640 15641 15642 15643 15644 15645 15646 15647 15648 15649 15650 15651 15652 15653 15654 15655 15656 15657 15658 15659 15660 15661 15662 15663 15664 15665 15666 15667 15668 15669 15670 15671 15672 15673 15674 15675 15676 15677 15678 15679 15680 15681 15682 15683 15684 15685 15686 15687 15688 15689 15690 15691 15692 15693 15694 15695 15696 15697 15698 15699 15700 15701 15702 15703 15704 15705 15706 15707 15708 15709 15710 15711 15712 15713 15714 15715 15716 15717 15718 15719 15720 15721 15722 15723 15724 15725 15726 15727 15728 15729 15730 15731 15732 15733 15734 15735 15736 15737 15738 15739 15740 15741 15742 15743 15744 15745 15746 15747 15748 15749 15750 15751 15752 15753 15754 15755 15756 15757 15758 15759 15760 15761 15762 15763 15764 15765 15766 15767 15768 15769 15770 15771 15772 15773 15774 15775 15776 15777 15778 15779 15780 15781 15782 15783 15784 15785 15786 15787 15788 15789 15790 15791 15792 15793 15794 15795 15796 15797 15798 15799 15800 15801 15802 15803 15804 15805 15806 15807 15808 15809 15810 15811 15812 15813 15814 15815 15816 15817 15818 15819 15820 15821 15822 15823 15824 15825 15826 15827 15828 15829 15830 15831 15832 15833 15834 15835 15836 15837 15838 15839 15840 15841 15842 15843 15844 15845 15846 15847 15848 15849 15850 15851 15852 15853 15854 15855 15856 15857 15858 15859 15860 15861 15862 15863 15864 15865 15866 15867 15868 15869 15870 15871 15872 15873 15874 15875 15876 15877 15878 15879 15880 15881 15882 15883 15884 15885 15886 15887 15888 15889 15890 15891 15892 15893 15894 15895 15896 15897 15898 15899 15900 15901 15902 15903 15904 15905 15906 15907 15908 15909 15910 15911 15912 15913 15914 15915 15916 15917 15918 15919 15920 15921 15922 15923 15924 15925 15926 15927 15928 15929 15930 15931 15932 15933 15934 15935 15936 15937 15938 15939 15940 15941 15942 15943 15944 15945 15946 15947 15948 15949 15950 15951 15952 15953 15954 15955 15956 15957 15958 15959 15960 15961 15962 15963 15964 15965 15966 15967 15968 15969 15970 15971 15972 15973 15974 15975 15976 15977 15978 15979 15980 15981 15982 15983 15984 15985 15986 15987 15988 15989 15990 15991 15992 15993 15994 15995 15996 15997 15998 15999 16000 16001 16002 16003 16004 16005 16006 16007 16008 16009 16010 16011 16012 16013 16014 16015 16016 16017 16018 16019 16020 16021 16022 16023 16024 16025 16026 16027 16028 16029 16030 16031 16032 16033 16034 16035 16036 16037 16038 16039 16040 16041 16042 16043 16044 16045 16046 16047 16048 16049 16050 16051 16052 16053 16054 16055 16056 16057 16058 16059 16060 16061 16062 16063 16064 16065 16066 16067 16068 16069 16070 16071 16072 16073 16074 16075 16076 16077 16078 16079 16080 16081 16082 16083 16084 16085 16086 16087 16088 16089 16090 16091 16092 16093 16094 16095 16096 16097 16098 16099 16100 16101 16102 16103 16104 16105 16106 16107 16108 16109 16110 16111 16112 16113 16114 16115 16116 16117 16118 16119 16120 16121 16122 16123 16124 16125 16126 16127 16128 16129 16130 16131 16132 16133 16134 16135 16136 16137 16138 16139 16140 16141 16142 16143 16144 16145 16146 16147 16148 16149 16150 16151 16152 16153 16154 16155 16156 16157 16158 16159 16160 16161 16162 16163 16164 16165 16166 16167 16168 16169 16170 16171 16172 16173 16174 16175 16176 16177 16178 16179 16180 16181 16182 16183 16184 16185 16186 16187 16188 16189 16190 16191 16192 16193 16194 16195 16196 16197 16198 16199 16200 16201 16202 16203 16204 16205 16206 16207 16208 16209 16210 16211 16212 16213 16214 16215 16216 16217 16218 16219 16220 16221 16222 16223 16224 16225 16226 16227 16228 16229 16230 16231 16232 16233 16234 16235 16236 16237 16238 16239 16240 16241 16242 16243 16244 16245 16246 16247 16248 16249 16250 16251 16252 16253 16254 16255 16256 16257 16258 16259 16260 16261 16262 16263 16264 16265 16266 16267 16268 16269 16270 16271 16272 16273 16274 16275 16276 16277 16278 16279 16280 16281 16282 16283 16284 16285 16286 16287 16288 16289 16290 16291 16292 16293 16294 16295 16296 16297 16298 16299 16300 16301 16302 16303 16304 16305 16306 16307 16308 16309 16310 16311 16312 16313 16314 16315 16316 16317 16318 16319 16320 16321 16322 16323 16324 16325 16326 16327 16328 16329 16330 16331 16332 16333 16334 16335 16336 16337 16338 16339 16340 16341 16342 16343 16344 16345 16346 16347 16348 16349 16350 16351 16352 16353 16354 16355 16356 16357 16358 16359 16360 16361 16362 16363 16364 16365 16366 16367 16368 16369 16370 16371 16372 16373 16374 16375 16376 16377 16378 16379 16380 16381 16382 16383 16384 16385 16386 16387 16388 16389 16390 16391 16392 16393 16394 16395 16396 16397 16398 16399 16400 16401 16402 16403 16404 16405 16406 16407 16408 16409 16410 16411 16412 16413 16414 16415 16416 16417 16418 16419 16420 16421 16422 16423 16424 16425 16426 16427 16428 16429 16430 16431 16432 16433 16434 16435 16436 16437 16438 16439 16440 16441 16442 16443 16444 16445 16446 16447 16448 16449 16450 16451 16452 16453 16454 16455 16456 16457 16458 16459 16460 16461 16462 16463 16464 16465 16466 16467 16468 16469 16470 16471 16472 16473 16474 16475 16476 16477 16478 16479 16480 16481 16482 16483 16484 16485 16486 16487 16488 16489 16490 16491 16492 16493 16494 16495 16496 16497 16498 16499 16500 16501 16502 16503 16504 16505 16506 16507 16508 16509 16510 16511 16512 16513 16514 16515 16516 16517 16518 16519 16520 16521 16522 16523 16524 16525 16526 16527 16528 16529 16530 16531 16532 16533 16534 16535 16536 16537 16538 16539 16540 16541 16542 16543 16544 16545 16546 16547 16548 16549 16550 16551 16552 16553 16554 16555 16556 16557 16558 16559 16560 16561 16562 16563 16564 16565 16566 16567 16568 16569 16570 16571 16572 16573 16574 16575 16576 16577 16578 16579 16580 16581 16582 16583 16584 16585 16586 16587 16588 16589 16590 16591 16592 16593 16594 16595 16596 16597 16598 16599 16600 16601 16602 16603 16604 16605 16606 16607 16608 16609 16610 16611 16612 16613 16614 16615 16616 16617 16618 16619 16620 16621 16622 16623 16624 16625 16626 16627 16628 16629 16630 16631 16632 16633 16634 16635 16636 16637 16638 16639 16640 16641 16642 16643 16644 16645 16646 16647 16648 16649 16650 16651 16652 16653 16654 16655 16656 16657 16658 16659 16660 16661 16662 16663 16664 16665 16666 16667 16668 16669 16670 16671 16672 16673 16674 16675 16676 16677 16678 16679 16680 16681 16682 16683 16684 16685 16686 16687 16688 16689 16690 16691 16692 16693 16694 16695 16696 16697 16698 16699 16700 16701 16702 16703 16704 16705 16706 16707 16708 16709 16710 16711 16712 16713 16714 16715 16716 16717 16718 16719 16720 16721 16722 16723 16724 16725 16726 16727 16728 16729 16730 16731 16732 16733 16734 16735 16736 16737 16738 16739 16740 16741 16742 16743 16744 16745 16746 16747 16748 16749 16750 16751 16752 16753 16754 16755 16756 16757 16758 16759 16760 16761 16762 16763 16764 16765 16766 16767 16768 16769 16770 16771 16772 16773 16774 16775 16776 16777 16778 16779 16780 16781 16782 16783 16784 16785 16786 16787 16788 16789 16790 16791 16792 16793 16794 16795 16796 16797 16798 16799 16800 16801 16802 16803 16804 16805 16806 16807 16808 16809 16810 16811 16812 16813 16814 16815 16816 16817 16818 16819 16820 16821 16822 16823 16824 16825 16826 16827 16828 16829 16830 16831 16832 16833 16834 16835 16836 16837 16838 16839 16840 16841 16842 16843 16844 16845 16846 16847 16848 16849 16850 16851 16852 16853 16854 16855 16856 16857 16858 16859 16860 16861 16862 16863 16864 16865 16866 16867 16868 16869 16870 16871 16872 16873 16874 16875 16876 16877 16878 16879 16880 16881 16882 16883 16884 16885 16886 16887 16888 16889 16890 16891 16892 16893 16894 16895 16896 16897 16898 16899 16900 16901 16902 16903 16904 16905 16906 16907 16908 16909 16910 16911 16912 16913 16914 16915 16916 16917 16918 16919 16920 16921 16922 16923 16924 16925 16926 16927 16928 16929 16930 16931 16932 16933 16934 16935 16936 16937 16938 16939 16940 16941 16942 16943 16944 16945 16946 16947 16948 16949 16950 16951 16952 16953 16954 16955 16956 16957 16958 16959 16960 16961 16962 16963 16964 16965 16966 16967 16968 16969 16970 16971 16972 16973 16974 16975 16976 16977 16978 16979 16980 16981 16982 16983 16984 16985 16986 16987 16988 16989 16990 16991 16992 16993 16994 16995 16996 16997 16998 16999 17000 17001 17002 17003 17004 17005 17006 17007 17008 17009 17010 17011 17012 17013 17014 17015 17016 17017 17018 17019 17020 17021 17022 17023 17024 17025 17026 17027 17028 17029 17030 17031 17032 17033 17034 17035 17036 17037 17038 17039 17040 17041 17042 17043 17044 17045 17046 17047 17048 17049 17050 17051 17052 17053 17054 17055 17056 17057 17058 17059 17060 17061 17062 17063 17064 17065 17066 17067 17068 17069 17070 17071 17072 17073 17074 17075 17076 17077 17078 17079 17080 17081 17082 17083 17084 17085 17086 17087 17088 17089 17090 17091 17092 17093 17094 17095 17096 17097 17098 17099 17100 17101 17102 17103 17104 17105 17106 17107 17108 17109 17110 17111 17112 17113 17114 17115 17116 17117 17118 17119 17120 17121 17122 17123 17124 17125 17126 17127 17128 17129 17130 17131 17132 17133 17134 17135 17136 17137 17138 17139 17140 17141 17142 17143 17144 17145 17146 17147 17148 17149 17150 17151 17152 17153 17154 17155 17156 17157 17158 17159 17160 17161 17162 17163 17164 17165 17166 17167 17168 17169 17170 17171 17172 17173 17174 17175 17176 17177 17178 17179 17180 17181 17182 17183 17184 17185 17186 17187 17188 17189 17190 17191 17192 17193 17194 17195 17196 17197 17198 17199 17200 17201 17202 17203 17204 17205 17206 17207 17208 17209 17210 17211 17212 17213 17214 17215 17216 17217 17218 17219 17220 17221 17222 17223 17224 17225 17226 17227 17228 17229 17230 17231 17232 17233 17234 17235 17236 17237 17238 17239 17240 17241 17242 17243 17244 17245 17246 17247 17248 17249 17250 17251 17252 17253 17254 17255 17256 17257 17258 17259 17260 17261 17262 17263 17264 17265 17266 17267 17268 17269 17270 17271 17272 17273 17274 17275 17276 17277 17278 17279 17280 17281 17282 17283 17284 17285 17286 17287 17288 17289 17290 17291 17292 17293 17294 17295 17296 17297 17298 17299 17300 17301 17302 17303 17304 17305 17306 17307 17308 17309 17310 17311 17312 17313 17314 17315 17316 17317 17318 17319 17320 17321 17322 17323 17324 17325 17326 17327 17328 17329 17330 17331 17332 17333 17334 17335 17336 17337 17338 17339 17340 17341 17342 17343 17344 17345 17346 17347 17348 17349 17350 17351 17352 17353 17354 17355 17356 17357 17358 17359 17360 17361 17362 17363 17364 17365 17366 17367 17368 17369 17370 17371 17372 17373 17374 17375 17376 17377 17378 17379 17380 17381 17382 17383 17384 17385 17386 17387 17388 17389 17390 17391 17392 17393 17394 17395 17396 17397 17398 17399 17400 17401 17402 17403 17404 17405 17406 17407 17408 17409 17410 17411 17412 17413 17414 17415 17416 17417 17418 17419 17420 17421 17422 17423 17424 17425 17426 17427 17428 17429 17430 17431 17432 17433 17434 17435 17436 17437 17438 17439 17440 17441 17442 17443 17444 17445 17446 17447 17448 17449 17450 17451 17452 17453 17454 17455 17456 17457 17458 17459 17460 17461 17462 17463 17464 17465 17466 17467 17468 17469 17470 17471 17472 17473 17474 17475 17476 17477 17478 17479 17480 17481 17482 17483 17484 17485 17486 17487 17488 17489 17490 17491 17492 17493 17494 17495 17496 17497 17498 17499 17500 17501 17502 17503 17504 17505 17506 17507 17508 17509 17510 17511 17512 17513 17514 17515 17516 17517 17518 17519 17520 17521 17522 17523 17524 17525 17526 17527 17528 17529 17530 17531 17532 17533 17534 17535 17536 17537 17538 17539 17540 17541 17542 17543 17544 17545 17546 17547 17548 17549 17550 17551 17552 17553 17554 17555 17556 17557 17558 17559 17560 17561 17562 17563 17564 17565 17566 17567 17568 17569 17570 17571 17572 17573 17574 17575 17576 17577 17578 17579 17580 17581 17582 17583 17584 17585 17586 17587 17588 17589 17590 17591 17592 17593 17594 17595 17596 17597 17598 17599 17600 17601 17602 17603 17604 17605 17606 17607 17608 17609 17610 17611 17612 17613 17614 17615 17616 17617 17618 17619 17620 17621 17622 17623 17624 17625 17626 17627 17628 17629 17630 17631 17632 17633 17634 17635 17636 17637 17638 17639 17640 17641 17642 17643 17644 17645 17646 17647 17648 17649 17650 17651 17652 17653 17654 17655 17656 17657 17658 17659 17660 17661 17662 17663 17664 17665 17666 17667 17668 17669 17670 17671 17672 17673 17674 17675 17676 17677 17678 17679 17680 17681 17682 17683 17684 17685 17686 17687 17688 17689 17690 17691 17692 17693 17694 17695 17696 17697 17698 17699 17700 17701 17702 17703 17704 17705 17706 17707 17708 17709 17710 17711 17712 17713 17714 17715 17716 17717 17718 17719 17720 17721 17722 17723 17724 17725 17726 17727 17728 17729 17730 17731 17732 17733 17734 17735 17736 17737 17738 17739 17740 17741 17742 17743 17744 17745 17746 17747 17748 17749 17750 17751 17752 17753 17754 17755 17756 17757 17758 17759 17760 17761 17762 17763 17764 17765 17766 17767 17768 17769 17770 17771 17772 17773 17774 17775 17776 17777 17778 17779 17780 17781 17782 17783 17784 17785 17786 17787 17788 17789 17790 17791 17792 17793 17794 17795 17796 17797 17798 17799 17800 17801 17802 17803 17804 17805 17806 17807 17808 17809 17810 17811 17812 17813 17814 17815 17816 17817 17818 17819 17820 17821 17822 17823 17824 17825 17826 17827 17828 17829 17830 17831 17832 17833 17834 17835 17836 17837 17838 17839 17840 17841 17842 17843 17844 17845 17846 17847 17848 17849 17850 17851 17852 17853 17854 17855 17856 17857 17858 17859 17860 17861 17862 17863 17864 17865 17866 17867 17868 17869 17870 17871 17872 17873 17874 17875 17876 17877 17878 17879 17880 17881 17882 17883 17884 17885 17886 17887 17888 17889 17890 17891 17892 17893 17894 17895 17896 17897 17898 17899 17900 17901 17902 17903 17904 17905 17906 17907 17908 17909 17910 17911 17912 17913 17914 17915 17916 17917 17918 17919 17920 17921 17922 17923 17924 17925 17926 17927 17928 17929 17930 17931 17932 17933 17934 17935 17936 17937 17938 17939 17940 17941 17942 17943 17944 17945 17946 17947 17948 17949 17950 17951 17952 17953 17954 17955 17956 17957 17958 17959 17960 17961 17962 17963 17964 17965 17966 17967 17968 17969 17970 17971 17972 17973 17974 17975 17976 17977 17978 17979 17980 17981 17982 17983 17984 17985 17986 17987 17988 17989 17990 17991 17992 17993 17994 17995 17996 17997 17998 17999 18000 18001 18002 18003 18004 18005 18006 18007 18008 18009 18010 18011 18012 18013 18014 18015 18016 18017 18018 18019 18020 18021 18022 18023 18024 18025 18026 18027 18028 18029 18030 18031 18032 18033 18034 18035 18036 18037 18038 18039 18040 18041 18042 18043 18044 18045 18046 18047 18048 18049 18050 18051 18052 18053 18054 18055 18056 18057 18058 18059 18060 18061 18062 18063 18064 18065 18066 18067 18068 18069 18070 18071 18072 18073 18074 18075 18076 18077 18078 18079 18080 18081 18082 18083 18084 18085 18086 18087 18088 18089 18090 18091 18092 18093 18094 18095 18096 18097 18098 18099 18100 18101 18102 18103 18104 18105 18106 18107 18108 18109 18110 18111 18112 18113 18114 18115 18116 18117 18118 18119 18120 18121 18122 18123 18124 18125 18126 18127 18128 18129 18130 18131 18132 18133 18134 18135 18136 18137 18138 18139 18140 18141 18142 18143 18144 18145 18146 18147 18148 18149 18150 18151 18152 18153 18154 18155 18156 18157 18158 18159 18160 18161 18162 18163 18164 18165 18166 18167 18168 18169 18170 18171 18172 18173 18174 18175 18176 18177 18178 18179 18180 18181 18182 18183 18184 18185 18186 18187 18188 18189 18190 18191 18192 18193 18194 18195 18196 18197 18198 18199 18200 18201 18202 18203 18204 18205 18206 18207 18208 18209 18210 18211 18212 18213 18214 18215 18216 18217 18218 18219 18220 18221 18222 18223 18224 18225 18226 18227 18228 18229 18230 18231 18232 18233 18234 18235 18236 18237 18238 18239 18240 18241 18242 18243 18244 18245 18246 18247 18248 18249 18250 18251 18252 18253 18254 18255 18256 18257 18258 18259 18260 18261 18262 18263 18264 18265 18266 18267 18268 18269 18270 18271 18272 18273 18274 18275 18276 18277 18278 18279 18280 18281 18282 18283 18284 18285 18286 18287 18288 18289 18290 18291 18292 18293 18294 18295 18296 18297 18298 18299 18300 18301 18302 18303 18304 18305 18306 18307 18308 18309 18310 18311 18312 18313 18314 18315 18316 18317 18318 18319 18320 18321 18322 18323 18324 18325 18326 18327 18328 18329 18330 18331 18332 18333 18334 18335 18336 18337 18338 18339 18340 18341 18342 18343 18344 18345 18346 18347 18348 18349 18350 18351 18352 18353 18354 18355 18356 18357 18358 18359 18360 18361 18362 18363 18364 18365 18366 18367 18368 18369 18370 18371 18372 18373 18374 18375 18376 18377 18378 18379 18380 18381 18382 18383 18384 18385 18386 18387 18388 18389 18390 18391 18392 18393 18394 18395 18396 18397 18398 18399 18400 18401 18402 18403 18404 18405 18406 18407 18408 18409 18410 18411 18412 18413 18414 18415 18416 18417 18418 18419 18420 18421 18422 18423 18424 18425 18426 18427 18428 18429 18430 18431 18432 18433 18434 18435 18436 18437 18438 18439 18440 18441 18442 18443 18444 18445 18446 18447 18448 18449 18450 18451 18452 18453 18454 18455 18456 18457 18458 18459 18460 18461 18462 18463 18464 18465 18466 18467 18468 18469 18470 18471 18472 18473 18474 18475 18476 18477 18478 18479 18480 18481 18482 18483 18484 18485 18486 18487 18488 18489 18490 18491 18492 18493 18494 18495 18496 18497 18498 18499 18500 18501 18502 18503 18504 18505 18506 18507 18508 18509 18510 18511 18512 18513 18514 18515 18516 18517 18518 18519 18520 18521 18522 18523 18524 18525 18526 18527 18528 18529 18530 18531 18532 18533 18534 18535 18536 18537 18538 18539 18540 18541 18542 18543 18544 18545 18546 18547 18548 18549 18550 18551 18552 18553 18554 18555 18556 18557 18558 18559 18560 18561 18562 18563 18564 18565 18566 18567 18568 18569 18570 18571 18572 18573 18574 18575 18576 18577 18578 18579 18580 18581 18582 18583 18584 18585 18586 18587 18588 18589 18590 18591 18592 18593 18594 18595 18596 18597 18598 18599 18600 18601 18602 18603 18604 18605 18606 18607 18608 18609 18610 18611 18612 18613 18614 18615 18616 18617 18618 18619 18620 18621 18622 18623 18624 18625 18626 18627 18628 18629 18630 18631 18632 18633 18634 18635 18636 18637 18638 18639 18640 18641 18642 18643 18644 18645 18646 18647 18648 18649 18650 18651 18652 18653 18654 18655 18656 18657 18658 18659 18660 18661 18662 18663 18664 18665 18666 18667 18668 18669 18670 18671 18672 18673 18674 18675 18676 18677 18678 18679 18680 18681 18682 18683 18684 18685 18686 18687 18688 18689 18690 18691 18692 18693 18694 18695 18696 18697 18698 18699 18700 18701 18702 18703 18704 18705 18706 18707 18708 18709 18710 18711 18712 18713 18714 18715 18716 18717 18718 18719 18720 18721 18722 18723 18724 18725 18726 18727 18728 18729 18730 18731 18732 18733 18734 18735 18736 18737 18738 18739 18740 18741 18742 18743 18744 18745 18746 18747 18748 18749 18750 18751 18752 18753 18754 18755 18756 18757 18758 18759 18760 18761 18762 18763 18764 18765 18766 18767 18768 18769 18770 18771 18772 18773 18774 18775 18776 18777 18778 18779 18780 18781 18782 18783 18784 18785 18786 18787 18788 18789 18790 18791 18792 18793 18794 18795 18796 18797 18798 18799 18800 18801 18802 18803 18804 18805 18806 18807 18808 18809 18810 18811 18812 18813 18814 18815 18816 18817 18818 18819 18820 18821 18822 18823 18824 18825 18826 18827 18828 18829 18830 18831 18832 18833 18834 18835 18836 18837 18838 18839 18840 18841 18842 18843 18844 18845 18846 18847 18848 18849 18850 18851 18852 18853 18854 18855 18856 18857 18858 18859 18860 18861 18862 18863 18864 18865 18866 18867 18868 18869 18870 18871 18872 18873 18874 18875 18876 18877 18878 18879 18880 18881 18882 18883 18884 18885 18886 18887 18888 18889 18890 18891 18892 18893 18894 18895 18896 18897 18898 18899 18900 18901 18902 18903 18904 18905 18906 18907 18908 18909 18910 18911 18912 18913 18914 18915 18916 18917 18918 18919 18920 18921 18922 18923 18924 18925 18926 18927 18928 18929 18930 18931 18932 18933 18934 18935 18936 18937 18938 18939 18940 18941 18942 18943 18944 18945 18946 18947 18948 18949 18950 18951 18952 18953 18954 18955 18956 18957 18958 18959 18960 18961 18962 18963 18964 18965 18966 18967 18968 18969 18970 18971 18972 18973 18974 18975 18976 18977 18978 18979 18980 18981 18982 18983 18984 18985 18986 18987 18988 18989 18990 18991 18992 18993 18994 18995 18996 18997 18998 18999 19000 19001 19002 19003 19004 19005 19006 19007 19008 19009 19010 19011 19012 19013 19014 19015 19016 19017 19018 19019 19020 19021 19022 19023 19024 19025 19026 19027 19028 19029 19030 19031 19032 19033 19034 19035 19036 19037 19038 19039 19040 19041 19042 19043 19044 19045 19046 19047 19048 19049 19050 19051 19052 19053 19054 19055 19056 19057 19058 19059 19060 19061 19062 19063 19064 19065 19066 19067 19068 19069 19070 19071 19072 19073 19074 19075 19076 19077 19078 19079 19080 19081 19082 19083 19084 19085 19086 19087 19088 19089 19090 19091 19092 19093 19094 19095 19096 19097 19098 19099 19100 19101 19102 19103 19104 19105 19106 19107 19108 19109 19110 19111 19112 19113 19114 19115 19116 19117 19118 19119 19120 19121 19122 19123 19124 19125 19126 19127 19128 19129 19130 19131 19132 19133 19134 19135 19136 19137 19138 19139 19140 19141 19142 19143 19144 19145 19146 19147 19148 19149 19150 19151 19152 19153 19154 19155 19156 19157 19158 19159 19160 19161 19162 19163 19164 19165 19166 19167 19168 19169 19170 19171 19172 19173 19174 19175 19176 19177 19178 19179 19180 19181 19182 19183 19184 19185 19186 19187 19188 19189 19190 19191 19192 19193 19194 19195 19196 19197 19198 19199 19200 19201 19202 19203 19204 19205 19206 19207 19208 19209 19210 19211 19212 19213 19214 19215 19216 19217 19218 19219 19220 19221 19222 19223 19224 19225 19226 19227 19228 19229 19230 19231 19232 19233 19234 19235 19236 19237 19238 19239 19240 19241 19242 19243 19244 19245 19246 19247 19248 19249 19250 19251 19252 19253 19254 19255 19256 19257 19258 19259 19260 19261 19262 19263 19264 19265 19266 19267 19268 19269 19270 19271 19272 19273 19274 19275 19276 19277 19278 19279 19280 19281 19282 19283 19284 19285 19286 19287 19288 19289 19290 19291 19292 19293 19294 19295 19296 19297 19298 19299 19300 19301 19302 19303 19304 19305 19306 19307 19308 19309 19310 19311 19312 19313 19314 19315 19316 19317 19318 19319 19320 19321 19322 19323 19324 19325 19326 19327 19328 19329 19330 19331 19332 19333 19334 19335 19336 19337 19338 19339 19340 19341 19342 19343 19344 19345 19346 19347 19348 19349 19350 19351 19352 19353 19354 19355 19356 19357 19358 19359 19360 19361 19362 19363 19364 19365 19366 19367 19368 19369 19370 19371 19372 19373 19374 19375 19376 19377 19378 19379 19380 19381 19382 19383 19384 19385 19386 19387 19388 19389 19390 19391 19392 19393 19394 19395 19396 19397 19398 19399 19400 19401 19402 19403 19404 19405 19406 19407 19408 19409 19410 19411 19412 19413 19414 19415 19416 19417 19418 19419 19420 19421 19422 19423 19424 19425 19426 19427 19428 19429 19430 19431 19432 19433 19434 19435 19436 19437 19438 19439 19440 19441 19442 19443 19444 19445 19446 19447 19448 19449 19450 19451 19452 19453 19454 19455 19456 19457 19458 19459 19460 19461 19462 19463 19464 19465 19466 19467 19468 19469 19470 19471 19472 19473 19474 19475 19476 19477 19478 19479 19480 19481 19482 19483 19484 19485 19486 19487 19488 19489 19490 19491 19492 19493 19494 19495 19496 19497 19498 19499 19500 19501 19502 19503 19504 19505 19506 19507 19508 19509 19510 19511 19512 19513 19514 19515 19516 19517 19518 19519 19520 19521 19522 19523 19524 19525 19526 19527 19528 19529 19530 19531 19532 19533 19534 19535 19536 19537 19538 19539 19540 19541 19542 19543 19544 19545 19546 19547 19548 19549 19550 19551 19552 19553 19554 19555 19556 19557 19558 19559 19560 19561 19562 19563 19564 19565 19566 19567 19568 19569 19570 19571 19572 19573 19574 19575 19576
|
<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY tex "TeX">
<!ENTITY latex "LaTeX">
]>
<book id="pspp.xml" lang="en">
<title>PSPP Users’ Guide</title>
<subtitle>GNU PSPP Statistical Analysis Software
Release 2.1.1</subtitle>
<titleabbrev>PSPP</titleabbrev>
<bookinfo><title>PSPP Users’ Guide</title>
<subtitle>GNU PSPP Statistical Analysis Software
Release 2.1.1</subtitle>
<titleabbrev>PSPP</titleabbrev>
<legalnotice><para>This manual is for GNU PSPP version 2.1.1,
software for statistical analysis.
</para>
<para>Copyright © 1997, 1998, 2004, 2005, 2009, 2012, 2013, 2014, 2016, 2019, 2020, 2023 Free Software Foundation, Inc.
</para>
<blockquote><para>Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
</para></blockquote></legalnotice></bookinfo>
<chapter label="1" id="Introduction">
<title>Introduction</title>
<indexterm role="cp"><primary>introduction</primary></indexterm>
<indexterm role="cp"><primary>PSPP language</primary></indexterm>
<indexterm role="cp"><primary>language, PSPP</primary></indexterm>
<para>PSPP is a tool for statistical analysis of sampled data.
It reads the data, analyzes the data according to commands provided, and writes the results
to a listing file, to the standard output or to a window of the graphical display.
</para>
<para>The language accepted by PSPP is similar to those accepted by SPSS
statistical products.
The details of PSPP’s language are given later in this manual.
</para>
<indexterm role="cp"><primary>PostScript</primary></indexterm>
<indexterm role="cp"><primary>PDF</primary></indexterm>
<indexterm role="cp"><primary>HTML</primary></indexterm>
<indexterm role="cp"><primary>DocBook</primary></indexterm>
<para>PSPP produces tables and charts as output, which it can produce in
several formats; currently, ASCII, PostScript, PDF, HTML, DocBook and &tex; are
supported.
</para>
<para>The current version of PSPP, 2.1.1, is incomplete in
terms of its statistical procedure support. PSPP is a work in progress.
The authors hope to fully support all features in the products
that PSPP replaces, eventually. The authors welcome questions,
comments, donations, and code submissions. See <link linkend="Bugs">Submitting Bug
Reports</link>, for instructions on contacting the authors.
<!-- PSPP - a program for statistical analysis. -->
<!-- Copyright (C) 2017, 2020 Free Software Foundation, Inc. -->
<!-- Permission is granted to copy, distribute and/or modify this document -->
<!-- under the terms of the GNU Free Documentation License, Version 1.3 -->
<!-- or any later version published by the Free Software Foundation; -->
<!-- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -->
<!-- A copy of the license is included in the section entitled "GNU -->
<!-- Free Documentation License". -->
<!-- -->
</para></chapter>
<chapter label="2" id="License">
<title>Your rights and obligations</title>
<indexterm role="cp"><primary>license</primary></indexterm>
<indexterm role="cp"><primary>licence</primary></indexterm>
<indexterm role="cp"><primary>your rights and obligations</primary></indexterm>
<indexterm role="cp"><primary>rights, your</primary></indexterm>
<indexterm role="cp"><primary>copyright</primary></indexterm>
<indexterm role="cp"><primary>obligations, your</primary></indexterm>
<para>PSPP is not in the public domain. It is copyrighted and there are
restrictions on its distribution, but these restrictions are designed
to permit everything that a good cooperating citizen would want to do.
What is not allowed is to try to prevent others from further sharing
any version of this program that they might get from you.
</para>
<para>Specifically, we want to make sure that you have the right to give
away copies of PSPP, that you receive source code or else can get it
if you want it, that you can change these programs or use pieces of
them in new free programs, and that you know you can do these things.
</para>
<para>To make sure that everyone has such rights, we have to forbid you to
deprive anyone else of these rights. For example, if you distribute
copies of PSPP, you must give the recipients all the rights that you
have. You must make sure that they, too, receive or can get the
source code. And you must tell them their rights.
</para>
<para>Also, for our own protection, we must make certain that everyone finds
out that there is no warranty for PSPP. If these programs are
modified by someone else and passed on, we want their recipients to
know that what they have is not what we distributed, so that any
problems introduced by others will not reflect on our reputation.
</para>
<para>Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone’s free use or not licensed at all.
</para>
<para>The precise conditions of the license for PSPP are found in the
GNU General Public License. You should have received a copy of
the GNU General Public License along with this program; if not, write
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
Floor, Boston, MA 02110-1301 USA. This manual specifically
is covered by the GNU Free Documentation License (see <link linkend="GNU-Free-Documentation-License">GNU Free
Documentation License</link>).
</para>
<!-- PSPP - a program for statistical analysis. -->
<!-- Copyright (C) 2017, 2020 Free Software Foundation, Inc. -->
<!-- Permission is granted to copy, distribute and/or modify this document -->
<!-- under the terms of the GNU Free Documentation License, Version 1.3 -->
<!-- or any later version published by the Free Software Foundation; -->
<!-- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -->
<!-- A copy of the license is included in the section entitled "GNU -->
<!-- Free Documentation License". -->
<!-- -->
</chapter>
<chapter label="3" id="Invoking-PSPP">
<title>Invoking <command>pspp</command></title>
<indexterm role="cp"><primary>invocation</primary></indexterm>
<indexterm role="cp"><primary>PSPP, invoking</primary></indexterm>
<para>PSPP has two separate user interfaces. This chapter describes
<command>pspp</command>, PSPP’s command-line driven text-based user interface.
The following chapter briefly describes PSPPIRE, the graphical user
interface to PSPP.
</para>
<para>The sections below describe the <command>pspp</command> program’s command-line
interface.
</para>
<sect1 label="3.1" id="Main-Options">
<title>Main Options</title>
<para>Here is a summary of all the options, grouped by type, followed by
explanations in the same order.
</para>
<para>In the table, arguments to long options also apply to any
corresponding short options.
</para>
<variablelist><varlistentry><term><emphasis>Non-option arguments</emphasis>
</term><listitem><screen><replaceable>syntax-file</replaceable>
</screen>
</listitem></varlistentry><varlistentry><term><emphasis>Output options</emphasis>
</term><listitem><screen>-o, --output=<replaceable>output-file</replaceable>
-O <replaceable>option</replaceable>=<replaceable>value</replaceable>
-O format=<replaceable>format</replaceable>
-O device={terminal|listing}
--no-output
--table-look=<replaceable>file</replaceable>
-e, --error-file=<replaceable>error-file</replaceable>
</screen>
</listitem></varlistentry><varlistentry><term><emphasis>Language options</emphasis>
</term><listitem><screen>-I, --include=<replaceable>dir</replaceable>
-I-, --no-include
-b, --batch
-i, --interactive
-r, --no-statrc
-a, --algorithm={compatible|enhanced}
-x, --syntax={compatible|enhanced}
--syntax-encoding=<replaceable>encoding</replaceable>
</screen>
</listitem></varlistentry><varlistentry><term><emphasis>Informational options</emphasis>
</term><listitem><screen>-h, --help
-V, --version
</screen>
</listitem></varlistentry><varlistentry><term><emphasis>Other options</emphasis>
</term><listitem><screen>-s, --safer
--testing-mode
</screen></listitem></varlistentry></variablelist>
<variablelist><varlistentry><term><replaceable>syntax-file</replaceable>
</term><listitem><para>Read and execute the named syntax file. If no syntax files are
specified, PSPP prompts for commands. If any syntax files are
specified, PSPP by default exits after it runs them, but you may make
it prompt for commands by specifying ‘<literal>-</literal>’ as an additional syntax
file.
</para>
</listitem></varlistentry><varlistentry><term><option>-o <replaceable>output-file</replaceable></option>
</term><listitem><para>Write output to <replaceable>output-file</replaceable>. PSPP has several different output
drivers that support output in various formats (use <option>--help</option> to
list the available formats). Specify this option more than once to
produce multiple output files, presumably in different formats.
</para>
<para>Use ‘<literal>-</literal>’ as <replaceable>output-file</replaceable> to write output to standard output.
</para>
<para>If no <option>-o</option> option is used, then PSPP writes text and CSV
output to standard output and other kinds of output to whose name is
based on the format, <emphasis>e.g.</emphasis> <filename>pspp.pdf</filename> for PDF output.
</para>
</listitem></varlistentry><varlistentry><term><option>-O <replaceable>option</replaceable>=<replaceable>value</replaceable></option>
</term><listitem><para>Sets an option for the output file configured by a preceding
<option>-o</option>. Most options are specific to particular output formats.
A few options that apply generically are listed below.
</para>
</listitem></varlistentry><varlistentry><term><option>-O format=<replaceable>format</replaceable></option>
</term><listitem><para>PSPP uses the extension of the file name given on <option>-o</option> to
select an output format. Use this option to override this choice by
specifying an alternate format, <emphasis>e.g.</emphasis> <option>-o pspp.out -O format=html</option> to
write HTML to a file named <filename>pspp.out</filename>. Use <option>--help</option> to
list the available formats.
</para>
</listitem></varlistentry><varlistentry><term><option>-O device={terminal|listing}</option>
</term><listitem><para>Sets whether PSPP considers the output device configured by the
preceding <option>-o</option> to be a terminal or a listing device. This
affects what output will be sent to the device, as configured by the
SET command’s output routing subcommands (see <link linkend="SET">SET</link>). By default,
output written to standard output is considered a terminal device and
other output is considered a listing device.
</para>
</listitem></varlistentry><varlistentry><term><option>--no-output</option>
</term><listitem><para>Disables output entirely, if neither <option>-o</option> nor <option>-O</option> is
also used. If one of those options is used, <option>--no-output</option> has
no effect.
</para>
</listitem></varlistentry><varlistentry><term><option>--table-look=<replaceable>file</replaceable></option>
</term><listitem><para>Reads a table style from <replaceable>file</replaceable> and applies it to all PSPP
table output. The file should be a TableLook <filename>.stt</filename> or
<filename>.tlo</filename> file. PSPP searches for <replaceable>file</replaceable> in the current
directory, then in <filename>.pspp/looks</filename> in the user’s home directory,
then in a <filename>looks</filename> subdirectory inside PSPP’s data directory
(usually <filename>/usr/local/share/pspp</filename>). If PSPP cannot find
<replaceable>file</replaceable> under the given name, it also tries adding a <filename>.stt</filename>
extension.
</para>
<para>When this option is not specified, PSPP looks for
<filename>default.stt</filename> using the algorithm above, and otherwise it falls
back to a default built-in style.
</para>
<para>Using <literal>SET TLOOK</literal> in PSPP syntax overrides the style set on
the command line (see <link linkend="SET">SET</link>).
</para>
</listitem></varlistentry><varlistentry><term><option>-e <replaceable>error-file</replaceable></option>
</term><term><option>--error-file=<replaceable>error-file</replaceable></option>
</term><listitem><para>Configures a file to receive PSPP error, warning, and note messages in
plain text format. Use ‘<literal>-</literal>’ as <replaceable>error-file</replaceable> to write messages
to standard output. The default error file is standard output in the
absence of these options, but this is suppressed if an output device
writes to standard output (or another terminal), to avoid printing
every message twice. Use ‘<literal>none</literal>’ as <replaceable>error-file</replaceable> to
explicitly suppress the default.
</para>
</listitem></varlistentry><varlistentry><term><option>-I <replaceable>dir</replaceable></option>
</term><term><option>--include=<replaceable>dir</replaceable></option>
</term><listitem><para>Appends <replaceable>dir</replaceable> to the set of directories searched by the <literal>INCLUDE</literal>
(see <link linkend="INCLUDE">INCLUDE</link>) and <literal>INSERT</literal> (see <link linkend="INSERT">INSERT</link>) commands.
</para>
</listitem></varlistentry><varlistentry><term><option>-I-</option>
</term><term><option>--no-include</option>
</term><listitem><para>Clears all directories from the include path, including directories
inserted in the include path by default. The default include path is
<filename>.</filename> (the current directory), followed by <filename>.pspp</filename> in the
user’s home directory, followed by PSPP’s system configuration
directory (usually <filename>/etc/pspp</filename> or <filename>/usr/local/etc/pspp</filename>).
</para>
</listitem></varlistentry><varlistentry><term><option>-b</option>
</term></varlistentry><varlistentry><term><option>--batch</option>
</term></varlistentry><varlistentry><term><option>-i</option>
</term><term><option>--interactive</option>
</term><listitem><para>These options forces syntax files to be interpreted in batch mode or
interactive mode, respectively, rather than the default “auto” mode.
See <link linkend="Syntax-Variants">Syntax Variants</link>, for a description of the differences.
</para>
</listitem></varlistentry><varlistentry><term><option>-r</option>
</term><term><option>--no-statrc</option>
</term><listitem><para>By default, at startup PSPP searches for a file named <filename>rc</filename> in
the include path (described above) and, if it finds one, runs the
commands in it. This option disables this behavior.
</para>
</listitem></varlistentry><varlistentry><term><option>-a {enhanced|compatible}</option>
</term><term><option>--algorithm={enhanced|compatible}</option>
</term><listitem><para>With <literal>enhanced</literal>, the default, PSPP uses the best implemented
algorithms for statistical procedures. With <literal>compatible</literal>,
however, PSPP will in some cases use inferior algorithms to produce
the same results as the proprietary program SPSS.
</para>
<para>Some commands have subcommands that override this setting on a per
command basis.
</para>
</listitem></varlistentry><varlistentry><term><option>-x {enhanced|compatible}</option>
</term><term><option>--syntax={enhanced|compatible}</option>
</term><listitem><para>With <literal>enhanced</literal>, the default, PSPP accepts its own extensions
beyond those compatible with the proprietary program SPSS. With
<literal>compatible</literal>, PSPP rejects syntax that uses these extensions.
</para>
</listitem></varlistentry><varlistentry><term><option>--syntax-encoding=<replaceable>encoding</replaceable></option>
</term><listitem><para>Specifies <replaceable>encoding</replaceable> as the encoding for syntax files named on the
command line. The <replaceable>encoding</replaceable> also becomes the default encoding
for other syntax files read during the PSPP session by the
<literal>INCLUDE</literal> and <literal>INSERT</literal> commands. See <link linkend="INSERT">INSERT</link>, for the
accepted forms of <replaceable>encoding</replaceable>.
</para>
</listitem></varlistentry><varlistentry><term><option>--help</option>
</term><listitem><para>Prints a message describing PSPP command-line syntax and the available
device formats, then exits.
</para>
</listitem></varlistentry><varlistentry><term><option>-V</option>
</term><term><option>--version</option>
</term><listitem><para>Prints a brief message listing PSPP’s version, warranties you don’t
have, copying conditions and copyright, and e-mail address for bug
reports, then exits.
</para>
</listitem></varlistentry><varlistentry><term><option>-s</option>
</term><term><option>--safer</option>
</term><listitem><para>Disables certain unsafe operations. This includes the <literal>ERASE</literal> and
<literal>HOST</literal> commands, as well as use of pipes as input and output files.
</para>
</listitem></varlistentry><varlistentry><term><option>--testing-mode</option>
</term><listitem><para>Invoke heuristics to assist with testing PSPP. For use
by <command>make check</command> and similar scripts.
</para></listitem></varlistentry></variablelist>
</sect1>
<sect1 label="3.2" id="PDF-PostScript-SVG-and-PNG-Output-Options">
<title>PDF, PostScript, SVG, and PNG Output Options</title>
<indexterm role="cp"><primary>PDF</primary></indexterm>
<indexterm role="cp"><primary>Postscript</primary></indexterm>
<indexterm role="cp"><primary>SVG</primary></indexterm>
<indexterm role="cp"><primary>PNG</primary></indexterm>
<para>To produce output in PDF, PostScript, SVG, or PNG format, specify
<option>-o <replaceable>file</replaceable></option> on the PSPP command line, optionally
followed by any of the options shown in the table below to customize
the output format.
</para>
<para>PDF, PostScript, and SVG use real units: each dimension among the
options listed below may have a suffix ‘<literal>mm</literal>’ for millimeters,
‘<literal>in</literal>’ for inches, or ‘<literal>pt</literal>’ for points. Lacking a suffix,
numbers below 50 are assumed to be in inches and those above 50 are
assumed to be in millimeters.
</para>
<para>PNG files are pixel-based, so dimensions in PNG output must ultimately
be measured in pixels. For output to these files, PSPP translates the
specified dimensions to pixels at 72 pixels per inch. For PNG output
only, fonts are by default rendered larger than this, at 96 pixels per
inch.
</para>
<para>An SVG or PNG file can only hold a single page. When PSPP outputs
more than one page to SVG or PNG, it creates multiple files. It
outputs the second page to a file named with a <literal>-2</literal> suffix, the
third with a <literal>-3</literal> suffix, and so on.
</para>
<variablelist><varlistentry><term><option>-O format={pdf|ps|svg|png}</option>
</term><listitem><para>Specify the output format. This is only necessary if the file name
given on <option>-o</option> does not end in <filename>.pdf</filename>, <filename>.ps</filename>,
<filename>.svg</filename>, or <filename>.png</filename>.
</para>
</listitem></varlistentry><varlistentry><term><option>-O paper-size=<replaceable>paper-size</replaceable></option>
</term><listitem><para>Paper size, as a name (<emphasis>e.g.</emphasis> <literal>a4</literal>, <literal>letter</literal>) or
measurements (<emphasis>e.g.</emphasis> <literal>210x297</literal>, <literal>8.5x11in</literal>).
</para>
<para>The default paper size is taken from the <envar>PAPERSIZE</envar> environment
variable or the file indicated by the <envar>PAPERCONF</envar> environment
variable, if either variable is set. If not, and your system supports
the <literal>LC_PAPER</literal> locale category, then the default paper size is
taken from the locale. Otherwise, if <filename>/etc/papersize</filename> exists,
the default paper size is read from it. As a last resort, A4 paper is
assumed.
</para>
</listitem></varlistentry><varlistentry><term><option>-O foreground-color=<replaceable>color</replaceable></option>
</term><listitem><para>Sets <replaceable>color</replaceable> as the default color for lines and text. Use a CSS
color format (e.g. <literal>#<replaceable>rr</replaceable><replaceable>gg</replaceable><replaceable>bb</replaceable></literal>) or name (e.g.
<literal>black</literal>) as <replaceable>color</replaceable>.
</para>
</listitem></varlistentry><varlistentry><term><option>-O orientation=<replaceable>orientation</replaceable></option>
</term><listitem><para>Either <literal>portrait</literal> or <literal>landscape</literal>. Default: <literal>portrait</literal>.
</para>
</listitem></varlistentry><varlistentry><term><option>-O left-margin=<replaceable>dimension</replaceable></option>
</term><term><option>-O right-margin=<replaceable>dimension</replaceable></option>
</term><term><option>-O top-margin=<replaceable>dimension</replaceable></option>
</term><term><option>-O bottom-margin=<replaceable>dimension</replaceable></option>
</term><listitem><para>Sets the margins around the page. See
below for the allowed forms of <replaceable>dimension</replaceable>. Default: <literal>0.5in</literal>.
</para>
</listitem></varlistentry><varlistentry><term><option>-O object-spacing=<replaceable>dimension</replaceable></option>
</term><listitem><para>Sets the amount of vertical space between objects (such as headings or
tables).
</para>
</listitem></varlistentry><varlistentry><term><option>-O prop-font=<replaceable>font-name</replaceable></option>
</term><listitem><para>Sets the default font used for ordinary text. Most systems support
CSS-like font names such as “Sans Serif”, but a wide range of
system-specific fonts are likely to be supported as well.
</para>
<para>Default: proportional font <literal>Sans Serif</literal>.
</para>
</listitem></varlistentry><varlistentry><term><option>-O font-size=<replaceable>font-size</replaceable></option>
</term><listitem><para>Sets the size of the default fonts, in thousandths of a point. Default:
10000 (10 point).
</para>
</listitem></varlistentry><varlistentry><term><option>-O trim=true</option>
</term><listitem><para>This option makes PSPP trim empty space around each page of output,
before adding the margins. This can make the output easier to include
in other documents.
</para>
</listitem></varlistentry><varlistentry><term><option>-O outline=<replaceable>boolean</replaceable></option>
</term><listitem><para>For PDF output only, this option controls whether PSPP includes an
outline in the output file. PDF viewers usually display the outline
as a side bar that allows for easy navigation of the file.
The default is true unless <option>-O trim=true</option> is also specified.
(The Cairo graphics library that PSPP uses to produce PDF output has a
bug that can cause a crash when outlines and trimming are used
together.)
</para>
</listitem></varlistentry><varlistentry><term><option>-O font-resolution=<replaceable>dpi</replaceable></option>
</term><listitem><para>Sets the resolution for font rendering, in dots per inch. For PDF,
PostScript, and SVG output, the default is 72 dpi, so that a 10-point
font is rendered with a height of 10 points. For PNG output, the
default is 96 dpi, so that a 10-point font is rendered with a height
of <inlineequation><mathphrase>10 / 72 * 96 = 13.3</mathphrase></inlineequation> pixels. Use a larger <replaceable>dpi</replaceable> to
enlarge text output, or a smaller <replaceable>dpi</replaceable> to shrink it.
</para></listitem></varlistentry></variablelist>
</sect1>
<sect1 label="3.3" id="Plain-Text-Output-Options">
<title>Plain Text Output Options</title>
<para>PSPP can produce plain text output, drawing boxes using ASCII or
Unicode line drawing characters. To produce plain text output,
specify <option>-o <replaceable>file</replaceable></option> on the PSPP command line, optionally
followed by options from the table below to customize the output
format.
</para>
<para>Plain text output is encoded in UTF-8.
</para>
<variablelist><varlistentry><term><option>-O format=txt</option>
</term><listitem><para>Specify the output format. This is only necessary if the file name
given on <option>-o</option> does not end in <filename>.txt</filename> or <filename>.list</filename>.
</para>
</listitem></varlistentry><varlistentry><term><option>-O charts={<replaceable>template</replaceable>.png|none}</option>
</term><listitem><para>Name for chart files included in output. The value should be a file
name that includes a single ‘<literal>#</literal>’ and ends in <filename>png</filename>. When a
chart is output, the ‘<literal>#</literal>’ is replaced by the chart number. The
default is the file name specified on <option>-o</option> with the extension
stripped off and replaced by <filename>-#.png</filename>.
</para>
<para>Specify <literal>none</literal> to disable chart output.
</para>
</listitem></varlistentry><varlistentry><term><option>-O foreground-color=<replaceable>color</replaceable></option>
</term><term><option>-O background-color=<replaceable>color</replaceable></option>
</term><listitem><para>Sets <replaceable>color</replaceable> as the color to be used for the background or foreground to
be used for charts.
Color should be given in the format <literal>#<replaceable>RRRR</replaceable><replaceable>GGGG</replaceable><replaceable>BBBB</replaceable></literal>,
where <replaceable>RRRR</replaceable>, <replaceable>GGGG</replaceable> and <replaceable>BBBB</replaceable> are 4 character hexadecimal
representations of the red, green and blue components respectively.
If charts are disabled, this option has no effect.
</para>
</listitem></varlistentry><varlistentry><term><option>-O width=<replaceable>columns</replaceable></option>
</term><listitem><para>Width of a page, in columns. If unspecified or given as <literal>auto</literal>,
the default is the width of the terminal, for interactive output, or
the WIDTH setting (see <link linkend="SET">SET</link>), for output to a file.
</para>
</listitem></varlistentry><varlistentry><term><option>-O box={ascii|unicode}</option>
</term><listitem><para>Sets the characters used for lines in tables.
If set to
<literal>ascii</literal>, output uses use the characters ‘<literal>-</literal>’, ‘<literal>|</literal>’, and ‘<literal>+</literal>’ for single-width
lines and ‘<literal>=</literal>’ and ‘<literal>#</literal>’ for double-width lines.
If set to <literal>unicode</literal> then, output uses Unicode box drawing characters.
The default is <literal>unicode</literal> if the locale’s character encoding is "UTF-8"
or <literal>ascii</literal> otherwise.
</para>
</listitem></varlistentry><varlistentry><term><option>-O emphasis={none|bold|underline}</option>
</term><listitem><para>How to emphasize text. Bold and underline emphasis are achieved with
overstriking, which may not be supported by all the software to which
you might pass the output. Default: <literal>none</literal>.
</para></listitem></varlistentry></variablelist>
</sect1>
<sect1 label="3.4" id="SPV-Output-Options">
<title>SPV Output Options</title>
<para>SPSS 16 and later write <filename>.spv</filename> files to represent the contents of
its output editor. To produce output in <filename>.spv</filename> format, specify
<option>-o <replaceable>file</replaceable></option> on the PSPP command line, optionally
followed by any of the options shown in the table below to customize
the output format.
</para>
<variablelist><varlistentry><term><option>-O format=spv</option>
</term><listitem><para>Specify the output format. This is only necessary if the file name
given on <option>-o</option> does not end in <filename>.spv</filename>.
</para>
</listitem></varlistentry><varlistentry><term><option>-O paper-size=<replaceable>paper-size</replaceable></option>
</term><term><option>-O left-margin=<replaceable>dimension</replaceable></option>
</term><term><option>-O right-margin=<replaceable>dimension</replaceable></option>
</term><term><option>-O top-margin=<replaceable>dimension</replaceable></option>
</term><term><option>-O bottom-margin=<replaceable>dimension</replaceable></option>
</term><term><option>-O object-spacing=<replaceable>dimension</replaceable></option>
</term><listitem><para>These have the same syntax and meaning as for PDF output. See <link linkend="PDF-PostScript-SVG-and-PNG-Output-Options">PDF
PostScript SVG and PNG Output Options</link>, for details.
</para></listitem></varlistentry></variablelist>
</sect1>
<sect1 label="3.5" id="TeX-Output-Options">
<title>TeX Output Options</title>
<indexterm role="cp"><primary>&tex;</primary></indexterm>
<indexterm role="cp"><primary>tex</primary></indexterm>
<para>If you want to publish statistical results in professional or academic
journals, you will probably want to provide results in &tex; format.
To do this, specify <option>-o <replaceable>file</replaceable></option> on the PSPP command line where
<replaceable>file</replaceable> is a file name ending in <filename>.tex</filename>, or you can specify
<option>-O format=tex</option>.
</para>
<para>The resulting file can be directly processed using &tex; or you can manually
edit the file to add commentary text.
Alternatively, you can cut and paste desired sections to another &tex; file.
</para>
</sect1>
<sect1 label="3.6" id="HTML-Output-Options">
<title>HTML Output Options</title>
<indexterm role="cp"><primary>HTML</primary></indexterm>
<para>To produce output in HTML format, specify <option>-o <replaceable>file</replaceable></option> on
the PSPP command line, optionally followed by any of the options shown
in the table below to customize the output format.
</para>
<variablelist><varlistentry><term><option>-O format=html</option>
</term><listitem><para>Specify the output format. This is only necessary if the file name
given on <option>-o</option> does not end in <filename>.html</filename>.
</para>
</listitem></varlistentry><varlistentry><term><option>-O charts={<replaceable>template</replaceable>.png|none}</option>
</term><listitem><para>Sets the name used for chart files. See <link linkend="Plain-Text-Output-Options">Plain Text Output Options</link>,
for details.
</para>
</listitem></varlistentry><varlistentry><term><option>-O borders=<replaceable>boolean</replaceable></option>
</term><listitem><para>Decorate the tables with borders. If set to false, the tables produced
will have no borders. The default value is true.
</para>
</listitem></varlistentry><varlistentry><term><option>-O bare=<replaceable>boolean</replaceable></option>
</term><listitem><para>The HTML output driver ordinarily outputs a complete HTML document.
If set to true, the driver instead outputs only what would normally be
the contents of the <literal>body</literal> element. The default value is false.
</para>
</listitem></varlistentry><varlistentry><term><option>-O css=<replaceable>boolean</replaceable></option>
</term><listitem><para>Use cascading style sheets. Cascading style sheets give an improved appearance
and can be used to produce pages which fit a certain web site’s style.
The default value is true.
</para>
</listitem></varlistentry></variablelist>
</sect1>
<sect1 label="3.7" id="OpenDocument-Output-Options">
<title>OpenDocument Output Options</title>
<para>To produce output as an OpenDocument text (ODT) document, specify
<option>-o <replaceable>file</replaceable></option> on the PSPP command line. If <replaceable>file</replaceable> does
not end in <filename>.odt</filename>, you must also specify <option>-O format=odt</option>.
</para>
<para>ODT support is only available if your installation of PSPP was
compiled with the libxml2 library.
</para>
<para>The OpenDocument output format does not have any configurable options.
</para>
</sect1>
<sect1 label="3.8" id="Comma_002dSeparated-Value-Output-Options">
<title>Comma-Separated Value Output Options</title>
<para>To produce output in comma-separated value (CSV) format, specify
<option>-o <replaceable>file</replaceable></option> on the PSPP command line, optionally followed
by any of the options shown in the table below to customize the output
format.
</para>
<variablelist><varlistentry><term><option>-O format=csv</option>
</term><listitem><para>Specify the output format. This is only necessary if the file name
given on <option>-o</option> does not end in <filename>.csv</filename>.
</para>
</listitem></varlistentry><varlistentry><term><option>-O separator=<replaceable>field-separator</replaceable></option>
</term><listitem><para>Sets the character used to separate fields. Default: a comma
(‘<literal>,</literal>’).
</para>
</listitem></varlistentry><varlistentry><term><option>-O quote=<replaceable>qualifier</replaceable></option>
</term><listitem><para>Sets <replaceable>qualifier</replaceable> as the character used to quote fields that
contain white space, the separator (or any of the characters in the
separator, if it contains more than one character), or the quote
character itself. If <replaceable>qualifier</replaceable> is longer than one character,
only the first character is used; if <replaceable>qualifier</replaceable> is the empty
string, then fields are never quoted.
</para>
</listitem></varlistentry><varlistentry><term><option>-O titles=<replaceable>boolean</replaceable></option>
</term><listitem><para>Whether table titles (brief descriptions) should be printed. Default:
<literal>on</literal>.
</para>
</listitem></varlistentry><varlistentry><term><option>-O captions=<replaceable>boolean</replaceable></option>
</term><listitem><para>Whether table captions (more extensive descriptions) should be
printed. Default: on.
</para></listitem></varlistentry></variablelist>
<para>The CSV format used is an extension to that specified in RFC 4180:
</para>
<variablelist><varlistentry><term>Tables
</term><listitem><para>Each table row is output on a separate line, and each column is output
as a field. The contents of a cell that spans multiple rows or
columns is output only for the top-left row and column; the rest are
output as empty fields.
</para>
</listitem></varlistentry><varlistentry><term>Titles
</term><listitem><para>When a table has a title and titles are enabled, the title is output
just above the table as a single field prefixed by ‘<literal>Table:</literal>’.
</para>
</listitem></varlistentry><varlistentry><term>Captions
</term><listitem><para>When a table has a caption and captions are enabled, the caption is
output just below the table as a single field prefixed by
‘<literal>Caption:</literal>’.
</para>
</listitem></varlistentry><varlistentry><term>Footnotes
</term><listitem><para>Within a table, footnote markers are output as bracketed letters
following the cell’s contents, <emphasis>e.g.</emphasis> ‘<literal>[a]</literal>’, ‘<literal>[b]</literal>’,
... The footnotes themselves are output following the body of
the table, as a separate two-column table introduced with a line that
says ‘<literal>Footnotes:</literal>’. Each row in the table represent one footnote:
the first column is the marker, the second column is the text.
</para>
</listitem></varlistentry><varlistentry><term>Text
</term><listitem><para>Text in output is printed as a field on a line by itself. The TITLE
and SUBTITLE produce similar output, prefixed by ‘<literal>Title:</literal>’ or
‘<literal>Subtitle:</literal>’, respectively.
</para>
</listitem></varlistentry><varlistentry><term>Messages
</term><listitem><para>Errors, warnings, and notes are printed the same way as text.
</para>
</listitem></varlistentry><varlistentry><term>Charts
</term><listitem><para>Charts are not included in CSV output.
</para></listitem></varlistentry></variablelist>
<para>Successive output items are separated by a blank line.
</para>
</sect1>
</chapter>
<chapter label="4" id="Invoking-PSPPIRE">
<title>Invoking <command>psppire</command></title>
<sect1 label="4.1">
<title>The graphic user interface</title>
<indexterm role="cp"><primary>Graphic user interface</primary></indexterm>
<indexterm role="cp"><primary>PSPPIRE</primary></indexterm>
<para>The PSPPIRE graphic user interface for PSPP can perform all
functionality of the command line interface. In addition it gives an
instantaneous view of the data, variables and statistical output.
</para>
<para>The graphic user interface can be started by typing <command>psppire</command> at a
command prompt.
Alternatively many systems have a system of interactive menus or buttons
from which <command>psppire</command> can be started by a series of mouse clicks.
</para>
<para>Once the principles of the PSPP system are understood,
the graphic user interface is designed to be largely intuitive, and
for this reason is covered only very briefly by this manual.
<!-- PSPP - a program for statistical analysis. -->
<!-- Copyright (C) 2017, 2020 Free Software Foundation, Inc. -->
<!-- Permission is granted to copy, distribute and/or modify this document -->
<!-- under the terms of the GNU Free Documentation License, Version 1.3 -->
<!-- or any later version published by the Free Software Foundation; -->
<!-- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -->
<!-- A copy of the license is included in the section entitled "GNU -->
<!-- Free Documentation License". -->
<!-- -->
</para>
</sect1>
</chapter>
<chapter label="5" id="Using-PSPP">
<title>Using PSPP</title>
<para>PSPP is a tool for the statistical analysis of sampled data.
You can use it to discover patterns in the data,
to explain differences in one subset of data in terms of another subset
and to find out
whether certain beliefs about the data are justified.
This chapter does not attempt to introduce the theory behind the
statistical analysis,
but it shows how such analysis can be performed using PSPP.
</para>
<para>For the purposes of this tutorial, it is assumed that you are using PSPP in its
interactive mode from the command line.
However, the example commands can also be typed into a file and executed in
a post-hoc mode by typing ‘<literal>pspp <replaceable>file-name</replaceable></literal>’ at a shell prompt,
where <replaceable>file-name</replaceable> is the name of the file containing the commands.
Alternatively, from the graphical interface, you can select
File → New → Syntax to open a new syntax window
and use the Run menu when a syntax fragment is ready to be
executed.
Whichever method you choose, the syntax is identical.
</para>
<para>When using the interactive method, PSPP tells you that it’s waiting for your
data with a string like PSPP> or data>.
In the examples of this chapter, whenever you see text like this, it
indicates the prompt displayed by PSPP, <emphasis>not</emphasis> something that you
should type.
</para>
<para>Throughout this chapter reference is made to a number of sample data files.
So that you can try the examples for yourself,
you should have received these files along with your copy of PSPP.<!-- -->
<footnote><para>These files contain purely fictitious data. They should not be used
for research purposes.</para></footnote>
</para><blockquote><para><emphasis role="bold">Please note:</emphasis> Normally these files are installed in the directory
<filename>//share/pspp/examples</filename>.
If however your system administrator or operating system vendor has
chosen to install them in a different location, you will have to adjust
the examples accordingly.
</para></blockquote>
<sect1 label="5.1" id="Preparation-of-Data-Files">
<title>Preparation of Data Files</title>
<para>Before analysis can commence, the data must be loaded into PSPP and
arranged such that both PSPP and humans can understand what
the data represents.
There are two aspects of data:
</para>
<itemizedlist><listitem><para>The variables — these are the parameters of a quantity
which has been measured or estimated in some way.
For example height, weight and geographic location are all variables.
</para></listitem><listitem><para>The observations (also called ‘cases’) of the variables —
each observation represents an instance when the variables were measured
or observed.
</para></listitem></itemizedlist>
<para>For example, a data set which has the variables <emphasis role="bold">height</emphasis>, <emphasis role="bold">weight</emphasis>, and
<emphasis role="bold">name</emphasis>, might have the observations:
</para><screen>1881 89.2 Ahmed
1192 107.01 Frank
1230 67 Julie
</screen><para>The following sections explain how to define a dataset.
</para>
<sect2 label="5.1.1" id="Defining-Variables">
<title>Defining Variables</title>
<indexterm role="cp"><primary>variables</primary></indexterm>
<para>Variables come in two basic types, <emphasis>viz</emphasis>: <firstterm>numeric</firstterm> and <firstterm>string</firstterm>.
Variables such as age, height and satisfaction are numeric,
whereas name is a string variable.
String variables are best reserved for commentary data to assist the
human observer.
However they can also be used for nominal or categorical data.
</para>
<para>The following example defines two variables <emphasis role="bold">forename</emphasis> and <emphasis role="bold">height</emphasis>,
and reads data into them by manual input:
</para>
<screen>PSPP> data list list /forename (A12) height.
PSPP> begin data.
data> Ahmed 188
data> Bertram 167
data> Catherine 134.231
data> David 109.1
data> end data
PSPP>
</screen>
<para>There are several things to note about this example.
</para>
<itemizedlist><listitem><para>The words ‘<literal>data list list</literal>’ are an example of the <literal>DATA LIST</literal>
command. See <link linkend="DATA-LIST">DATA LIST</link>.
It tells PSPP to prepare for reading data.
The word ‘<literal>list</literal>’ intentionally appears twice.
The first occurrence is part of the <literal>DATA LIST</literal> call,
whilst the second
tells PSPP that the data is to be read as free format data with
one record per line.
</para>
</listitem><listitem><para>The ‘<literal>/</literal>’ character is important. It marks the start of the list of
variables which you wish to define.
</para>
</listitem><listitem><para>The text ‘<literal>forename</literal>’ is the name of the first variable,
and ‘<literal>(A12)</literal>’ says that the variable <emphasis role="bold">forename</emphasis> is a string
variable and that its maximum length is 12 bytes.
The second variable’s name is specified by the text ‘<literal>height</literal>’.
Since no format is given, this variable has the default format.
Normally the default format expects numeric data, which should be
entered in the locale of the operating system.
Thus, the example is correct for English locales and other
locales which use a period (‘<literal>.</literal>’) as the decimal separator.
However if you are using a system with a locale which uses the comma (‘<literal>,</literal>’)
as the decimal separator, then you should in the subsequent lines substitute
‘<literal>.</literal>’ with ‘<literal>,</literal>’.
Alternatively, you could explicitly tell PSPP that the <emphasis role="bold">height</emphasis>
variable is to be read using a period as its decimal separator by appending the
text ‘<literal>DOT8.3</literal>’ after the word ‘<literal>height</literal>’.
For more information on data formats, see <link linkend="Input-and-Output-Formats">Input and Output Formats</link>.
</para>
</listitem><listitem><para>Normally, PSPP displays the prompt PSPP> whenever it’s
expecting a command.
However, when it’s expecting data, the prompt changes to data>
so that you know to enter data and not a command.
</para>
</listitem><listitem><para>At the end of every command there is a terminating ‘<literal>.</literal>’ which tells
PSPP that the end of a command has been encountered.
You should not enter ‘<literal>.</literal>’ when data is expected (<emphasis>ie.</emphasis> when
the data> prompt is current) since it is appropriate only for
terminating commands.
</para></listitem></itemizedlist>
</sect2>
<sect2 label="5.1.2" id="Listing-the-data">
<title>Listing the data</title>
<indexterm role="vr"><primary>LIST</primary></indexterm>
<para>Once the data has been entered,
you could type
</para><screen>PSPP> list /format=numbered.
</screen><para>to list the data.
The optional text ‘<literal>/format=numbered</literal>’ requests the case numbers to be
shown along with the data.
It should show the following output:
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
</para><screen> Data List
+-----------+---------+------+
|Case Number| forename|height|
+-----------+---------+------+
|1 |Ahmed |188.00|
|2 |Bertram |167.00|
|3 |Catherine|134.23|
|4 |David |109.10|
+-----------+---------+------+
</screen><para>Note that the numeric variable <emphasis role="bold">height</emphasis> is displayed to 2 decimal
places, because the format for that variable is ‘<literal>F8.2</literal>’.
For a complete description of the <literal>LIST</literal> command, see <link linkend="LIST">LIST</link>.
</para>
</sect2>
<sect2 label="5.1.3" id="Reading-data-from-a-text-file">
<title>Reading data from a text file</title>
<indexterm role="cp"><primary>reading data</primary></indexterm>
<para>The previous example showed how to define a set of variables and to
manually enter the data for those variables.
Manual entering of data is tedious work, and often
a file containing the data will be have been previously
prepared.
Let us assume that you have a file called <filename>mydata.dat</filename> containing the
ascii encoded data:
</para><screen>Ahmed 188.00
Bertram 167.00
Catherine 134.23
David 109.10
  .
  .
  .
Zachariah 113.02
</screen><para>You can can tell the <literal>DATA LIST</literal> command to read the data directly from
this file instead of by manual entry, with a command like:
</para><screen>PSPP> data list file='mydata.dat' list /forename (A12) height.
</screen><para>Notice however, that it is still necessary to specify the names of the
variables and their formats, since this information is not contained
in the file.
It is also possible to specify the file’s character encoding and other
parameters.
For full details refer to see <link linkend="DATA-LIST">DATA LIST</link>.
</para>
</sect2>
<sect2 label="5.1.4" id="Reading-data-from-a-pre_002dprepared-PSPP-file">
<title>Reading data from a pre-prepared PSPP file</title>
<indexterm role="cp"><primary>system files</primary></indexterm>
<indexterm role="vr"><primary>GET</primary></indexterm>
<para>When working with other PSPP users, or users of other software which
uses the PSPP data format, you may be given the data in
a pre-prepared PSPP file.
Such files contain not only the data, but the variable definitions,
along with their formats, labels and other meta-data.
Conventionally, these files (sometimes called “system” files)
have the suffix <filename>.sav</filename>, but that is
not mandatory.
The following syntax loads a file called <filename>my-file.sav</filename>.
</para><screen>PSPP> get file='my-file.sav'.
</screen><para>You will encounter several instances of this in future examples.
</para>
</sect2>
<sect2 label="5.1.5" id="Saving-data-to-a-PSPP-file_002e">
<title>Saving data to a PSPP file.</title>
<indexterm role="cp"><primary>saving</primary></indexterm>
<indexterm role="vr"><primary>SAVE</primary></indexterm>
<para>If you want to save your data, along with the variable definitions so
that you or other PSPP users can use it later, you can do this with
the <literal>SAVE</literal> command.
</para>
<para>The following syntax will save the existing data and variables to a
file called <filename>my-new-file.sav</filename>.
</para><screen>PSPP> save outfile='my-new-file.sav'.
</screen><para>If <filename>my-new-file.sav</filename> already exists, then it will be overwritten.
Otherwise it will be created.
</para>
</sect2>
<sect2 label="5.1.6" id="Reading-data-from-other-sources">
<title>Reading data from other sources</title>
<indexterm role="cp"><primary>comma separated values</primary></indexterm>
<indexterm role="cp"><primary>spreadsheets</primary></indexterm>
<indexterm role="cp"><primary>databases</primary></indexterm>
<para>Sometimes it’s useful to be able to read data from comma
separated text, from spreadsheets, databases or other sources.
In these instances you should
use the <literal>GET DATA</literal> command (see <link linkend="GET-DATA">GET DATA</link>).
</para>
</sect2>
<sect2 label="5.1.7" id="Exiting-PSPP">
<title>Exiting PSPP</title>
<para>Use the <literal>FINISH</literal> command to exit PSPP:
</para><screen>PSPP> finish.
</screen>
</sect2>
</sect1>
<sect1 label="5.2" id="Data-Screening-and-Transformation">
<title>Data Screening and Transformation</title>
<indexterm role="cp"><primary>screening</primary></indexterm>
<indexterm role="cp"><primary>transformation</primary></indexterm>
<para>Once data has been entered, it is often desirable, or even necessary,
to transform it in some way before performing analysis upon it.
At the very least, it’s good practice to check for errors.
</para>
<sect2 label="5.2.1" id="Identifying-incorrect-data">
<title>Identifying incorrect data</title>
<indexterm role="cp"><primary>erroneous data</primary></indexterm>
<indexterm role="cp"><primary>errors, in data</primary></indexterm>
<para>Data from real sources is rarely error free.
PSPP has a number of procedures which can be used to help
identify data which might be incorrect.
</para>
<para>The <literal>DESCRIPTIVES</literal> command (see <link linkend="DESCRIPTIVES">DESCRIPTIVES</link>) is used to generate
simple linear statistics for a dataset. It is also useful for
identifying potential problems in the data.
The example file <filename>physiology.sav</filename> contains a number of physiological
measurements of a sample of healthy adults selected at random.
However, the data entry clerk made a number of mistakes when entering
the data.
The following example illustrates the use of <literal>DESCRIPTIVES</literal> to screen this
data and identify the erroneous values:
</para>
<screen>PSPP> get file='//share/pspp/examples/physiology.sav'.
PSPP> descriptives sex, weight, height.
</screen>
<para>For this example, PSPP produces the following output:
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
</para><screen> Descriptive Statistics
+---------------------+--+-------+-------+-------+-------+
| | N| Mean |Std Dev|Minimum|Maximum|
+---------------------+--+-------+-------+-------+-------+
|Sex of subject |40| .45| .50|Male |Female |
|Weight in kilograms |40| 72.12| 26.70| -55.6| 92.1|
|Height in millimeters|40|1677.12| 262.87| 179| 1903|
|Valid N (listwise) |40| | | | |
|Missing N (listwise) | 0| | | | |
+---------------------+--+-------+-------+-------+-------+
</screen>
<para>The most interesting column in the output is the minimum value.
The <emphasis role="bold">weight</emphasis> variable has a minimum value of less than zero,
which is clearly erroneous.
Similarly, the <emphasis role="bold">height</emphasis> variable’s minimum value seems to be very low.
In fact, it is more than 5 standard deviations from the mean, and is a
seemingly bizarre height for an adult person.
</para>
<para>We can look deeper into these discrepancies by issuing an additional
<literal>EXAMINE</literal> command:
</para>
<screen>PSPP> examine height, weight /statistics=extreme(3).
</screen>
<para>This command produces the following additional output (in part):
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
</para><screen> Extreme Values
+-------------------------------+-----------+-----+
| |Case Number|Value|
+-------------------------------+-----------+-----+
|Height in millimeters Highest 1| 14| 1903|
| 2| 15| 1884|
| 3| 12| 1802|
| ----------+-----------+-----+
| Lowest 1| 30| 179|
| 2| 31| 1598|
| 3| 28| 1601|
+-------------------------------+-----------+-----+
|Weight in kilograms Highest 1| 13| 92.1|
| 2| 5| 92.1|
| 3| 17| 91.7|
| ----------+-----------+-----+
| Lowest 1| 38|-55.6|
| 2| 39| 54.5|
| 3| 33| 55.4|
+-------------------------------+-----------+-----+
</screen>
<para>From this new output, you can see that the lowest value of <emphasis role="bold">height</emphasis> is
179 (which we suspect to be erroneous), but the second lowest is 1598
which
we know from <literal>DESCRIPTIVES</literal>
is within 1 standard deviation from the mean.
Similarly, the lowest value of <emphasis role="bold">weight</emphasis> is
negative, but its second lowest value is plausible.
This suggests that the two extreme values are outliers and probably
represent data entry errors.
</para>
<para>The output also identifies the case numbers for each extreme value,
so we can see that
cases 30 and 38 are the ones with the erroneous values.
</para>
</sect2>
<sect2 label="5.2.2" id="Dealing-with-suspicious-data">
<title>Dealing with suspicious data</title>
<indexterm role="cp"><primary>SYSMIS</primary></indexterm>
<indexterm role="cp"><primary>recoding data</primary></indexterm>
<para>If possible, suspect data should be checked and re-measured.
However, this may not always be feasible, in which case the researcher may
decide to disregard these values.
PSPP has a feature whereby data can assume the special value ‘SYSMIS’, and
will be disregarded in future analysis. See <link linkend="Missing-Observations">Missing Observations</link>.
You can set the two suspect values to the ‘SYSMIS’ value using the <literal>RECODE</literal>
command.
</para><screen>PSPP> recode height (179 = SYSMIS).
PSPP> recode weight (LOWEST THRU 0 = SYSMIS).
</screen><para>The first command says that for any observation which has a
<emphasis role="bold">height</emphasis> value of 179, that value should be changed to the SYSMIS
value.
The second command says that any <emphasis role="bold">weight</emphasis> values of zero or less
should be changed to SYSMIS.
From now on, they will be ignored in analysis.
For detailed information about the <literal>RECODE</literal> command see <link linkend="RECODE">RECODE</link>.
</para>
<para>If you now re-run the <literal>DESCRIPTIVES</literal> or <literal>EXAMINE</literal> commands from
the previous section,
you will see a data summary with more plausible parameters.
You will also notice that the data summaries indicate the two missing values.
</para>
</sect2>
<sect2 label="5.2.3" id="Inverting-negatively-coded-variables">
<title>Inverting negatively coded variables</title>
<indexterm role="cp"><primary>Likert scale</primary></indexterm>
<indexterm role="cp"><primary>Inverting data</primary></indexterm>
<para>Data entry errors are not the only reason for wanting to recode data.
The sample file <filename>hotel.sav</filename> comprises data gathered from a
customer satisfaction survey of clients at a particular hotel.
The following commands load the file and display its
variables and associated data:
</para>
<screen>PSPP> get file='//share/pspp/examples/hotel.sav'.
PSPP> display dictionary.
</screen>
<para>It yields the following output:
</para>
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Variables
+----+--------+-------------+------------+-----+-----+---------+------+-------+
| | | | Measurement| | | | Print| Write |
|Name|Position| Label | Level | Role|Width|Alignment|Format| Format|
+----+--------+-------------+------------+-----+-----+---------+------+-------+
|v1 | 1|I am |Ordinal |Input| 8|Right |F8.0 |F8.0 |
| | |satisfied | | | | | | |
| | |with the | | | | | | |
| | |level of | | | | | | |
| | |service | | | | | | |
|v2 | 2|The value for|Ordinal |Input| 8|Right |F8.0 |F8.0 |
| | |money was | | | | | | |
| | |good | | | | | | |
|v3 | 3|The staff |Ordinal |Input| 8|Right |F8.0 |F8.0 |
| | |were slow in | | | | | | |
| | |responding | | | | | | |
|v4 | 4|My concerns |Ordinal |Input| 8|Right |F8.0 |F8.0 |
| | |were dealt | | | | | | |
| | |with in an | | | | | | |
| | |efficient | | | | | | |
| | |manner | | | | | | |
|v5 | 5|There was too|Ordinal |Input| 8|Right |F8.0 |F8.0 |
| | |much noise in| | | | | | |
| | |the rooms | | | | | | |
+----+--------+-------------+------------+-----+-----+---------+------+-------+
Value Labels
+----------------------------------------------------+-----------------+
|Variable Value | Label |
+----------------------------------------------------+-----------------+
|I am satisfied with the level of service 1|Strongly Disagree|
| 2|Disagree |
| 3|No Opinion |
| 4|Agree |
| 5|Strongly Agree |
+----------------------------------------------------+-----------------+
|The value for money was good 1|Strongly Disagree|
| 2|Disagree |
| 3|No Opinion |
| 4|Agree |
| 5|Strongly Agree |
+----------------------------------------------------+-----------------+
|The staff were slow in responding 1|Strongly Disagree|
| 2|Disagree |
| 3|No Opinion |
| 4|Agree |
| 5|Strongly Agree |
+----------------------------------------------------+-----------------+
|My concerns were dealt with in an efficient manner 1|Strongly Disagree|
| 2|Disagree |
| 3|No Opinion |
| 4|Agree |
| 5|Strongly Agree |
+----------------------------------------------------+-----------------+
|There was too much noise in the rooms 1|Strongly Disagree|
| 2|Disagree |
| 3|No Opinion |
| 4|Agree |
| 5|Strongly Agree |
+----------------------------------------------------+-----------------+
</screen>
<para>The output shows that all of the variables <emphasis role="bold">v1</emphasis> through <emphasis role="bold">v5</emphasis> are measured on a 5 point Likert scale,
with 1 meaning “Strongly disagree” and 5 meaning “Strongly agree”.
However, some of the questions are positively worded (<emphasis role="bold">v1</emphasis>, <emphasis role="bold">v2</emphasis>, <emphasis role="bold">v4</emphasis>) and others are negatively worded (<emphasis role="bold">v3</emphasis>, <emphasis role="bold">v5</emphasis>).
To perform meaningful analysis, we need to recode the variables so
that they all measure in the same direction.
We could use the <literal>RECODE</literal> command, with syntax such as:
</para><screen>recode v3 (1 = 5) (2 = 4) (4 = 2) (5 = 1).
</screen><para>However an easier and more elegant way uses the <literal>COMPUTE</literal>
command (see <link linkend="COMPUTE">COMPUTE</link>).
Since the variables are Likert variables in the range (1 … 5),
subtracting their value from 6 has the effect of inverting them:
</para><screen>compute <replaceable>var</replaceable> = 6 - <replaceable>var</replaceable>.
</screen><para>The following section uses this technique to recode the variables
<emphasis role="bold">v3</emphasis> and <emphasis role="bold">v5</emphasis>.
After applying <literal>COMPUTE</literal> for both variables,
all subsequent commands will use the inverted values.
</para>
</sect2>
<sect2 label="5.2.4" id="Testing-data-consistency">
<title>Testing data consistency</title>
<indexterm role="cp"><primary>reliability</primary></indexterm>
<indexterm role="cp"><primary>consistency</primary></indexterm>
<para>A sensible check to perform on survey data is the calculation of
reliability.
This gives the statistician some confidence that the questionnaires have been
completed thoughtfully.
If you examine the labels of variables <emphasis role="bold">v1</emphasis>, <emphasis role="bold">v3</emphasis> and <emphasis role="bold">v4</emphasis>,
you will notice that they ask very similar questions.
One would therefore expect the values of these variables (after recoding)
to closely follow one another, and we can test that with the <literal>RELIABILITY</literal>
command (see <link linkend="RELIABILITY">RELIABILITY</link>).
The following example shows a PSPP session where the user recodes
negatively scaled variables and then requests reliability statistics for
<emphasis role="bold">v1</emphasis>, <emphasis role="bold">v3</emphasis>, and <emphasis role="bold">v4</emphasis>.
</para>
<screen>PSPP> get file='//share/pspp/examples/hotel.sav'.
PSPP> compute v3 = 6 - v3.
PSPP> compute v5 = 6 - v5.
PSPP> reliability v1, v3, v4.
</screen>
<para>This yields the following output:
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
</para><screen>Scale: ANY
Case Processing Summary
+--------+--+-------+
|Cases | N|Percent|
+--------+--+-------+
|Valid |17| 100.0%|
|Excluded| 0| .0%|
|Total |17| 100.0%|
+--------+--+-------+
Reliability Statistics
+----------------+----------+
|Cronbach's Alpha|N of Items|
+----------------+----------+
| .81| 3|
+----------------+----------+
</screen>
<para>As a rule of thumb, many statisticians consider a value of Cronbach’s Alpha of
0.7 or higher to indicate reliable data.
</para>
<para>Here, the value is 0.81, which suggests a high degree of reliability
among variables <emphasis role="bold">v1</emphasis>, <emphasis role="bold">v3</emphasis> and <emphasis role="bold">v4</emphasis>, so the data and
the recoding that we performed are vindicated.
</para>
</sect2>
<sect2 label="5.2.5" id="Testing-for-normality">
<title>Testing for normality</title>
<indexterm role="cp"><primary>normality, testing</primary></indexterm>
<para>Many statistical tests rely upon certain properties of the data.
One common property, upon which many linear tests depend, is that of
normality — the data must have been drawn from a normal distribution.
It is necessary then to ensure normality before deciding upon the
test procedure to use. One way to do this uses the <literal>EXAMINE</literal> command.
</para>
<para>In the following example, a researcher was examining the failure rates
of equipment produced by an engineering company.
The file <filename>repairs.sav</filename> contains the mean time between
failures (<emphasis role="bold">mtbf</emphasis>) of some items of equipment subject to the study.
Before performing linear analysis on the data,
the researcher wanted to ascertain that the data is normally distributed.
</para>
<screen>PSPP> get file='//share/pspp/examples/repairs.sav'.
PSPP> examine mtbf
/statistics=descriptives.
</screen>
<para>This produces the following output:
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
</para><screen> Descriptives
+----------------------------------------------------------+---------+--------+
| | | Std. |
| |Statistic| Error |
+----------------------------------------------------------+---------+--------+
|Mean time between Mean | 8.78| 1.10|
|failures (months) ----------------------------------+---------+--------+
| 95% Confidence Interval Lower | 6.53| |
| for Mean Bound | | |
| Upper | 11.04| |
| Bound | | |
| ----------------------------------+---------+--------+
| 5% Trimmed Mean | 8.20| |
| ----------------------------------+---------+--------+
| Median | 8.29| |
| ----------------------------------+---------+--------+
| Variance | 36.34| |
| ----------------------------------+---------+--------+
| Std. Deviation | 6.03| |
| ----------------------------------+---------+--------+
| Minimum | 1.63| |
| ----------------------------------+---------+--------+
| Maximum | 26.47| |
| ----------------------------------+---------+--------+
| Range | 24.84| |
| ----------------------------------+---------+--------+
| Interquartile Range | 6.03| |
| ----------------------------------+---------+--------+
| Skewness | 1.65| .43|
| ----------------------------------+---------+--------+
| Kurtosis | 3.41| .83|
+----------------------------------------------------------+---------+--------+
</screen>
<para>A normal distribution has a skewness and kurtosis of zero.
The skewness of <emphasis role="bold">mtbf</emphasis> in the output above makes it clear
that the mtbf figures have a lot of positive skew and are therefore
not drawn from a normally distributed variable.
Positive skew can often be compensated for by applying a logarithmic
transformation, as in the following continuation of the example:
</para>
<screen>PSPP> compute mtbf_ln = ln (mtbf).
PSPP> examine mtbf_ln
/statistics=descriptives.
</screen>
<para>which produces the following additional output:
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
</para><screen> Descriptives
+----------------------------------------------------+---------+----------+
| |Statistic|Std. Error|
+----------------------------------------------------+---------+----------+
|mtbf_ln Mean | 1.95| .13|
| ---------------------------------------------+---------+----------+
| 95% Confidence Interval for Mean Lower Bound| 1.69| |
| Upper Bound| 2.22| |
| ---------------------------------------------+---------+----------+
| 5% Trimmed Mean | 1.96| |
| ---------------------------------------------+---------+----------+
| Median | 2.11| |
| ---------------------------------------------+---------+----------+
| Variance | .49| |
| ---------------------------------------------+---------+----------+
| Std. Deviation | .70| |
| ---------------------------------------------+---------+----------+
| Minimum | .49| |
| ---------------------------------------------+---------+----------+
| Maximum | 3.28| |
| ---------------------------------------------+---------+----------+
| Range | 2.79| |
| ---------------------------------------------+---------+----------+
| Interquartile Range | .88| |
| ---------------------------------------------+---------+----------+
| Skewness | -.37| .43|
| ---------------------------------------------+---------+----------+
| Kurtosis | .01| .83|
+----------------------------------------------------+---------+----------+
</screen>
<para>The <literal>COMPUTE</literal> command in the first line above performs the
logarithmic transformation:
</para><screen>compute mtbf_ln = ln (mtbf).
</screen><para>Rather than redefining the existing variable, this use of <literal>COMPUTE</literal>
defines a new variable <emphasis role="bold">mtbf_ln</emphasis> which is
the natural logarithm of <emphasis role="bold">mtbf</emphasis>.
The final command in this example calls <literal>EXAMINE</literal> on this new variable.
The results show that both the skewness and
kurtosis for <emphasis role="bold">mtbf_ln</emphasis> are very close to zero.
This provides some confidence that the <emphasis role="bold">mtbf_ln</emphasis> variable is
normally distributed and thus safe for linear analysis.
In the event that no suitable transformation can be found,
then it would be worth considering
an appropriate non-parametric test instead of a linear one.
See <link linkend="NPAR-TESTS">NPAR TESTS</link>, for information about non-parametric tests.
</para>
</sect2>
</sect1>
<sect1 label="5.3" id="Hypothesis-Testing">
<title>Hypothesis Testing</title>
<indexterm role="cp"><primary>Hypothesis testing</primary></indexterm>
<indexterm role="cp"><primary>p-value</primary></indexterm>
<indexterm role="cp"><primary>null hypothesis</primary></indexterm>
<para>One of the most fundamental purposes of statistical analysis
is hypothesis testing.
Researchers commonly need to test hypotheses about a set of data.
For example, she might want to test whether one set of data comes from
the same distribution as another,
or
whether the mean of a dataset significantly differs from a particular
value.
This section presents just some of the possible tests that PSPP offers.
</para>
<para>The researcher starts by making a <firstterm>null hypothesis</firstterm>.
Often this is a hypothesis which he suspects to be false.
For example, if he suspects that <replaceable>A</replaceable> is greater than <replaceable>B</replaceable> he will
state the null hypothesis as <inlineequation><mathphrase><replaceable>A</replaceable> = <replaceable>B</replaceable></mathphrase></inlineequation>.<!-- -->
<footnote><para>This example assumes that it is already proven that <replaceable>B</replaceable> is
not greater than <replaceable>A</replaceable>.</para></footnote>
</para>
<para>The <firstterm>p-value</firstterm> is a recurring concept in hypothesis testing.
It is the highest acceptable probability that the evidence implying a
null hypothesis is false, could have been obtained when the null
hypothesis is in fact true.
Note that this is not the same as “the probability of making an
error” nor is it the same as “the probability of rejecting a
hypothesis when it is true”.
</para>
<sect2 label="5.3.1" id="Testing-for-differences-of-means">
<title>Testing for differences of means</title>
<indexterm role="cp"><primary>T-test</primary></indexterm>
<indexterm role="vr"><primary>T-TEST</primary></indexterm>
<para>A common statistical test involves hypotheses about means.
The <literal>T-TEST</literal> command is used to find out whether or not two separate
subsets have the same mean.
</para>
<para>A researcher suspected that the heights and core body
temperature of persons might be different depending upon their sex.
To investigate this, he posed two null hypotheses based on the data
from <filename>physiology.sav</filename> previously encountered:
</para><itemizedlist><listitem><para>The mean heights of males and females in the population are equal.
</para></listitem><listitem><para>The mean body temperature of males and
females in the population are equal.
</para></listitem></itemizedlist><para>For the purposes of the investigation the researcher
decided to use a p-value of 0.05.
</para>
<para>In addition to the T-test, the <literal>T-TEST</literal> command also performs the
Levene test for equal variances.
If the variances are equal, then a more powerful form of the T-test can be used.
However if it is unsafe to assume equal variances,
then an alternative calculation is necessary.
PSPP performs both calculations.
</para>
<para>For the <emphasis role="bold">height</emphasis> variable, the output shows the significance of the
Levene test to be 0.33 which means there is a
33% probability that the
Levene test produces this outcome when the variances are equal.
Had the significance been less than 0.05, then it would have been unsafe to assume that
the variances were equal.
However, because the value is higher than 0.05 the homogeneity of variances assumption
is safe and the “Equal Variances” row (the more powerful test) can be used.
Examining this row, the two tailed significance for the <emphasis role="bold">height</emphasis> t-test
is less than 0.05, so it is safe to reject the null hypothesis and conclude
that the mean heights of males and females are unequal.
</para>
<para>For the <emphasis role="bold">temperature</emphasis> variable, the significance of the Levene test
is 0.58 so again, it is safe to use the row for equal variances.
The equal variances row indicates that the two tailed significance for
<emphasis role="bold">temperature</emphasis> is 0.20. Since this is greater than 0.05 we must reject
the null hypothesis and conclude that there is insufficient evidence to
suggest that the body temperature of male and female persons are different.
</para>
<para>The syntax for this analysis is:
</para><screen>PSPP> get file='//share/pspp/examples/physiology.sav'.
PSPP> recode height (179 = SYSMIS).
PSPP> t-test group=sex(0,1) /variables = height temperature.
</screen>
<para>PSPP produces the following output for this syntax:
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
</para><screen> Group Statistics
+-------------------------------------------+--+-------+-------------+--------+
| | | | Std. | S.E. |
| Group | N| Mean | Deviation | Mean |
+-------------------------------------------+--+-------+-------------+--------+
|Height in millimeters Male |22|1796.49| 49.71| 10.60|
| Female|17|1610.77| 25.43| 6.17|
+-------------------------------------------+--+-------+-------------+--------+
|Internal body temperature in degrees Male |22| 36.68| 1.95| .42|
|Celcius Female|18| 37.43| 1.61| .38|
+-------------------------------------------+--+-------+-------------+--------+
Independent Samples Test
+---------------------+----------+------------------------------------------
| | Levene's |
| | Test for |
| | Equality |
| | of |
| | Variances| T-Test for Equality of Means
| +----+-----+-----+-----+-------+----------+----------+
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | Sig. | | |
| | | | | | (2- | Mean |Std. Error|
| | F | Sig.| t | df |tailed)|Difference|Difference|
+---------------------+----+-----+-----+-----+-------+----------+----------+
|Height in Equal | .97| .331|14.02|37.00| .000| 185.72| 13.24|
|millimeters variances| | | | | | | |
| assumed | | | | | | | |
| Equal | | |15.15|32.71| .000| 185.72| 12.26|
| variances| | | | | | | |
| not | | | | | | | |
| assumed | | | | | | | |
+---------------------+----+-----+-----+-----+-------+----------+----------+
|Internal Equal | .31| .581|-1.31|38.00| .198| -.75| .57|
|body variances| | | | | | | |
|temperature assumed | | | | | | | |
|in degrees Equal | | |-1.33|37.99| .190| -.75| .56|
|Celcius variances| | | | | | | |
| not | | | | | | | |
| assumed | | | | | | | |
+---------------------+----+-----+-----+-----+-------+----------+----------+
+---------------------+-------------+
| | |
| | |
| | |
| | |
| | |
| +-------------+
| | 95% |
| | Confidence |
| | Interval of |
| | the |
| | Difference |
| +------+------+
| | Lower| Upper|
+---------------------+------+------+
|Height in Equal |158.88|212.55|
|millimeters variances| | |
| assumed | | |
| Equal |160.76|210.67|
| variances| | |
| not | | |
| assumed | | |
+---------------------+------+------+
|Internal Equal | -1.91| .41|
|body variances| | |
|temperature assumed | | |
|in degrees Equal | -1.89| .39|
|Celcius variances| | |
| not | | |
| assumed | | |
+---------------------+------+------+
</screen>
<para>The <literal>T-TEST</literal> command tests for differences of means.
Here, the <emphasis role="bold">height</emphasis> variable’s two tailed significance is less than
0.05, so the null hypothesis can be rejected.
Thus, the evidence suggests there is a difference between the heights of
male and female persons.
However the significance of the test for the <emphasis role="bold">temperature</emphasis>
variable is greater than 0.05 so the null hypothesis cannot be
rejected, and there is insufficient evidence to suggest a difference
in body temperature.
</para>
</sect2>
<sect2 label="5.3.2" id="Linear-Regression">
<title>Linear Regression</title>
<indexterm role="cp"><primary>linear regression</primary></indexterm>
<indexterm role="vr"><primary>REGRESSION</primary></indexterm>
<para>Linear regression is a technique used to investigate if and how a variable
is linearly related to others.
If a variable is found to be linearly related, then this can be used to
predict future values of that variable.
</para>
<para>In the following example, the service department of the company wanted to
be able to predict the time to repair equipment, in order to improve
the accuracy of their quotations.
It was suggested that the time to repair might be related to the time
between failures and the duty cycle of the equipment.
The p-value of 0.1 was chosen for this investigation.
In order to investigate this hypothesis, the <literal>REGRESSION</literal> command
was used.
This command not only tests if the variables are related, but also
identifies the potential linear relationship. See <link linkend="REGRESSION">REGRESSION</link>.
</para>
<para>A first attempt includes <emphasis role="bold">duty_cycle</emphasis>:
</para>
<screen>PSPP> get file='//share/pspp/examples/repairs.sav'.
PSPP> regression /variables = mtbf duty_cycle /dependent = mttr.
</screen>
<para>This attempt yields the following output (in part):
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
</para><screen> Coefficients (Mean time to repair (hours) )
+------------------------+---------------------+-------------------+-----+----+
| | Unstandardized | Standardized | | |
| | Coefficients | Coefficients | | |
| +---------+-----------+-------------------+ | |
| | B | Std. Error| Beta | t |Sig.|
+------------------------+---------+-----------+-------------------+-----+----+
|(Constant) | 10.59| 3.11| .00| 3.40|.002|
|Mean time between | 3.02| .20| .95|14.88|.000|
|failures (months) | | | | | |
|Ratio of working to non-| -1.12| 3.69| -.02| -.30|.763|
|working time | | | | | |
+------------------------+---------+-----------+-------------------+-----+----+
</screen>
<para>The coefficients in the above table suggest that the formula
<inlineequation><mathphrase><replaceable>mttr</replaceable> = 9.81 + 3.1 \times <replaceable>mtbf</replaceable> + 1.09 \times <replaceable>duty_cycle</replaceable></mathphrase></inlineequation>
can be used to predict the time to repair.
However, the significance value for the <replaceable>duty_cycle</replaceable> coefficient
is very high, which would make this an unsafe predictor.
For this reason, the test was repeated, but omitting the
<emphasis role="bold">duty_cycle</emphasis> variable:
</para>
<screen>PSPP> regression /variables = mtbf /dependent = mttr.
</screen>
<para>This second try produces the following output (in part):
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
</para><screen> Coefficients (Mean time to repair (hours) )
+-----------------------+----------------------+-------------------+-----+----+
| | Unstandardized | Standardized | | |
| | Coefficients | Coefficients | | |
| +---------+------------+-------------------+ | |
| | B | Std. Error | Beta | t |Sig.|
+-----------------------+---------+------------+-------------------+-----+----+
|(Constant) | 9.90| 2.10| .00| 4.71|.000|
|Mean time between | 3.01| .20| .94|15.21|.000|
|failures (months) | | | | | |
+-----------------------+---------+------------+-------------------+-----+----+
</screen>
<para>This time, the significance of all coefficients is no higher than 0.06,
suggesting that at the 0.06 level, the formula
<inlineequation><mathphrase><replaceable>mttr</replaceable> = 10.5 + 3.11 \times <replaceable>mtbf</replaceable></mathphrase></inlineequation> is a reliable
predictor of the time to repair.
</para>
<!-- LocalWords: PSPP dir itemize noindent var cindex dfn cartouche samp xref -->
<!-- LocalWords: pxref ie sav Std Dev kilograms SYSMIS sansserif pre pspp emph -->
<!-- LocalWords: Likert Cronbach's Cronbach mtbf npplot ln myfile cmd NPAR Sig -->
<!-- LocalWords: vindex Levene Levene's df Diff clicksequence mydata dat ascii -->
<!-- LocalWords: mttr outfile -->
<!-- PSPP - a program for statistical analysis. -->
<!-- Copyright (C) 2017, 2020 Free Software Foundation, Inc. -->
<!-- Permission is granted to copy, distribute and/or modify this document -->
<!-- under the terms of the GNU Free Documentation License, Version 1.3 -->
<!-- or any later version published by the Free Software Foundation; -->
<!-- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -->
<!-- A copy of the license is included in the section entitled "GNU -->
<!-- Free Documentation License". -->
<!-- -->
</sect2>
</sect1>
</chapter>
<chapter label="6" id="Language">
<title>The PSPP language</title>
<indexterm role="cp"><primary>language, PSPP</primary></indexterm>
<indexterm role="cp"><primary>PSPP, language</primary></indexterm>
<para>This chapter discusses elements common to many PSPP commands.
Later chapters describe individual commands in detail.
</para>
<sect1 label="6.1" id="Tokens">
<title>Tokens</title>
<indexterm role="cp"><primary>language, lexical analysis</primary></indexterm>
<indexterm role="cp"><primary>language, tokens</primary></indexterm>
<indexterm role="cp"><primary>tokens</primary></indexterm>
<indexterm role="cp"><primary>lexical analysis</primary></indexterm>
<para>PSPP divides most syntax file lines into series of short chunks
called <firstterm>tokens</firstterm>.
Tokens are then grouped to form commands, each of which tells
PSPP to take some action—read in data, write out data, perform
a statistical procedure, etc. Each type of token is
described below.
</para>
<variablelist><varlistentry><term><indexterm role="cp"><primary>identifiers</primary></indexterm>
<emphasis role="bold">Identifiers</emphasis>
</term><listitem><para>Identifiers are names that typically specify variables, commands, or
subcommands. The first character in an identifier must be a letter,
‘<literal>#</literal>’, or ‘<literal>@</literal>’. The remaining characters in the identifier
must be letters, digits, or one of the following special characters:
</para>
<simpara role="center">. _ $ # @</simpara>
<indexterm role="cp"><primary>case-sensitivity</primary></indexterm>
<para>Identifiers may be any length, but only the first 64 bytes are
significant. Identifiers are not case-sensitive: <literal>foobar</literal>,
<literal>Foobar</literal>, <literal>FooBar</literal>, <literal>FOOBAR</literal>, and <literal>FoObaR</literal> are
different representations of the same identifier.
</para>
<indexterm role="cp"><primary>identifiers, reserved</primary></indexterm>
<indexterm role="cp"><primary>reserved identifiers</primary></indexterm>
<para>Some identifiers are reserved. Reserved identifiers may not be used
in any context besides those explicitly described in this manual. The
reserved identifiers are:
</para>
<simpara role="center">ALL AND BY EQ GE GT LE LT NE NOT OR TO WITH</simpara>
</listitem></varlistentry><varlistentry><term><emphasis role="bold">Keywords</emphasis>
</term><listitem><para>Keywords are a subclass of identifiers that form a fixed part of
command syntax. For example, command and subcommand names are
keywords. Keywords may be abbreviated to their first 3 characters if
this abbreviation is unambiguous. (Unique abbreviations of 3 or more
characters are also accepted: ‘<literal>FRE</literal>’, ‘<literal>FREQ</literal>’, and
‘<literal>FREQUENCIES</literal>’ are equivalent when the last is a keyword.)
</para>
<para>Reserved identifiers are always used as keywords. Other identifiers
may be used both as keywords and as user-defined identifiers, such as
variable names.
</para>
</listitem></varlistentry><varlistentry><term><emphasis role="bold">Numbers</emphasis>
</term><listitem><indexterm role="cp"><primary>numbers</primary></indexterm>
<indexterm role="cp"><primary>integers</primary></indexterm>
<indexterm role="cp"><primary>reals</primary></indexterm>
<para>Numbers are expressed in decimal. A decimal point is optional.
Numbers may be expressed in scientific notation by adding ‘<literal>e</literal>’ and
a base-10 exponent, so that ‘<literal>1.234e3</literal>’ has the value 1234. Here
are some more examples of valid numbers:
</para>
<screen>-5 3.14159265359 1e100 -.707 8945.
</screen>
<para>Negative numbers are expressed with a ‘<literal>-</literal>’ prefix. However, in
situations where a literal ‘<literal>-</literal>’ token is expected, what appears to
be a negative number is treated as ‘<literal>-</literal>’ followed by a positive
number.
</para>
<para>No white space is allowed within a number token, except for horizontal
white space between ‘<literal>-</literal>’ and the rest of the number.
</para>
<para>The last example above, ‘<literal>8945.</literal>’ is interpreted as two
tokens, ‘<literal>8945</literal>’ and ‘<literal>.</literal>’, if it is the last token on a line.
See <link linkend="Commands">Forming commands of tokens</link>.
</para>
</listitem></varlistentry><varlistentry><term><emphasis role="bold">Strings</emphasis>
</term><listitem><indexterm role="cp"><primary>strings</primary></indexterm>
<indexterm role="cp"><primary>‘<literal>'</literal>’</primary></indexterm>
<indexterm role="cp"><primary>‘<literal>"</literal>’</primary></indexterm>
<indexterm role="cp"><primary>case-sensitivity</primary></indexterm>
<para>Strings are literal sequences of characters enclosed in pairs of
single quotes (‘<literal>'</literal>’) or double quotes (‘<literal>"</literal>’). To include the
character used for quoting in the string, double it, <emphasis>e.g.</emphasis>
‘<literal>'it''s an apostrophe'</literal>’. White space and case of letters are
significant inside strings.
</para>
<para>Strings can be concatenated using ‘<literal>+</literal>’, so that ‘<literal>"a" + 'b' +
'c'</literal>’ is equivalent to ‘<literal>'abc'</literal>’. So that a long string may be
broken across lines, a line break may precede or follow, or both
precede and follow, the ‘<literal>+</literal>’. (However, an entirely blank line
preceding or following the ‘<literal>+</literal>’ is interpreted as ending the
current command.)
</para>
<para>Strings may also be expressed as hexadecimal character values by
prefixing the initial quote character by ‘<literal>x</literal>’ or ‘<literal>X</literal>’.
Regardless of the syntax file or active dataset’s encoding, the
hexadecimal digits in the string are interpreted as Unicode characters
in UTF-8 encoding.
</para>
<para>Individual Unicode code points may also be expressed by specifying the
hexadecimal code point number in single or double quotes preceded by
‘<literal>u</literal>’ or ‘<literal>U</literal>’. For example, Unicode code point U+1D11E, the
musical G clef character, could be expressed as <literal>U'1D11E'</literal>.
Invalid Unicode code points (above U+10FFFF or in between U+D800 and
U+DFFF) are not allowed.
</para>
<para>When strings are concatenated with ‘<literal>+</literal>’, each segment’s prefix is
considered individually. For example, <literal>'The G clef symbol is:' +
u"1d11e" + "."</literal> inserts a G clef symbol in the middle of an otherwise
plain text string.
</para>
</listitem></varlistentry><varlistentry><term><emphasis role="bold">Punctuators and Operators</emphasis>
</term><listitem><indexterm role="cp"><primary>punctuators</primary></indexterm>
<indexterm role="cp"><primary>operators</primary></indexterm>
<para>These tokens are the punctuators and operators:
</para>
<simpara role="center">, / = ( ) + - * / ** < <= <> > >= ~= & | .</simpara>
<para>Most of these appear within the syntax of commands, but the period
(‘<literal>.</literal>’) punctuator is used only at the end of a command. It is a
punctuator only as the last character on a line (except white space).
When it is the last non-space character on a line, a period is not
treated as part of another token, even if it would otherwise be part
of, <emphasis>e.g.</emphasis>, an identifier or a floating-point number.
</para></listitem></varlistentry></variablelist>
</sect1>
<sect1 label="6.2" id="Commands">
<title>Forming commands of tokens</title>
<indexterm role="cp"><primary>PSPP, command structure</primary></indexterm>
<indexterm role="cp"><primary>language, command structure</primary></indexterm>
<indexterm role="cp"><primary>commands, structure</primary></indexterm>
<para>Most PSPP commands share a common structure. A command begins with a
command name, such as <literal>FREQUENCIES</literal>, <literal>DATA LIST</literal>, or <literal>N OF
CASES</literal>. The command name may be abbreviated to its first word, and
each word in the command name may be abbreviated to its first three
or more characters, where these abbreviations are unambiguous.
</para>
<para>The command name may be followed by one or more <firstterm>subcommands</firstterm>.
Each subcommand begins with a subcommand name, which may be
abbreviated to its first three letters. Some subcommands accept a
series of one or more specifications, which follow the subcommand
name, optionally separated from it by an equals sign
(‘<literal>=</literal>’). Specifications may be separated from each other
by commas or spaces. Each subcommand must be separated from the next (if any)
by a forward slash (‘<literal>/</literal>’).
</para>
<para>There are multiple ways to mark the end of a command. The most common
way is to end the last line of the command with a period (‘<literal>.</literal>’) as
described in the previous section (see <link linkend="Tokens">Tokens</link>). A blank line, or
one that consists only of white space or comments, also ends a command.
</para>
</sect1>
<sect1 label="6.3" id="Syntax-Variants">
<title>Syntax Variants</title>
<indexterm role="cp"><primary>Batch syntax</primary></indexterm>
<indexterm role="cp"><primary>Interactive syntax</primary></indexterm>
<para>There are three variants of command syntax, which vary only in how
they detect the end of one command and the start of the next.
</para>
<para>In <firstterm>interactive mode</firstterm>, which is the default for syntax typed at a
command prompt, a period as the last non-blank character on a line
ends a command. A blank line also ends a command.
</para>
<para>In <firstterm>batch mode</firstterm>, an end-of-line period or a blank line also ends a
command. Additionally, it treats any line that has a non-blank
character in the leftmost column as beginning a new command. Thus, in
batch mode the second and subsequent lines in a command must be
indented.
</para>
<para>Regardless of the syntax mode, a plus sign, minus sign, or period in
the leftmost column of a line is ignored and causes that line to begin
a new command. This is most useful in batch mode, in which the first
line of a new command could not otherwise be indented, but it is
accepted regardless of syntax mode.
</para>
<para>The default mode for reading commands from a file is <firstterm>auto mode</firstterm>.
It is the same as batch mode, except that a line with a non-blank in
the leftmost column only starts a new command if that line begins with
the name of a PSPP command. This correctly interprets most valid PSPP
syntax files regardless of the syntax mode for which they are
intended.
</para>
<para>The <option>--interactive</option> (or <option>-i</option>) or <option>--batch</option> (or
<option>-b</option>) options set the syntax mode for files listed on the PSPP
command line. See <link linkend="Main-Options">Main Options</link>, for more details.
</para>
</sect1>
<sect1 label="6.4" id="Types-of-Commands">
<title>Types of Commands</title>
<para>Commands in PSPP are divided roughly into six categories:
</para>
<variablelist><varlistentry><term><emphasis role="bold">Utility commands</emphasis>
</term><listitem><indexterm role="cp"><primary>utility commands</primary></indexterm>
<para>Set or display various global options that affect PSPP operations.
May appear anywhere in a syntax file. See <link linkend="Utilities">Utility
commands</link>.
</para>
</listitem></varlistentry><varlistentry><term><emphasis role="bold">File definition commands</emphasis>
</term><listitem><indexterm role="cp"><primary>file definition commands</primary></indexterm>
<para>Give instructions for reading data from text files or from special
binary “system files”. Most of these commands replace any previous
data or variables with new data or
variables. At least one file definition command must appear before the first command in any of
the categories below. See <link linkend="Data-Input-and-Output">Data Input and Output</link>.
</para>
</listitem></varlistentry><varlistentry><term><emphasis role="bold">Input program commands</emphasis>
</term><listitem><indexterm role="cp"><primary>input program commands</primary></indexterm>
<para>Though rarely used, these provide tools for reading data files
in arbitrary textual or binary formats. See <link linkend="INPUT-PROGRAM">INPUT PROGRAM</link>.
</para>
</listitem></varlistentry><varlistentry><term><emphasis role="bold">Transformations</emphasis>
</term><listitem><indexterm role="cp"><primary>transformations</primary></indexterm>
<para>Perform operations on data and write data to output files. Transformations
are not carried out until a procedure is executed.
</para>
</listitem></varlistentry><varlistentry><term><emphasis role="bold">Restricted transformations</emphasis>
</term><listitem><indexterm role="cp"><primary>restricted transformations</primary></indexterm>
<para>Transformations that cannot appear in certain contexts. See <link linkend="Order-of-Commands">Order
of Commands</link>, for details.
</para>
</listitem></varlistentry><varlistentry><term><emphasis role="bold">Procedures</emphasis>
</term><listitem><indexterm role="cp"><primary>procedures</primary></indexterm>
<para>Analyze data, writing results of analyses to the listing file. Cause
transformations specified earlier in the file to be performed. In a
more general sense, a <firstterm>procedure</firstterm> is any command that causes the
active dataset (the data) to be read.
</para></listitem></varlistentry></variablelist>
</sect1>
<sect1 label="6.5" id="Order-of-Commands">
<title>Order of Commands</title>
<indexterm role="cp"><primary>commands, ordering</primary></indexterm>
<indexterm role="cp"><primary>order of commands</primary></indexterm>
<para>PSPP does not place many restrictions on ordering of commands. The
main restriction is that variables must be defined before they are otherwise
referenced. This section describes the details of command ordering,
but most users will have no need to refer to them.
</para>
<para>PSPP possesses five internal states, called <firstterm>initial</firstterm>, <firstterm>input-program</firstterm>
<firstterm>file-type</firstterm>, <firstterm>transformation</firstterm>, and <firstterm>procedure</firstterm> states. (Please note the
distinction between the <literal>INPUT PROGRAM</literal> and <literal>FILE TYPE</literal>
<emphasis>commands</emphasis> and the <firstterm>input-program</firstterm> and <firstterm>file-type</firstterm> <emphasis>states</emphasis>.)
</para>
<para>PSPP starts in the initial state. Each successful completion
of a command may cause a state transition. Each type of command has its
own rules for state transitions:
</para>
<variablelist><varlistentry><term><emphasis role="bold">Utility commands</emphasis>
</term><listitem><itemizedlist><listitem><para>Valid in any state.
</para></listitem><listitem><para>Do not cause state transitions. Exception: when <literal>N OF CASES</literal>
is executed in the procedure state, it causes a transition to the
transformation state.
</para></listitem></itemizedlist>
</listitem></varlistentry><varlistentry><term><emphasis role="bold"><literal>DATA LIST</literal></emphasis>
</term><listitem><itemizedlist><listitem><para>Valid in any state.
</para></listitem><listitem><para>When executed in the initial or procedure state, causes a transition to
the transformation state.
</para></listitem><listitem><para>Clears the active dataset if executed in the procedure or transformation
state.
</para></listitem></itemizedlist>
</listitem></varlistentry><varlistentry><term><emphasis role="bold"><literal>INPUT PROGRAM</literal></emphasis>
</term><listitem><itemizedlist><listitem><para>Invalid in input-program and file-type states.
</para></listitem><listitem><para>Causes a transition to the intput-program state.
</para></listitem><listitem><para>Clears the active dataset.
</para></listitem></itemizedlist>
</listitem></varlistentry><varlistentry><term><emphasis role="bold"><literal>FILE TYPE</literal></emphasis>
</term><listitem><itemizedlist><listitem><para>Invalid in intput-program and file-type states.
</para></listitem><listitem><para>Causes a transition to the file-type state.
</para></listitem><listitem><para>Clears the active dataset.
</para></listitem></itemizedlist>
</listitem></varlistentry><varlistentry><term><emphasis role="bold">Other file definition commands</emphasis>
</term><listitem><itemizedlist><listitem><para>Invalid in input-program and file-type states.
</para></listitem><listitem><para>Cause a transition to the transformation state.
</para></listitem><listitem><para>Clear the active dataset, except for <literal>ADD FILES</literal>, <literal>MATCH FILES</literal>,
and <literal>UPDATE</literal>.
</para></listitem></itemizedlist>
</listitem></varlistentry><varlistentry><term><emphasis role="bold">Transformations</emphasis>
</term><listitem><itemizedlist><listitem><para>Invalid in initial and file-type states.
</para></listitem><listitem><para>Cause a transition to the transformation state.
</para></listitem></itemizedlist>
</listitem></varlistentry><varlistentry><term><emphasis role="bold">Restricted transformations</emphasis>
</term><listitem><itemizedlist><listitem><para>Invalid in initial, input-program, and file-type states.
</para></listitem><listitem><para>Cause a transition to the transformation state.
</para></listitem></itemizedlist>
</listitem></varlistentry><varlistentry><term><emphasis role="bold">Procedures</emphasis>
</term><listitem><itemizedlist><listitem><para>Invalid in initial, input-program, and file-type states.
</para></listitem><listitem><para>Cause a transition to the procedure state.
</para></listitem></itemizedlist></listitem></varlistentry></variablelist>
</sect1>
<sect1 label="6.6" id="Missing-Observations">
<title>Handling missing observations</title>
<indexterm role="cp"><primary>missing values</primary></indexterm>
<indexterm role="cp"><primary>values, missing</primary></indexterm>
<para>PSPP includes special support for unknown numeric data values.
Missing observations are assigned a special value, called the
<firstterm>system-missing value</firstterm>. This “value” actually indicates the
absence of a value; it means that the actual value is unknown. Procedures
automatically exclude from analyses those observations or cases that
have missing values. Details of missing value exclusion depend on the
procedure and can often be controlled by the user; refer to
descriptions of individual procedures for details.
</para>
<para>The system-missing value exists only for numeric variables. String
variables always have a defined value, even if it is only a string of
spaces.
</para>
<para>Variables, whether numeric or string, can have designated
<firstterm>user-missing values</firstterm>. Every user-missing value is an actual value
for that variable. However, most of the time user-missing values are
treated in the same way as the system-missing value.
</para>
<para>For more information on missing values, see the following sections:
<link linkend="Datasets">Datasets</link>, <link linkend="MISSING-VALUES">MISSING VALUES</link>, <link linkend="Expressions">Expressions</link>. See also the
documentation on individual procedures for information on how they
handle missing values.
</para>
</sect1>
<sect1 label="6.7" id="Datasets">
<title>Datasets</title>
<indexterm role="cp"><primary>dataset</primary></indexterm>
<indexterm role="cp"><primary>variable</primary></indexterm>
<indexterm role="cp"><primary>dictionary</primary></indexterm>
<para>PSPP works with data organized into <firstterm>datasets</firstterm>. A dataset
consists of a set of <firstterm>variables</firstterm>, which taken together are said to
form a <firstterm>dictionary</firstterm>, and one or more <firstterm>cases</firstterm>, each of which
has one value for each variable.
</para>
<para>At any given time PSPP has exactly one distinguished dataset, called
the <firstterm>active dataset</firstterm>. Most PSPP commands work only with the
active dataset. In addition to the active dataset, PSPP also supports
any number of additional open datasets. The <literal>DATASET</literal> commands
can choose a new active dataset from among those that are open, as
well as create and destroy datasets (see <link linkend="DATASET">DATASET</link>).
</para>
<para>The sections below describe variables in more detail.
</para>
<sect2 label="6.7.1" id="Attributes">
<title>Attributes of Variables</title>
<indexterm role="cp"><primary>variables, attributes of</primary></indexterm>
<indexterm role="cp"><primary>attributes of variables</primary></indexterm>
<para>Each variable has a number of attributes, including:
</para>
<variablelist><varlistentry><term><emphasis role="bold">Name</emphasis>
</term><listitem><para>An identifier, up to 64 bytes long. Each variable must have a different name.
See <link linkend="Tokens">Tokens</link>.
</para>
<para>Some system variable names begin with ‘<literal>$</literal>’, but user-defined
variables’ names may not begin with ‘<literal>$</literal>’.
</para>
<indexterm role="cp"><primary>‘<literal>.</literal>’</primary></indexterm>
<indexterm role="cp"><primary>period</primary></indexterm>
<indexterm role="cp"><primary>variable names, ending with period</primary></indexterm>
<para>The final character in a variable name should not be ‘<literal>.</literal>’, because
such an identifier will be misinterpreted when it is the final token
on a line: <literal>FOO.</literal> is divided into two separate tokens,
‘<literal>FOO</literal>’ and ‘<literal>.</literal>’, indicating end-of-command. See <link linkend="Tokens">Tokens</link>.
</para>
<indexterm role="cp"><primary>‘<literal>_</literal>’</primary></indexterm>
<para>The final character in a variable name should not be ‘<literal>_</literal>’, because
some such identifiers are used for special purposes by PSPP
procedures.
</para>
<para>As with all PSPP identifiers, variable names are not case-sensitive.
PSPP capitalizes variable names on output the same way they were
capitalized at their point of definition in the input.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary>variables, type</primary></indexterm>
<indexterm role="cp"><primary>type of variables</primary></indexterm>
<emphasis role="bold">Type</emphasis>
</term><listitem><para>Numeric or string.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary>variables, width</primary></indexterm>
<indexterm role="cp"><primary>width of variables</primary></indexterm>
<emphasis role="bold">Width</emphasis>
</term><listitem><para>(string variables only) String variables with a width of 8 characters or
fewer are called <firstterm>short string variables</firstterm>. Short string variables
may be used in a few contexts where <firstterm>long string variables</firstterm> (those
with widths greater than 8) are not allowed.
</para>
</listitem></varlistentry><varlistentry><term><emphasis role="bold">Position</emphasis>
</term><listitem><para>Variables in the dictionary are arranged in a specific order.
<literal>DISPLAY</literal> can be used to show this order: see <link linkend="DISPLAY">DISPLAY</link>.
</para>
</listitem></varlistentry><varlistentry><term><emphasis role="bold">Initialization</emphasis>
</term><listitem><para>Either reinitialized to 0 or spaces for each case, or left at its
existing value. See <link linkend="LEAVE">LEAVE</link>.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary>missing values</primary></indexterm>
<indexterm role="cp"><primary>values, missing</primary></indexterm>
<emphasis role="bold">Missing values</emphasis>
</term><listitem><para>Optionally, up to three values, or a range of values, or a specific
value plus a range, can be specified as <firstterm>user-missing values</firstterm>.
There is also a <firstterm>system-missing value</firstterm> that is assigned to an
observation when there is no other obvious value for that observation.
Observations with missing values are automatically excluded from
analyses. User-missing values are actual data values, while the
system-missing value is not a value at all. See <link linkend="Missing-Observations">Missing Observations</link>.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary>variable labels</primary></indexterm>
<indexterm role="cp"><primary>labels, variable</primary></indexterm>
<emphasis role="bold">Variable label</emphasis>
</term><listitem><para>A string that describes the variable. See <link linkend="VARIABLE-LABELS">VARIABLE LABELS</link>.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary>value labels</primary></indexterm>
<indexterm role="cp"><primary>labels, value</primary></indexterm>
<emphasis role="bold">Value label</emphasis>
</term><listitem><para>Optionally, these associate each possible value of the variable with a
string. See <link linkend="VALUE-LABELS">VALUE LABELS</link>.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary>print format</primary></indexterm>
<emphasis role="bold">Print format</emphasis>
</term><listitem><para>Display width, format, and (for numeric variables) number of decimal
places. This attribute does not affect how data are stored, just how
they are displayed. Example: a width of 8, with 2 decimal places.
See <link linkend="Input-and-Output-Formats">Input and Output Formats</link>.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary>write format</primary></indexterm>
<emphasis role="bold">Write format</emphasis>
</term><listitem><para>Similar to print format, but used by the <literal>WRITE</literal> command
(see <link linkend="WRITE">WRITE</link>).
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary>measurement level</primary></indexterm>
<emphasis role="bold">Measurement level</emphasis>
</term><listitem><anchor id="Measurement-Level"/><para>One of the following:
</para>
<variablelist><varlistentry><term>Nominal
</term><listitem><para>Each value of a nominal variable represents a distinct category. The
possible categories are finite and often have value labels. The order
of categories is not significant. Political parties, US states, and
yes/no choices are nominal. Numeric and string variables can be
nominal.
</para>
</listitem></varlistentry><varlistentry><term>Ordinal
</term><listitem><para>Ordinal variables also represent distinct categories, but their values
are arranged according to some natural order. Likert scales, e.g.
from strongly disagree to strongly agree, are ordinal. Data grouped
into ranges, e.g. age groups or income groups, are ordinal. Both
numeric and string variables can be ordinal. String values are
ordered alphabetically, so letter grades from A to F will work as
expected, but <literal>poor</literal>, <literal>satisfactory</literal>, <literal>excellent</literal> will
not.
</para>
</listitem></varlistentry><varlistentry><term>Scale
</term><listitem><para>Scale variables are ones for which differences and ratios are
meaningful. These are often values which have a natural unit
attached, such as age in years, income in dollars, or distance in
miles. Only numeric variables are scalar.
</para></listitem></varlistentry></variablelist>
<para>Variables created by <literal>COMPUTE</literal> and similar transformations,
obtained from external sources, etc., initially have an unknown
measurement level. Any procedure that reads the data will then assign
a default measurement level. PSPP can assign some defaults without
reading the data:
</para>
<itemizedlist><listitem><para>Nominal, if it’s a string variable.
</para>
</listitem><listitem><para>Nominal, if the variable has a WKDAY or MONTH print format.
</para>
</listitem><listitem><para>Scale, if the variable has a DOLLAR, CCA through CCE, or time or date
print format.
</para></listitem></itemizedlist>
<para>Otherwise, PSPP reads the data and decides based on its
distribution:
</para>
<itemizedlist><listitem><para>Nominal, if all observations are missing.
</para>
</listitem><listitem><para>Scale, if one or more valid observations are noninteger or negative.
</para>
</listitem><listitem><para>Scale, if no valid observation is less than 10.
</para>
</listitem><listitem><para>Scale, if the variable has 24 or more unique valid values. The value
24 is the default and can be adjusted (see <link linkend="SET-SCALEMIN">SET SCALEMIN</link>).
</para></listitem></itemizedlist>
<para>Finally, if none of the above is true, PSPP assigns the variable a
nominal measurement level.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary>custom attributes</primary></indexterm>
<emphasis role="bold">Custom attributes</emphasis>
</term><listitem><para>User-defined associations between names and values. See <link linkend="VARIABLE-ATTRIBUTE">VARIABLE
ATTRIBUTE</link>.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary>variable role</primary></indexterm>
<emphasis role="bold">Role</emphasis>
</term><listitem><para>The intended role of a variable for use in dialog boxes in graphical
user interfaces. See <link linkend="VARIABLE-ROLE">VARIABLE ROLE</link>.
</para></listitem></varlistentry></variablelist>
</sect2>
<sect2 label="6.7.2" id="System-Variables">
<title>Variables Automatically Defined by PSPP</title>
<indexterm role="cp"><primary>system variables</primary></indexterm>
<indexterm role="cp"><primary>variables, system</primary></indexterm>
<para>There are seven system variables. These are not like ordinary
variables because system variables are not always stored. They can be used only
in expressions. These system variables, whose values and output formats
cannot be modified, are described below.
</para>
<variablelist><varlistentry><term><indexterm role="cp"><primary><literal>$CASENUM</literal></primary></indexterm>
<literal>$CASENUM</literal>
</term><listitem><para>Case number of the case at the moment. This changes as cases are
shuffled around.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary><literal>$DATE</literal></primary></indexterm>
<literal>$DATE</literal>
</term><listitem><para>Date the PSPP process was started, in format A9, following the
pattern <literal>DD-MMM-YY</literal>.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary><literal>$DATE11</literal></primary></indexterm>
<literal>$DATE11</literal>
</term><listitem><para>Date the PSPP process was started, in format A11, following the
pattern <literal>DD-MMM-YYYY</literal>.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary><literal>$JDATE</literal></primary></indexterm>
<literal>$JDATE</literal>
</term><listitem><para>Number of days between 15 Oct 1582 and the time the PSPP process
was started.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary><literal>$LENGTH</literal></primary></indexterm>
<literal>$LENGTH</literal>
</term><listitem><para>Page length, in lines, in format F11.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary><literal>$SYSMIS</literal></primary></indexterm>
<literal>$SYSMIS</literal>
</term><listitem><para>System missing value, in format F1.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary><literal>$TIME</literal></primary></indexterm>
<literal>$TIME</literal>
</term><listitem><para>Number of seconds between midnight 14 Oct 1582 and the time the active dataset
was read, in format F20.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary><literal>$WIDTH</literal></primary></indexterm>
<literal>$WIDTH</literal>
</term><listitem><para>Page width, in characters, in format F3.
</para></listitem></varlistentry></variablelist>
</sect2>
<sect2 label="6.7.3" id="Sets-of-Variables">
<title>Lists of variable names</title>
<indexterm role="cp"><primary><literal>TO</literal> convention</primary></indexterm>
<indexterm role="cp"><primary>convention, <literal>TO</literal></primary></indexterm>
<para>To refer to a set of variables, list their names one after another.
Optionally, their names may be separated by commas. To include a
range of variables from the dictionary in the list, write the name of
the first and last variable in the range, separated by <literal>TO</literal>. For
instance, if the dictionary contains six variables with the names
<literal>ID</literal>, <literal>X1</literal>, <literal>X2</literal>, <literal>GOAL</literal>, <literal>MET</literal>, and
<literal>NEXTGOAL</literal>, in that order, then <literal>X2 TO MET</literal> would include
variables <literal>X2</literal>, <literal>GOAL</literal>, and <literal>MET</literal>.
</para>
<para>Commands that define variables, such as <literal>DATA LIST</literal>, give
<literal>TO</literal> an alternate meaning. With these commands, <literal>TO</literal> define
sequences of variables whose names end in consecutive integers. The
syntax is two identifiers that begin with the same root and end with
numbers, separated by <literal>TO</literal>. The syntax <literal>X1 TO X5</literal> defines 5
variables, named <literal>X1</literal>, <literal>X2</literal>, <literal>X3</literal>, <literal>X4</literal>, and
<literal>X5</literal>. The syntax <literal>ITEM0008 TO ITEM0013</literal> defines 6
variables, named <literal>ITEM0008</literal>, <literal>ITEM0009</literal>, <literal>ITEM0010</literal>,
<literal>ITEM0011</literal>, <literal>ITEM0012</literal>, and <literal>ITEM00013</literal>. The syntaxes
<literal>QUES001 TO QUES9</literal> and <literal>QUES6 TO QUES3</literal> are invalid.
</para>
<para>After a set of variables has been defined with <literal>DATA LIST</literal> or
another command with this method, the same set can be referenced on
later commands using the same syntax.
</para>
</sect2>
<sect2 label="6.7.4" id="Input-and-Output-Formats">
<title>Input and Output Formats</title>
<indexterm role="cp"><primary>formats</primary></indexterm>
<para>An <firstterm>input format</firstterm> describes how to interpret the contents of an
input field as a number or a string. It might specify that the field
contains an ordinary decimal number, a time or date, a number in binary
or hexadecimal notation, or one of several other notations. Input
formats are used by commands such as <literal>DATA LIST</literal> that read data or
syntax files into the PSPP active dataset.
</para>
<para>Every input format corresponds to a default <firstterm>output format</firstterm> that
specifies the formatting used when the value is output later. It is
always possible to explicitly specify an output format that resembles
the input format. Usually, this is the default, but in cases where the
input format is unfriendly to human readability, such as binary or
hexadecimal formats, the default output format is an easier-to-read
decimal format.
</para>
<para>Every variable has two output formats, called its <firstterm>print format</firstterm> and
<firstterm>write format</firstterm>. Print formats are used in most output contexts;
write formats are used only by <literal>WRITE</literal> (see <link linkend="WRITE">WRITE</link>). Newly
created variables have identical print and write formats, and
<literal>FORMATS</literal>, the most commonly used command for changing formats
(see <link linkend="FORMATS">FORMATS</link>), sets both of them to the same value as well. Thus,
most of the time, the distinction between print and write formats is
unimportant.
</para>
<para>Input and output formats are specified to PSPP with
a <firstterm>format specification</firstterm> of the
form <literal><replaceable>TYPE</replaceable><replaceable>w</replaceable></literal> or <literal>TYPE<replaceable>w</replaceable>.<replaceable>d</replaceable></literal>, where
<replaceable>TYPE</replaceable> is one of the format types described later, <replaceable>w</replaceable> is a
field width measured in columns, and <replaceable>d</replaceable> is an optional number of
decimal places. If <replaceable>d</replaceable> is omitted, a value of 0 is assumed. Some
formats do not allow a nonzero <replaceable>d</replaceable> to be specified.
</para>
<para>The following sections describe the input and output formats supported
by PSPP.
</para>
<sect3 label="6.7.4.1" id="Basic-Numeric-Formats">
<title>Basic Numeric Formats</title>
<indexterm role="cp"><primary>numeric formats</primary></indexterm>
<para>The basic numeric formats are used for input and output of real numbers
in standard or scientific notation. The following table shows an
example of how each format displays positive and negative numbers with
the default decimal point setting:
</para>
<informaltable><tgroup cols="3"><colspec colwidth="10*"></colspec><colspec colwidth="10*"></colspec><colspec colwidth="10*"></colspec><thead><row><entry><para>Format </para></entry><entry><para><literal> 3141.59</literal> </para></entry><entry><para><literal>-3141.59</literal>
</para></entry></row></thead><tbody><row><entry><para>F8.2 </para></entry><entry><para><literal> 3141.59</literal> </para></entry><entry><para><literal>-3141.59</literal>
</para></entry></row><row><entry><para>COMMA9.2 </para></entry><entry><para><literal> 3,141.59</literal> </para></entry><entry><para><literal>-3,141.59</literal>
</para></entry></row><row><entry><para>DOT9.2 </para></entry><entry><para><literal> 3.141,59</literal> </para></entry><entry><para><literal>-3.141,59</literal>
</para></entry></row><row><entry><para>DOLLAR10.2 </para></entry><entry><para><literal> $3,141.59</literal> </para></entry><entry><para><literal>-$3,141.59</literal>
</para></entry></row><row><entry><para>PCT9.2 </para></entry><entry><para><literal> 3141.59%</literal> </para></entry><entry><para><literal>-3141.59%</literal>
</para></entry></row><row><entry><para>E8.1 </para></entry><entry><para><literal> 3.1E+003</literal> </para></entry><entry><para><literal>-3.1E+003</literal>
</para></entry></row></tbody></tgroup></informaltable>
<para>On output, numbers in F format are expressed in standard decimal
notation with the requested number of decimal places. The other formats
output some variation on this style:
</para>
<itemizedlist><listitem><para>Numbers in COMMA format are additionally grouped every three digits by
inserting a grouping character. The grouping character is ordinarily a
comma, but it can be changed to a period (see <link linkend="SET-DECIMAL">SET DECIMAL</link>).
</para>
</listitem><listitem><para>DOT format is like COMMA format, but it interchanges the role of the
decimal point and grouping characters. That is, the current grouping
character is used as a decimal point and vice versa.
</para>
</listitem><listitem><para>DOLLAR format is like COMMA format, but it prefixes the number with
‘<literal>$</literal>’.
</para>
</listitem><listitem><para>PCT format is like F format, but adds ‘<literal>%</literal>’ after the number.
</para>
</listitem><listitem><para>The E format always produces output in scientific notation.
</para></listitem></itemizedlist>
<para>On input, the basic numeric formats accept positive and numbers in
standard decimal notation or scientific notation. Leading and trailing
spaces are allowed. An empty or all-spaces field, or one that contains
only a single period, is treated as the system missing value.
</para>
<para>In scientific notation, the exponent may be introduced by a sign
(‘<literal>+</literal>’ or ‘<literal>-</literal>’), or by one of the letters ‘<literal>e</literal>’ or ‘<literal>d</literal>’
(in uppercase or lowercase), or by a letter followed by a sign. A
single space may follow the letter or the sign or both.
</para>
<para>On fixed-format <literal>DATA LIST</literal> (see <link linkend="DATA-LIST-FIXED">DATA LIST FIXED</link>) and in a few
other contexts, decimals are implied when the field does not contain a
decimal point. In F6.5 format, for example, the field <literal>314159</literal> is
taken as the value 3.14159 with implied decimals. Decimals are never
implied if an explicit decimal point is present or if scientific
notation is used.
</para>
<para>E and F formats accept the basic syntax already described. The other
formats allow some additional variations:
</para>
<itemizedlist><listitem><para>COMMA, DOLLAR, and DOT formats ignore grouping characters within the
integer part of the input field. The identity of the grouping
character depends on the format.
</para>
</listitem><listitem><para>DOLLAR format allows a dollar sign to precede the number. In a negative
number, the dollar sign may precede or follow the minus sign.
</para>
</listitem><listitem><para>PCT format allows a percent sign to follow the number.
</para></listitem></itemizedlist>
<para>All of the basic number formats have a maximum field width of 40 and
accept no more than 16 decimal places, on both input and output. Some
additional restrictions apply:
</para>
<itemizedlist><listitem><para>As input formats, the basic numeric formats allow no more decimal places
than the field width. As output formats, the field width must be
greater than the number of decimal places; that is, large enough to
allow for a decimal point and the number of requested decimal places.
DOLLAR and PCT formats must allow an additional column for ‘<literal>$</literal>’ or
‘<literal>%</literal>’.
</para>
</listitem><listitem><para>The default output format for a given input format increases the field
width enough to make room for optional input characters. If an input
format calls for decimal places, the width is increased by 1 to make
room for an implied decimal point. COMMA, DOT, and DOLLAR formats also
increase the output width to make room for grouping characters. DOLLAR
and PCT further increase the output field width by 1 to make room for
‘<literal>$</literal>’ or ‘<literal>%</literal>’. The increased output width is capped at 40, the
maximum field width.
</para>
</listitem><listitem><para>The E format is exceptional. For output, E format has a minimum width
of 7 plus the number of decimal places. The default output format for
an E input format is an E format with at least 3 decimal places and
thus a minimum width of 10.
</para></listitem></itemizedlist>
<para>More details of basic numeric output formatting are given below:
</para>
<itemizedlist><listitem><para>Output rounds to nearest, with ties rounded away from zero. Thus, 2.5
is output as <literal>3</literal> in F1.0 format, and -1.125 as <literal>-1.13</literal> in F5.1
format.
</para>
</listitem><listitem><para>The system-missing value is output as a period in a field of spaces,
placed in the decimal point’s position, or in the rightmost column if no
decimal places are requested. A period is used even if the decimal
point character is a comma.
</para>
</listitem><listitem><para>A number that does not fill its field is right-justified within the
field.
</para>
</listitem><listitem><para>A number is too large for its field causes decimal places to be dropped
to make room. If dropping decimals does not make enough room,
scientific notation is used if the field is wide enough. If a number
does not fit in the field, even in scientific notation, the overflow is
indicated by filling the field with asterisks (‘<literal>*</literal>’).
</para>
</listitem><listitem><para>COMMA, DOT, and DOLLAR formats insert grouping characters only if space
is available for all of them. Grouping characters are never inserted
when all decimal places must be dropped. Thus, 1234.56 in COMMA5.2
format is output as ‘<literal> 1235</literal>’ without a comma, even though there
is room for one, because all decimal places were dropped.
</para>
</listitem><listitem><para>DOLLAR or PCT format drop the ‘<literal>$</literal>’ or ‘<literal>%</literal>’ only if the number
would not fit at all without it. Scientific notation with ‘<literal>$</literal>’ or
‘<literal>%</literal>’ is preferred to ordinary decimal notation without it.
</para>
</listitem><listitem><para>Except in scientific notation, a decimal point is included only when
it is followed by a digit. If the integer part of the number being
output is 0, and a decimal point is included, then PSPP ordinarily
drops the zero before the decimal point. However, in <literal>F</literal>,
<literal>COMMA</literal>, or <literal>DOT</literal> formats, PSPP keeps the zero if
<literal>SET LEADZERO</literal> is set to <literal>ON</literal> (see <link linkend="SET-LEADZERO">SET LEADZERO</link>).
</para>
<para>In scientific notation, the number always includes a decimal point,
even if it is not followed by a digit.
</para>
</listitem><listitem><para>A negative number includes a minus sign only in the presence of a
nonzero digit: -0.01 is output as ‘<literal>-.01</literal>’ in F4.2 format but as
‘<literal>  .0</literal>’ in F4.1 format. Thus, a “negative zero” never
includes a minus sign.
</para>
</listitem><listitem><para>In negative numbers output in DOLLAR format, the dollar sign follows the
negative sign. Thus, -9.99 in DOLLAR6.2 format is output as
<literal>-$9.99</literal>.
</para>
</listitem><listitem><para>In scientific notation, the exponent is output as ‘<literal>E</literal>’ followed by
‘<literal>+</literal>’ or ‘<literal>-</literal>’ and exactly three digits. Numbers with magnitude
less than 10**-999 or larger than 10**999 are not supported by most
computers, but if they are supported then their output is considered
to overflow the field and they are output as asterisks.
</para>
</listitem><listitem><para>On most computers, no more than 15 decimal digits are significant in
output, even if more are printed. In any case, output precision cannot
be any higher than input precision; few data sets are accurate to 15
digits of precision. Unavoidable loss of precision in intermediate
calculations may also reduce precision of output.
</para>
</listitem><listitem><para>Special values such as infinities and “not a number” values are
usually converted to the system-missing value before printing. In a few
circumstances, these values are output directly. In fields of width 3
or greater, special values are output as however many characters
fit from <literal>+Infinity</literal> or <literal>-Infinity</literal> for infinities, from
<literal>NaN</literal> for “not a number,” or from <literal>Unknown</literal> for other values
(if any are supported by the system). In fields under 3 columns wide,
special values are output as asterisks.
</para></listitem></itemizedlist>
</sect3>
<sect3 label="6.7.4.2" id="Custom-Currency-Formats">
<title>Custom Currency Formats</title>
<indexterm role="cp"><primary>currency formats</primary></indexterm>
<para>The custom currency formats are closely related to the basic numeric
formats, but they allow users to customize the output format. The
SET command configures custom currency formats, using the syntax
</para><literallayout>SET CC<replaceable>x</replaceable>=<literal>"</literal><replaceable>string</replaceable><literal>"</literal>.
</literallayout><para>where <replaceable>x</replaceable> is A, B, C, D, or E, and <replaceable>string</replaceable> is no more than 16
characters long.
</para>
<para><replaceable>string</replaceable> must contain exactly three commas or exactly three periods
(but not both), except that a single quote character may be used to
“escape” a following comma, period, or single quote. If three commas
are used, commas are used for grouping in output, and a period
is used as the decimal point. Uses of periods reverses these roles.
</para>
<para>The commas or periods divide <replaceable>string</replaceable> into four fields, called the
<firstterm>negative prefix</firstterm>, <firstterm>prefix</firstterm>, <firstterm>suffix</firstterm>, and <firstterm>negative
suffix</firstterm>, respectively. The prefix and suffix are added to output
whenever space is available. The negative prefix and negative suffix
are always added to a negative number when the output includes a nonzero
digit.
</para>
<para>The following syntax shows how custom currency formats could be used to
reproduce basic numeric formats:
</para>
<screen>SET CCA="-,,,". /* Same as COMMA.
SET CCB="-...". /* Same as DOT.
SET CCC="-,$,,". /* Same as DOLLAR.
SET CCD="-,,%,". /* Like PCT, but groups with commas.
</screen>
<para>Here are some more examples of custom currency formats. The final
example shows how to use a single quote to escape a delimiter:
</para>
<screen>SET CCA=",EUR,,-". /* Euro.
SET CCB="(,USD ,,)". /* US dollar.
SET CCC="-.R$..". /* Brazilian real.
SET CCD="-,, NIS,". /* Israel shekel.
SET CCE="-.Rp'. ..". /* Indonesia Rupiah.
</screen>
<para>These formats would yield the following output:
</para>
<informaltable><tgroup cols="3"><colspec colwidth="7*"></colspec><colspec colwidth="14*"></colspec><colspec colwidth="14*"></colspec><thead><row><entry><para>Format </para></entry><entry><para><literal> 3145.59</literal> </para></entry><entry><para><literal>-3145.59</literal>
</para></entry></row></thead><tbody><row><entry><para>CCA12.2 </para></entry><entry><para><literal> EUR3,145.59</literal> </para></entry><entry><para><literal>EUR3,145.59-</literal>
</para></entry></row><row><entry><para>CCB14.2 </para></entry><entry><para><literal>  USD 3,145.59</literal> </para></entry><entry><para><literal>(USD 3,145.59)</literal>
</para></entry></row><row><entry><para>CCC11.2 </para></entry><entry><para><literal> R$3.145,59</literal> </para></entry><entry><para><literal>-R$3.145,59</literal>
</para></entry></row><row><entry><para>CCD13.2 </para></entry><entry><para><literal> 3,145.59 NIS</literal> </para></entry><entry><para><literal>-3,145.59 NIS</literal>
</para></entry></row><row><entry><para>CCE10.0 </para></entry><entry><para><literal> Rp. 3.146</literal> </para></entry><entry><para><literal>-Rp. 3.146</literal>
</para></entry></row></tbody></tgroup></informaltable>
<para>The default for all the custom currency formats is ‘<literal>-,,,</literal>’,
equivalent to COMMA format.
</para>
</sect3>
<sect3 label="6.7.4.3" id="Legacy-Numeric-Formats">
<title>Legacy Numeric Formats</title>
<para>The N and Z numeric formats provide compatibility with legacy file
formats. They have much in common:
</para>
<itemizedlist><listitem><para>Output is rounded to the nearest representable value, with ties rounded
away from zero.
</para>
</listitem><listitem><para>Numbers too large to display are output as a field filled with asterisks
(‘<literal>*</literal>’).
</para>
</listitem><listitem><para>The decimal point is always implicitly the specified number of digits
from the right edge of the field, except that Z format input allows an
explicit decimal point.
</para>
</listitem><listitem><para>Scientific notation may not be used.
</para>
</listitem><listitem><para>The system-missing value is output as a period in a field of spaces.
The period is placed just to the right of the implied decimal point in
Z format, or at the right end in N format or in Z format if no decimal
places are requested. A period is used even if the decimal point
character is a comma.
</para>
</listitem><listitem><para>Field width may range from 1 to 40. Decimal places may range from 0 up
to the field width, to a maximum of 16.
</para>
</listitem><listitem><para>When a legacy numeric format used for input is converted to an output
format, it is changed into the equivalent F format. The field width is
increased by 1 if any decimal places are specified, to make room for a
decimal point. For Z format, the field width is increased by 1 more
column, to make room for a negative sign. The output field width is
capped at 40 columns.
</para></listitem></itemizedlist>
<bridgehead renderas="sect3">N Format</bridgehead>
<para>The N format supports input and output of fields that contain only
digits. On input, leading or trailing spaces, a decimal point, or any
other non-digit character causes the field to be read as the
system-missing value. As a special exception, an N format used on
<literal>DATA LIST FREE</literal> or <literal>DATA LIST LIST</literal> is treated as the
equivalent F format.
</para>
<para>On output, N pads the field on the left with zeros. Negative numbers
are output like the system-missing value.
</para>
<bridgehead renderas="sect3">Z Format</bridgehead>
<para>The Z format is a “zoned decimal” format used on IBM mainframes. Z
format encodes the sign as part of the final digit, which must be one of
the following:
</para><screen>0123456789
{ABCDEFGHI
}JKLMNOPQR
</screen><para>where the characters in each row represent digits 0 through 9 in order.
Characters in the first two rows indicate a positive sign; those in the
third indicate a negative sign.
</para>
<para>On output, Z fields are padded on the left with spaces. On input,
leading and trailing spaces are ignored. Any character in an input
field other than spaces, the digit characters above, and ‘<literal>.</literal>’ causes
the field to be read as system-missing.
</para>
<para>The decimal point character for input and output is always ‘<literal>.</literal>’,
even if the decimal point character is a comma (see <link linkend="SET-DECIMAL">SET DECIMAL</link>).
</para>
<para>Nonzero, negative values output in Z format are marked as negative even
when no nonzero digits are output. For example, -0.2 is output in Z1.0
format as ‘<literal>J</literal>’. The “negative zero” value supported by most
machines is output as positive.
</para>
</sect3>
<sect3 label="6.7.4.4" id="Binary-and-Hexadecimal-Numeric-Formats">
<title>Binary and Hexadecimal Numeric Formats</title>
<indexterm role="cp"><primary>binary formats</primary></indexterm>
<indexterm role="cp"><primary>hexadecimal formats</primary></indexterm>
<para>The binary and hexadecimal formats are primarily designed for
compatibility with existing machine formats, not for human readability.
All of them therefore have a F format as default output format. Some of
these formats are only portable between machines with compatible byte
ordering (endianness) or floating-point format.
</para>
<para>Binary formats use byte values that in text files are interpreted as
special control functions, such as carriage return and line feed. Thus,
data in binary formats should not be included in syntax files or read
from data files with variable-length records, such as ordinary text
files. They may be read from or written to data files with fixed-length
records. See <link linkend="FILE-HANDLE">FILE HANDLE</link>, for information on working with
fixed-length records.
</para>
<bridgehead renderas="sect3">P and PK Formats</bridgehead>
<para>These are binary-coded decimal formats, in which every byte (except the
last, in P format) represents two decimal digits. The most-significant
4 bits of the first byte is the most-significant decimal digit, the
least-significant 4 bits of the first byte is the next decimal digit,
and so on.
</para>
<para>In P format, the most-significant 4 bits of the last byte are the
least-significant decimal digit. The least-significant 4 bits represent
the sign: decimal 15 indicates a negative value, decimal 13 indicates a
positive value.
</para>
<para>Numbers are rounded downward on output. The system-missing value and
numbers outside representable range are output as zero.
</para>
<para>The maximum field width is 16. Decimal places may range from 0 up to
the number of decimal digits represented by the field.
</para>
<para>The default output format is an F format with twice the input field
width, plus one column for a decimal point (if decimal places were
requested).
</para>
<bridgehead renderas="sect3">IB and PIB Formats</bridgehead>
<para>These are integer binary formats. IB reads and writes 2’s complement
binary integers, and PIB reads and writes unsigned binary integers. The
byte ordering is by default the host machine’s, but SET RIB may be used
to select a specific byte ordering for reading (see <link linkend="SET-RIB">SET RIB</link>) and
SET WIB, similarly, for writing (see <link linkend="SET-WIB">SET WIB</link>).
</para>
<para>The maximum field width is 8. Decimal places may range from 0 up to the
number of decimal digits in the largest value representable in the field
width.
</para>
<para>The default output format is an F format whose width is the number of
decimal digits in the largest value representable in the field width,
plus 1 if the format has decimal places.
</para>
<bridgehead renderas="sect3">RB Format</bridgehead>
<para>This is a binary format for real numbers. By default it reads and
writes the host machine’s floating-point format, but SET RRB may be
used to select an alternate floating-point format for reading
(see <link linkend="SET-RRB">SET RRB</link>) and SET WRB, similarly, for writing (see <link linkend="SET-WRB">SET
WRB</link>).
</para>
<para>The recommended field width depends on the floating-point format.
NATIVE (the default format), IDL, IDB, VD, VG, and ZL formats should use
a field width of 8. ISL, ISB, VF, and ZS formats should use a field
width of 4. Other field widths do not produce useful results. The
maximum field width is 8. No decimal places may be specified.
</para>
<para>The default output format is F8.2.
</para>
<bridgehead renderas="sect3">PIBHEX and RBHEX Formats</bridgehead>
<para>These are hexadecimal formats, for reading and writing binary formats
where each byte has been recoded as a pair of hexadecimal digits.
</para>
<para>A hexadecimal field consists solely of hexadecimal digits
‘<literal>0</literal>’…‘<literal>9</literal>’ and ‘<literal>A</literal>’…‘<literal>F</literal>’. Uppercase and
lowercase are accepted on input; output is in uppercase.
</para>
<para>Other than the hexadecimal representation, these formats are equivalent
to PIB and RB formats, respectively. However, bytes in PIBHEX format
are always ordered with the most-significant byte first (big-endian
order), regardless of the host machine’s native byte order or PSPP
settings.
</para>
<para>Field widths must be even and between 2 and 16. RBHEX format allows no
decimal places; PIBHEX allows as many decimal places as a PIB format
with half the given width.
</para>
</sect3>
<sect3 label="6.7.4.5" id="Time-and-Date-Formats">
<title>Time and Date Formats</title>
<indexterm role="cp"><primary>time formats</primary></indexterm>
<indexterm role="cp"><primary>date formats</primary></indexterm>
<para>In PSPP, a <firstterm>time</firstterm> is an interval. The time formats translate
between human-friendly descriptions of time intervals and PSPP’s
internal representation of time intervals, which is simply the number of
seconds in the interval. PSPP has three time formats:
</para>
<informaltable><tgroup cols="3"><colspec colwidth="11*"></colspec><colspec colwidth="23*"></colspec><colspec colwidth="23*"></colspec><thead><row><entry><para>Time Format </para></entry><entry><para>Template </para></entry><entry><para>Example
</para></entry></row></thead><tbody><row><entry><para>MTIME </para></entry><entry><para><literal>MM:SS.ss</literal> </para></entry><entry><para><literal>91:17.01</literal>
</para></entry></row><row><entry><para>TIME </para></entry><entry><para><literal>hh:MM:SS.ss</literal> </para></entry><entry><para><literal>01:31:17.01</literal>
</para></entry></row><row><entry><para>DTIME </para></entry><entry><para><literal>DD HH:MM:SS.ss</literal> </para></entry><entry><para><literal>00 04:31:17.01</literal>
</para></entry></row></tbody></tgroup></informaltable>
<para>A <firstterm>date</firstterm> is a moment in the past or the future. Internally, PSPP
represents a date as the number of seconds since the <firstterm>epoch</firstterm>,
midnight, Oct. 14, 1582. The date formats translate between
human-readable dates and PSPP’s numeric representation of dates and
times. PSPP has several date formats:
</para>
<informaltable><tgroup cols="3"><colspec colwidth="11*"></colspec><colspec colwidth="23*"></colspec><colspec colwidth="23*"></colspec><thead><row><entry><para>Date Format </para></entry><entry><para>Template </para></entry><entry><para>Example
</para></entry></row></thead><tbody><row><entry><para>DATE </para></entry><entry><para><literal>dd-mmm-yyyy</literal> </para></entry><entry><para><literal>01-OCT-1978</literal>
</para></entry></row><row><entry><para>ADATE </para></entry><entry><para><literal>mm/dd/yyyy</literal> </para></entry><entry><para><literal>10/01/1978</literal>
</para></entry></row><row><entry><para>EDATE </para></entry><entry><para><literal>dd.mm.yyyy</literal> </para></entry><entry><para><literal>01.10.1978</literal>
</para></entry></row><row><entry><para>JDATE </para></entry><entry><para><literal>yyyyjjj</literal> </para></entry><entry><para><literal>1978274</literal>
</para></entry></row><row><entry><para>SDATE </para></entry><entry><para><literal>yyyy/mm/dd</literal> </para></entry><entry><para><literal>1978/10/01</literal>
</para></entry></row><row><entry><para>QYR </para></entry><entry><para><literal>q Q yyyy</literal> </para></entry><entry><para><literal>3 Q 1978</literal>
</para></entry></row><row><entry><para>MOYR </para></entry><entry><para><literal>mmm yyyy</literal> </para></entry><entry><para><literal>OCT 1978</literal>
</para></entry></row><row><entry><para>WKYR </para></entry><entry><para><literal>ww WK yyyy</literal> </para></entry><entry><para><literal>40 WK 1978</literal>
</para></entry></row><row><entry><para>DATETIME </para></entry><entry><para><literal>dd-mmm-yyyy HH:MM:SS.ss</literal> </para></entry><entry><para><literal>01-OCT-1978 04:31:17.01</literal>
</para></entry></row><row><entry><para>YMDHMS </para></entry><entry><para><literal>yyyy-mm-dd HH:MM:SS.ss</literal> </para></entry><entry><para><literal>1978-01-OCT 04:31:17.01</literal>
</para></entry></row></tbody></tgroup></informaltable>
<para>The templates in the preceding tables describe how the time and date
formats are input and output:
</para>
<variablelist><varlistentry><term><literal>dd</literal>
</term><listitem><para>Day of month, from 1 to 31. Always output as two digits.
</para>
</listitem></varlistentry><varlistentry><term><literal>mm</literal>
</term><term><literal>mmm</literal>
</term><listitem><para>Month. In output, <literal>mm</literal> is output as two digits, <literal>mmm</literal> as the
first three letters of an English month name (January, February,
…). In input, both of these formats, plus Roman numerals, are
accepted.
</para>
</listitem></varlistentry><varlistentry><term><literal>yyyy</literal>
</term><listitem><para>Year. In output, DATETIME and YMDHMS always produce 4-digit years;
other formats can produce a 2- or 4-digit year. The century assumed
for 2-digit years depends on the EPOCH setting (see <link linkend="SET-EPOCH">SET EPOCH</link>).
In output, a year outside the epoch causes the whole field to be
filled with asterisks (‘<literal>*</literal>’).
</para>
</listitem></varlistentry><varlistentry><term><literal>jjj</literal>
</term><listitem><para>Day of year (Julian day), from 1 to 366. This is exactly three digits
giving the count of days from the start of the year. January 1 is
considered day 1.
</para>
</listitem></varlistentry><varlistentry><term><literal>q</literal>
</term><listitem><para>Quarter of year, from 1 to 4. Quarters start on January 1, April 1,
July 1, and October 1.
</para>
</listitem></varlistentry><varlistentry><term><literal>ww</literal>
</term><listitem><para>Week of year, from 1 to 53. Output as exactly two digits. January 1 is
the first day of week 1.
</para>
</listitem></varlistentry><varlistentry><term><literal>DD</literal>
</term><listitem><para>Count of days, which may be positive or negative. Output as at least
two digits.
</para>
</listitem></varlistentry><varlistentry><term><literal>hh</literal>
</term><listitem><para>Count of hours, which may be positive or negative. Output as at least
two digits.
</para>
</listitem></varlistentry><varlistentry><term><literal>HH</literal>
</term><listitem><para>Hour of day, from 0 to 23. Output as exactly two digits.
</para>
</listitem></varlistentry><varlistentry><term><literal>MM</literal>
</term><listitem><para>In MTIME, count of minutes, which may be positive or negative. Output
as at least two digits.
</para>
<para>In other formats, minute of hour, from 0 to 59. Output as exactly two
digits.
</para>
</listitem></varlistentry><varlistentry><term><literal>SS.ss</literal>
</term><listitem><para>Seconds within minute, from 0 to 59. The integer part is output as
exactly two digits. On output, seconds and fractional seconds may or
may not be included, depending on field width and decimal places. On
input, seconds and fractional seconds are optional. The DECIMAL setting
controls the character accepted and displayed as the decimal point
(see <link linkend="SET-DECIMAL">SET DECIMAL</link>).
</para></listitem></varlistentry></variablelist>
<para>For output, the date and time formats use the delimiters indicated in
the table. For input, date components may be separated by spaces or by
one of the characters ‘<literal>-</literal>’, ‘<literal>/</literal>’, ‘<literal>.</literal>’, or ‘<literal>,</literal>’, and
time components may be separated by spaces or ‘<literal>:</literal>’. On
input, the ‘<literal>Q</literal>’ separating quarter from year and the ‘<literal>WK</literal>’
separating week from year may be uppercase or lowercase, and the spaces
around them are optional.
</para>
<para>On input, all time and date formats accept any amount of leading and
trailing white space.
</para>
<para>The maximum width for time and date formats is 40 columns. Minimum
input and output width for each of the time and date formats is shown
below:
</para>
<informaltable><tgroup cols="4"><colspec colwidth="8*"></colspec><colspec colwidth="16*"></colspec><colspec colwidth="17*"></colspec><colspec colwidth="12*"></colspec><thead><row><entry><para>Format </para></entry><entry><para>Min. Input Width </para></entry><entry><para>Min. Output Width </para></entry><entry><para>Option
</para></entry></row></thead><tbody><row><entry><para>DATE </para></entry><entry><para>8 </para></entry><entry><para>9 </para></entry><entry><para>4-digit year
</para></entry></row><row><entry><para>ADATE </para></entry><entry><para>8 </para></entry><entry><para>8 </para></entry><entry><para>4-digit year
</para></entry></row><row><entry><para>EDATE </para></entry><entry><para>8 </para></entry><entry><para>8 </para></entry><entry><para>4-digit year
</para></entry></row><row><entry><para>JDATE </para></entry><entry><para>5 </para></entry><entry><para>5 </para></entry><entry><para>4-digit year
</para></entry></row><row><entry><para>SDATE </para></entry><entry><para>8 </para></entry><entry><para>8 </para></entry><entry><para>4-digit year
</para></entry></row><row><entry><para>QYR </para></entry><entry><para>4 </para></entry><entry><para>6 </para></entry><entry><para>4-digit year
</para></entry></row><row><entry><para>MOYR </para></entry><entry><para>6 </para></entry><entry><para>6 </para></entry><entry><para>4-digit year
</para></entry></row><row><entry><para>WKYR </para></entry><entry><para>6 </para></entry><entry><para>8 </para></entry><entry><para>4-digit year
</para></entry></row><row><entry><para>DATETIME </para></entry><entry><para>17 </para></entry><entry><para>17 </para></entry><entry><para>seconds
</para></entry></row><row><entry><para>YMDHMS </para></entry><entry><para>12 </para></entry><entry><para>16 </para></entry><entry><para>seconds
</para></entry></row><row><entry><para>MTIME </para></entry><entry><para>4 </para></entry><entry><para>5
</para></entry></row><row><entry><para>TIME </para></entry><entry><para>5 </para></entry><entry><para>5 </para></entry><entry><para>seconds
</para></entry></row><row><entry><para>DTIME </para></entry><entry><para>8 </para></entry><entry><para>8 </para></entry><entry><para>seconds
</para></entry></row></tbody></tgroup></informaltable><para>In the table, “Option” describes what increased output width enables:
</para>
<variablelist><varlistentry><term>4-digit year
</term><listitem><para>A field 2 columns wider than the minimum includes a 4-digit year.
(DATETIME and YMDHMS formats always include a 4-digit year.)
</para>
</listitem></varlistentry><varlistentry><term>seconds
</term><listitem><para>A field 3 columns wider than the minimum includes seconds as well as
minutes. A field 5 columns wider than minimum, or more, can also
include a decimal point and fractional seconds (but no more than allowed
by the format’s decimal places).
</para></listitem></varlistentry></variablelist>
<para>For the time and date formats, the default output format is the same as
the input format, except that PSPP increases the field width, if
necessary, to the minimum allowed for output.
</para>
<para>Time or dates narrower than the field width are right-justified within
the field.
</para>
<para>When a time or date exceeds the field width, characters are trimmed from
the end until it fits. This can occur in an unusual situation, <emphasis>e.g.</emphasis>
with a year greater than 9999 (which adds an extra digit), or for a
negative value on MTIME, TIME, or DTIME (which adds a leading minus sign).
</para>
<!-- What about out-of-range values? -->
<para>The system-missing value is output as a period at the right end of the
field.
</para>
</sect3>
<sect3 label="6.7.4.6" id="Date-Component-Formats">
<title>Date Component Formats</title>
<para>The WKDAY and MONTH formats provide input and output for the names of
weekdays and months, respectively.
</para>
<para>On output, these formats convert a number between 1 and 7, for WKDAY, or
between 1 and 12, for MONTH, into the English name of a day or month,
respectively. If the name is longer than the field, it is trimmed to
fit. If the name is shorter than the field, it is padded on the right
with spaces. Values outside the valid range, and the system-missing
value, are output as all spaces.
</para>
<para>On input, English weekday or month names (in uppercase or lowercase) are
converted back to their corresponding numbers. Weekday and month names
may be abbreviated to their first 2 or 3 letters, respectively.
</para>
<para>The field width may range from 2 to 40, for WKDAY, or from 3 to 40, for
MONTH. No decimal places are allowed.
</para>
<para>The default output format is the same as the input format.
</para>
</sect3>
<sect3 label="6.7.4.7" id="String-Formats">
<title>String Formats</title>
<indexterm role="cp"><primary>string formats</primary></indexterm>
<para>The A and AHEX formats are the only ones that may be assigned to string
variables. Neither format allows any decimal places.
</para>
<para>In A format, the entire field is treated as a string value. The field
width may range from 1 to 32,767, the maximum string width. The default
output format is the same as the input format.
</para>
<para>In AHEX format, the field is composed of characters in a string encoded
as hex digit pairs. On output, hex digits are output in uppercase; on
input, uppercase and lowercase are both accepted. The default output
format is A format with half the input width.
</para>
</sect3>
</sect2>
<sect2 label="6.7.5" id="Scratch-Variables">
<title>Scratch Variables</title>
<indexterm role="cp"><primary>scratch variables</primary></indexterm>
<para>Most of the time, variables don’t retain their values between cases.
Instead, either they’re being read from a data file or the active dataset,
in which case they assume the value read, or, if created with
<literal>COMPUTE</literal> or
another transformation, they’re initialized to the system-missing value
or to blanks, depending on type.
</para>
<para>However, sometimes it’s useful to have a variable that keeps its value
between cases. You can do this with <literal>LEAVE</literal> (see <link linkend="LEAVE">LEAVE</link>), or you can
use a <firstterm>scratch variable</firstterm>. Scratch variables are variables whose
names begin with an octothorpe (‘<literal>#</literal>’).
</para>
<para>Scratch variables have the same properties as variables left with
<literal>LEAVE</literal>: they retain their values between cases, and for the first
case they are initialized to 0 or blanks. They have the additional
property that they are deleted before the execution of any procedure.
For this reason, scratch variables can’t be used for analysis. To use
a scratch variable in an analysis, use <literal>COMPUTE</literal> (see <link linkend="COMPUTE">COMPUTE</link>)
to copy its value into an ordinary variable, then use that ordinary
variable in the analysis.
</para>
</sect2>
</sect1>
<sect1 label="6.8" id="Files">
<title>Files Used by PSPP</title>
<para>PSPP makes use of many files each time it runs. Some of these it
reads, some it writes, some it creates. Here is a table listing the
most important of these files:
</para>
<variablelist><varlistentry><term><indexterm role="cp"><primary>file, command</primary></indexterm>
<indexterm role="cp"><primary>file, syntax file</primary></indexterm>
<indexterm role="cp"><primary>command file</primary></indexterm>
<indexterm role="cp"><primary>syntax file</primary></indexterm>
<emphasis role="bold">command file</emphasis>
</term><term><emphasis role="bold">syntax file</emphasis>
</term><listitem><para>These names (synonyms) refer to the file that contains instructions
that tell PSPP what to do. The syntax file’s name is specified on
the PSPP command line. Syntax files can also be read with
<literal>INCLUDE</literal> (see <link linkend="INCLUDE">INCLUDE</link>).
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary>file, data</primary></indexterm>
<indexterm role="cp"><primary>data file</primary></indexterm>
<emphasis role="bold">data file</emphasis>
</term><listitem><para>Data files contain raw data in text or binary format. Data can also
be embedded in a syntax file with <literal>BEGIN DATA</literal> and <literal>END DATA</literal>.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary>file, output</primary></indexterm>
<indexterm role="cp"><primary>output file</primary></indexterm>
<emphasis role="bold">listing file</emphasis>
</term><listitem><para>One or more output files are created by PSPP each time it is
run. The output files receive the tables and charts produced by
statistical procedures. The output files may be in any number of formats,
depending on how PSPP is configured.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary>system file</primary></indexterm>
<indexterm role="cp"><primary>file, system</primary></indexterm>
<emphasis role="bold">system file</emphasis>
</term><listitem><para>System files are binary files that store a dictionary and a set of
cases. <literal>GET</literal> and <literal>SAVE</literal> read and write system files.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary>portable file</primary></indexterm>
<indexterm role="cp"><primary>file, portable</primary></indexterm>
<emphasis role="bold">portable file</emphasis>
</term><listitem><para>Portable files are files in a text-based format that store a dictionary
and a set of cases. <literal>IMPORT</literal> and <literal>EXPORT</literal> read and write
portable files.
</para></listitem></varlistentry></variablelist>
</sect1>
<sect1 label="6.9" id="File-Handles">
<title>File Handles</title>
<indexterm role="cp"><primary>file handles</primary></indexterm>
<para>A <firstterm>file handle</firstterm> is a reference to a data file, system file, or
portable file. Most often, a file handle is specified as the
name of a file as a string, that is, enclosed within ‘<literal>'</literal>’ or
‘<literal>"</literal>’.
</para>
<para>A file name string that begins or ends with ‘<literal>|</literal>’ is treated as the
name of a command to pipe data to or from. You can use this feature
to read data over the network using a program such as ‘<literal>curl</literal>’
(<emphasis>e.g.</emphasis> <literal>GET '|curl -s -S http://example.com/mydata.sav'</literal>), to
read compressed data from a file using a program such as ‘<literal>zcat</literal>’
(<emphasis>e.g.</emphasis> <literal>GET '|zcat mydata.sav.gz'</literal>), and for many other
purposes.
</para>
<para>PSPP also supports declaring named file handles with the <literal>FILE
HANDLE</literal> command. This command associates an identifier of your choice
(the file handle’s name) with a file. Later, the file handle name can
be substituted for the name of the file. When PSPP syntax accesses a
file multiple times, declaring a named file handle simplifies updating
the syntax later to use a different file. Use of <literal>FILE HANDLE</literal> is
also required to read data files in binary formats. See <link linkend="FILE-HANDLE">FILE HANDLE</link>,
for more information.
</para>
<para>In some circumstances, PSPP must distinguish whether a file handle
refers to a system file or a portable file. When this is necessary to
read a file, <emphasis>e.g.</emphasis> as an input file for <literal>GET</literal> or <literal>MATCH FILES</literal>,
PSPP uses the file’s contents to decide. In the context of writing a
file, <emphasis>e.g.</emphasis> as an output file for <literal>SAVE</literal> or <literal>AGGREGATE</literal>, PSPP
decides based on the file’s name: if it ends in ‘<literal>.por</literal>’ (with any
capitalization), then PSPP writes a portable file; otherwise, PSPP
writes a system file.
</para>
<para>INLINE is reserved as a file handle name. It refers to the “data
file” embedded into the syntax file between <literal>BEGIN DATA</literal> and
<literal>END DATA</literal>. See <link linkend="BEGIN-DATA">BEGIN DATA</link>, for more information.
</para>
<para>The file to which a file handle refers may be reassigned on a later
<literal>FILE HANDLE</literal> command if it is first closed using <literal>CLOSE FILE
HANDLE</literal>. See <link linkend="CLOSE-FILE-HANDLE">CLOSE FILE HANDLE</link>, for
more information.
</para>
</sect1>
<sect1 label="6.10" id="BNF">
<title>Backus-Naur Form</title>
<indexterm role="cp"><primary>BNF</primary></indexterm>
<indexterm role="cp"><primary>Backus-Naur Form</primary></indexterm>
<indexterm role="cp"><primary>command syntax, description of</primary></indexterm>
<indexterm role="cp"><primary>description of command syntax</primary></indexterm>
<para>The syntax of some parts of the PSPP language is presented in this
manual using the formalism known as <firstterm>Backus-Naur Form</firstterm>, or BNF. The
following table describes BNF:
</para>
<itemizedlist><listitem><indexterm role="cp"><primary>keywords</primary></indexterm>
<indexterm role="cp"><primary>terminals</primary></indexterm>
<para>Words in all-uppercase are PSPP keyword tokens. In BNF, these are
often called <firstterm>terminals</firstterm>. There are some special terminals, which
are written in lowercase for clarity:
</para>
<variablelist><varlistentry><term><indexterm role="cp"><primary><literal>number</literal></primary></indexterm>
<literal>number</literal>
</term><listitem><para>A real number.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary><literal>integer</literal></primary></indexterm>
<literal>integer</literal>
</term><listitem><para>An integer number.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary><literal>string</literal></primary></indexterm>
<literal>string</literal>
</term><listitem><para>A string.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary><literal>var-name</literal></primary></indexterm>
<literal>var-name</literal>
</term><listitem><para>A single variable name.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary>operators</primary></indexterm>
<indexterm role="cp"><primary>punctuators</primary></indexterm>
<literal>=</literal>, <literal>/</literal>, <literal>+</literal>, <literal>-</literal>, etc.
</term><listitem><para>Operators and punctuators.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary><literal>.</literal></primary></indexterm>
<literal>.</literal>
</term><listitem><para>The end of the command. This is not necessarily an actual dot in the
syntax file (see <link linkend="Commands">Commands</link>).
</para></listitem></varlistentry></variablelist>
</listitem><listitem><indexterm role="cp"><primary>productions</primary></indexterm>
<indexterm role="cp"><primary>nonterminals</primary></indexterm>
<para>Other words in all lowercase refer to BNF definitions, called
<firstterm>productions</firstterm>. These productions are also known as
<firstterm>nonterminals</firstterm>. Some nonterminals are very common, so they are
defined here in English for clarity:
</para>
<variablelist><varlistentry><term><indexterm role="cp"><primary><literal>var-list</literal></primary></indexterm>
<literal>var-list</literal>
</term><listitem><para>A list of one or more variable names or the keyword <literal>ALL</literal>.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary><literal>expression</literal></primary></indexterm>
<literal>expression</literal>
</term><listitem><para>An expression. See <link linkend="Expressions">Expressions</link>, for details.
</para></listitem></varlistentry></variablelist>
</listitem><listitem><indexterm role="cp"><primary>“is defined as”</primary></indexterm>
<indexterm role="cp"><primary>productions</primary></indexterm>
<para>‘<literal>::=</literal>’ means “is defined as”. The left side of ‘<literal>::=</literal>’ gives
the name of the nonterminal being defined. The right side of ‘<literal>::=</literal>’
gives the definition of that nonterminal. If the right side is empty,
then one possible expansion of that nonterminal is nothing. A BNF
definition is called a <firstterm>production</firstterm>.
</para>
</listitem><listitem><indexterm role="cp"><primary>terminals and nonterminals, differences</primary></indexterm>
<para>So, the key difference between a terminal and a nonterminal is that a
terminal cannot be broken into smaller parts—in fact, every terminal
is a single token (see <link linkend="Tokens">Tokens</link>). On the other hand, nonterminals are
composed of a (possibly empty) sequence of terminals and nonterminals.
Thus, terminals indicate the deepest level of syntax description. (In
parsing theory, terminals are the leaves of the parse tree; nonterminals
form the branches.)
</para>
</listitem><listitem><indexterm role="cp"><primary>start symbol</primary></indexterm>
<indexterm role="cp"><primary>symbol, start</primary></indexterm>
<para>The first nonterminal defined in a set of productions is called the
<firstterm>start symbol</firstterm>. The start symbol defines the entire syntax for
that command.
</para></listitem></itemizedlist><!-- PSPP - a program for statistical analysis. -->
<!-- Copyright (C) 2017, 2020 Free Software Foundation, Inc. -->
<!-- Permission is granted to copy, distribute and/or modify this document -->
<!-- under the terms of the GNU Free Documentation License, Version 1.3 -->
<!-- or any later version published by the Free Software Foundation; -->
<!-- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -->
<!-- A copy of the license is included in the section entitled "GNU -->
<!-- Free Documentation License". -->
<!-- -->
<!-- Use @func when referring to a function. -->
<!-- Use @deftypefn for their definitions -->
</sect1>
</chapter>
<chapter label="7" id="Expressions">
<title>Mathematical Expressions</title>
<indexterm role="cp"><primary>expressions, mathematical</primary></indexterm>
<indexterm role="cp"><primary>mathematical expressions</primary></indexterm>
<para>Expressions share a common syntax each place they appear in PSPP
commands. Expressions are made up of <firstterm>operands</firstterm>, which can be
numbers, strings, or variable names, separated by <firstterm>operators</firstterm>.
There are five types of operators: grouping, arithmetic, logical,
relational, and functions.
</para>
<para>Every operator takes one or more operands as input and yields exactly
one result as output. Depending on the operator, operands accept
strings or numbers as operands. With few exceptions, operands may be
full-fledged expressions in themselves.
</para>
<sect1 label="7.1" id="Boolean-Values">
<title>Boolean Values</title>
<indexterm role="cp"><primary>Boolean</primary></indexterm>
<indexterm role="cp"><primary>values, Boolean</primary></indexterm>
<para>Some PSPP operators and expressions work with Boolean values, which
represent true/false conditions. Booleans have only three possible
values: 0 (false), 1 (true), and system-missing (unknown).
System-missing is neither true nor false and indicates that the true
value is unknown.
</para>
<para>Boolean-typed operands or function arguments must take on one of these
three values. Other values are considered false, but provoke a warning
when the expression is evaluated.
</para>
<para>Strings and Booleans are not compatible, and neither may be used in
place of the other.
</para>
</sect1>
<sect1 label="7.2" id="Missing-Values-in-Expressions">
<title>Missing Values in Expressions</title>
<para>Most numeric operators yield system-missing when given any
system-missing operand. A string operator given any system-missing
operand typically results in the empty string. Exceptions are listed
under particular operator descriptions.
</para>
<para>String user-missing values are not treated specially in expressions.
</para>
<para>User-missing values for numeric variables are always transformed into
the system-missing value, except inside the arguments to the
<literal>VALUE</literal> and <literal>SYSMIS</literal> functions.
</para>
<para>The missing-value functions can be used to precisely control how missing
values are treated in expressions. See <link linkend="Missing-Value-Functions">Missing Value Functions</link>, for
more details.
</para>
</sect1>
<sect1 label="7.3" id="Grouping-Operators">
<title>Grouping Operators</title>
<indexterm role="cp"><primary>parentheses</primary></indexterm>
<indexterm role="cp"><primary>‘<literal>( )</literal>’</primary></indexterm>
<indexterm role="cp"><primary>grouping operators</primary></indexterm>
<indexterm role="cp"><primary>operators, grouping</primary></indexterm>
<para>Parentheses (‘<literal>()</literal>’) are the grouping operators. Surround an
expression with parentheses to force early evaluation.
</para>
<para>Parentheses also surround the arguments to functions, but in that
situation they act as punctuators, not as operators.
</para>
</sect1>
<sect1 label="7.4" id="Arithmetic-Operators">
<title>Arithmetic Operators</title>
<indexterm role="cp"><primary>operators, arithmetic</primary></indexterm>
<indexterm role="cp"><primary>arithmetic operators</primary></indexterm>
<para>The arithmetic operators take numeric operands and produce numeric
results.
</para>
<variablelist><varlistentry><term><indexterm role="cp"><primary>‘<literal>+</literal>’</primary></indexterm>
<indexterm role="cp"><primary>addition</primary></indexterm>
<literal><replaceable>a</replaceable> + <replaceable>b</replaceable></literal>
</term><listitem><para>Yields the sum of <replaceable>a</replaceable> and <replaceable>b</replaceable>.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary>‘<literal>-</literal>’</primary></indexterm>
<indexterm role="cp"><primary>subtraction</primary></indexterm>
<literal><replaceable>a</replaceable> - <replaceable>b</replaceable></literal>
</term><listitem><para>Subtracts <replaceable>b</replaceable> from <replaceable>a</replaceable> and yields the difference.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary>‘<literal>*</literal>’</primary></indexterm>
<indexterm role="cp"><primary>multiplication</primary></indexterm>
<literal><replaceable>a</replaceable> * <replaceable>b</replaceable></literal>
</term><listitem><para>Yields the product of <replaceable>a</replaceable> and <replaceable>b</replaceable>. If either <replaceable>a</replaceable> or
<replaceable>b</replaceable> is 0, then the result is 0, even if the other operand is
missing.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary>‘<literal>/</literal>’</primary></indexterm>
<indexterm role="cp"><primary>division</primary></indexterm>
<literal><replaceable>a</replaceable> / <replaceable>b</replaceable></literal>
</term><listitem><para>Divides <replaceable>a</replaceable> by <replaceable>b</replaceable> and yields the quotient. If <replaceable>a</replaceable> is 0,
then the result is 0, even if <replaceable>b</replaceable> is missing. If <replaceable>b</replaceable> is zero,
the result is system-missing.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary>‘<literal>**</literal>’</primary></indexterm>
<indexterm role="cp"><primary>exponentiation</primary></indexterm>
<literal><replaceable>a</replaceable> ** <replaceable>b</replaceable></literal>
</term><listitem><para>Yields the result of raising <replaceable>a</replaceable> to the power <replaceable>b</replaceable>. If
<replaceable>a</replaceable> is negative and <replaceable>b</replaceable> is not an integer, the result is
system-missing. The result of <literal>0**0</literal> is system-missing as well.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary>‘<literal>-</literal>’</primary></indexterm>
<indexterm role="cp"><primary>negation</primary></indexterm>
<literal>- <replaceable>a</replaceable></literal>
</term><listitem><para>Reverses the sign of <replaceable>a</replaceable>.
</para></listitem></varlistentry></variablelist>
</sect1>
<sect1 label="7.5" id="Logical-Operators">
<title>Logical Operators</title>
<indexterm role="cp"><primary>logical operators</primary></indexterm>
<indexterm role="cp"><primary>operators, logical</primary></indexterm>
<indexterm role="cp"><primary>true</primary></indexterm>
<indexterm role="cp"><primary>false</primary></indexterm>
<indexterm role="cp"><primary>Boolean</primary></indexterm>
<indexterm role="cp"><primary>values, system-missing</primary></indexterm>
<indexterm role="cp"><primary>system-missing</primary></indexterm>
<para>The logical operators take logical operands and produce logical
results, meaning “true or false.” Logical operators are
not true Boolean operators because they may also result in a
system-missing value. See <link linkend="Boolean-Values">Boolean Values</link>, for more information.
</para>
<variablelist><varlistentry><term><indexterm role="cp"><primary><literal>AND</literal></primary></indexterm>
<indexterm role="cp"><primary>‘<literal>&</literal>’</primary></indexterm>
<indexterm role="cp"><primary>intersection, logical</primary></indexterm>
<indexterm role="cp"><primary>logical intersection</primary></indexterm>
<literal><replaceable>a</replaceable> AND <replaceable>b</replaceable></literal>
</term><term><literal><replaceable>a</replaceable> & <replaceable>b</replaceable></literal>
</term><listitem><para>True if both <replaceable>a</replaceable> and <replaceable>b</replaceable> are true, false otherwise. If one
operand is false, the result is false even if the other is missing. If
both operands are missing, the result is missing.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary><literal>OR</literal></primary></indexterm>
<indexterm role="cp"><primary>‘<literal>|</literal>’</primary></indexterm>
<indexterm role="cp"><primary>union, logical</primary></indexterm>
<indexterm role="cp"><primary>logical union</primary></indexterm>
<literal><replaceable>a</replaceable> OR <replaceable>b</replaceable></literal>
</term><term><literal><replaceable>a</replaceable> | <replaceable>b</replaceable></literal>
</term><listitem><para>True if at least one of <replaceable>a</replaceable> and <replaceable>b</replaceable> is true. If one operand is
true, the result is true even if the other operand is missing. If both
operands are missing, the result is missing.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary><literal>NOT</literal></primary></indexterm>
<indexterm role="cp"><primary>‘<literal>~</literal>’</primary></indexterm>
<indexterm role="cp"><primary>inversion, logical</primary></indexterm>
<indexterm role="cp"><primary>logical inversion</primary></indexterm>
<literal>NOT <replaceable>a</replaceable></literal>
</term><term><literal>~ <replaceable>a</replaceable></literal>
</term><listitem><para>True if <replaceable>a</replaceable> is false. If the operand is missing, then the result
is missing.
</para></listitem></varlistentry></variablelist>
</sect1>
<sect1 label="7.6" id="Relational-Operators">
<title>Relational Operators</title>
<para>The relational operators take numeric or string operands and produce Boolean
results.
</para>
<para>Strings cannot be compared to numbers. When strings of different
lengths are compared, the shorter string is right-padded with spaces
to match the length of the longer string.
</para>
<para>The results of string comparisons, other than tests for equality or
inequality, depend on the character set in use. String comparisons
are case-sensitive.
</para>
<variablelist><varlistentry><term><indexterm role="cp"><primary>equality, testing</primary></indexterm>
<indexterm role="cp"><primary>testing for equality</primary></indexterm>
<indexterm role="cp"><primary><literal>EQ</literal></primary></indexterm>
<indexterm role="cp"><primary>‘<literal>=</literal>’</primary></indexterm>
<literal><replaceable>a</replaceable> EQ <replaceable>b</replaceable></literal>
</term><term><literal><replaceable>a</replaceable> = <replaceable>b</replaceable></literal>
</term><listitem><para>True if <replaceable>a</replaceable> is equal to <replaceable>b</replaceable>.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary>less than or equal to</primary></indexterm>
<indexterm role="cp"><primary><literal>LE</literal></primary></indexterm>
<indexterm role="cp"><primary><literal><=</literal></primary></indexterm>
<literal><replaceable>a</replaceable> LE <replaceable>b</replaceable></literal>
</term><term><literal><replaceable>a</replaceable> <= <replaceable>b</replaceable></literal>
</term><listitem><para>True if <replaceable>a</replaceable> is less than or equal to <replaceable>b</replaceable>.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary>less than</primary></indexterm>
<indexterm role="cp"><primary><literal>LT</literal></primary></indexterm>
<indexterm role="cp"><primary><literal><</literal></primary></indexterm>
<literal><replaceable>a</replaceable> LT <replaceable>b</replaceable></literal>
</term><term><literal><replaceable>a</replaceable> < <replaceable>b</replaceable></literal>
</term><listitem><para>True if <replaceable>a</replaceable> is less than <replaceable>b</replaceable>.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary>greater than or equal to</primary></indexterm>
<indexterm role="cp"><primary><literal>GE</literal></primary></indexterm>
<indexterm role="cp"><primary><literal>>=</literal></primary></indexterm>
<literal><replaceable>a</replaceable> GE <replaceable>b</replaceable></literal>
</term><term><literal><replaceable>a</replaceable> >= <replaceable>b</replaceable></literal>
</term><listitem><para>True if <replaceable>a</replaceable> is greater than or equal to <replaceable>b</replaceable>.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary>greater than</primary></indexterm>
<indexterm role="cp"><primary><literal>GT</literal></primary></indexterm>
<indexterm role="cp"><primary>‘<literal>></literal>’</primary></indexterm>
<literal><replaceable>a</replaceable> GT <replaceable>b</replaceable></literal>
</term><term><literal><replaceable>a</replaceable> > <replaceable>b</replaceable></literal>
</term><listitem><para>True if <replaceable>a</replaceable> is greater than <replaceable>b</replaceable>.
</para>
</listitem></varlistentry><varlistentry><term><indexterm role="cp"><primary>inequality, testing</primary></indexterm>
<indexterm role="cp"><primary>testing for inequality</primary></indexterm>
<indexterm role="cp"><primary><literal>NE</literal></primary></indexterm>
<indexterm role="cp"><primary><literal>~=</literal></primary></indexterm>
<indexterm role="cp"><primary><literal><></literal></primary></indexterm>
<literal><replaceable>a</replaceable> NE <replaceable>b</replaceable></literal>
</term><term><literal><replaceable>a</replaceable> ~= <replaceable>b</replaceable></literal>
</term><term><literal><replaceable>a</replaceable> <> <replaceable>b</replaceable></literal>
</term><listitem><para>True if <replaceable>a</replaceable> is not equal to <replaceable>b</replaceable>.
</para></listitem></varlistentry></variablelist>
</sect1>
<sect1 label="7.7" id="Functions">
<title>Functions</title>
<indexterm role="cp"><primary>functions</primary></indexterm>
<indexterm role="cp"><primary>mathematics</primary></indexterm>
<indexterm role="cp"><primary>operators</primary></indexterm>
<indexterm role="cp"><primary>parentheses</primary></indexterm>
<indexterm role="cp"><primary><literal>(</literal></primary></indexterm>
<indexterm role="cp"><primary><literal>)</literal></primary></indexterm>
<indexterm role="cp"><primary>names, of functions</primary></indexterm>
<para>PSPP functions provide mathematical abilities above and beyond
those possible using simple operators. Functions have a common
syntax: each is composed of a function name followed by a left
parenthesis, one or more arguments, and a right parenthesis.
</para>
<para>Function names are not reserved. Their names are specially treated
only when followed by a left parenthesis, so that ‘<literal>EXP(10)</literal>’
refers to the constant value <inlineequation><mathphrase>e</mathphrase></inlineequation> raised to the 10th power, but
‘<literal>EXP</literal>’ by itself refers to the value of a variable called <literal>EXP</literal>.
</para>
<para>The sections below describe each function in detail.
</para>
<sect2 label="7.7.1" id="Mathematics">
<title>Mathematical Functions</title>
<indexterm role="cp"><primary>mathematics, advanced</primary></indexterm>
<para>Advanced mathematical functions take numeric arguments and produce
numeric results.
</para>
<synopsis><indexterm role="fn"><primary>EXP</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>EXP</function> (<emphasis role="arg"><replaceable>exponent</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns <inlineequation><mathphrase>e</mathphrase></inlineequation> (approximately 2.71828) raised to power <replaceable>exponent</replaceable>.
</para></blockquote>
<indexterm role="cp"><primary>logarithms</primary></indexterm>
<synopsis><indexterm role="fn"><primary>LG10</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>LG10</function> (<emphasis role="arg"><replaceable>number</replaceable></emphasis>)</synopsis>
<blockquote><para>Takes the base-10 logarithm of <replaceable>number</replaceable>. If <replaceable>number</replaceable> is
not positive, the result is system-missing.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>LN</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>LN</function> (<emphasis role="arg"><replaceable>number</replaceable></emphasis>)</synopsis>
<blockquote><para>Takes the base-<inlineequation><mathphrase>e</mathphrase></inlineequation> logarithm of <replaceable>number</replaceable>. If <replaceable>number</replaceable> is
not positive, the result is system-missing.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>LNGAMMA</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>LNGAMMA</function> (<emphasis role="arg"><replaceable>number</replaceable></emphasis>)</synopsis>
<blockquote><para>Yields the base-<inlineequation><mathphrase>e</mathphrase></inlineequation> logarithm of the complete gamma of <replaceable>number</replaceable>.
If <replaceable>number</replaceable> is a negative integer, the result is system-missing.
</para></blockquote>
<indexterm role="cp"><primary>square roots</primary></indexterm>
<synopsis><indexterm role="fn"><primary>SQRT</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>SQRT</function> (<emphasis role="arg"><replaceable>number</replaceable></emphasis>)</synopsis>
<blockquote><para>Takes the square root of <replaceable>number</replaceable>. If <replaceable>number</replaceable> is negative,
the result is system-missing.
</para></blockquote>
</sect2>
<sect2 label="7.7.2" id="Miscellaneous-Mathematics">
<title>Miscellaneous Mathematical Functions</title>
<indexterm role="cp"><primary>mathematics, miscellaneous</primary></indexterm>
<para>Miscellaneous mathematical functions take numeric arguments and produce
numeric results.
</para>
<indexterm role="cp"><primary>absolute value</primary></indexterm>
<synopsis><indexterm role="fn"><primary>ABS</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>ABS</function> (<emphasis role="arg"><replaceable>number</replaceable></emphasis>)</synopsis>
<blockquote><para>Results in the absolute value of <replaceable>number</replaceable>.
</para></blockquote>
<indexterm role="cp"><primary>modulus</primary></indexterm>
<synopsis><indexterm role="fn"><primary>MOD</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>MOD</function> (<emphasis role="arg"><replaceable>numerator</replaceable></emphasis>, <emphasis role="arg"><replaceable>denominator</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns the remainder (modulus) of <replaceable>numerator</replaceable> divided by
<replaceable>denominator</replaceable>. If <replaceable>numerator</replaceable> is 0, then the result is 0,
even if <replaceable>denominator</replaceable> is missing. If <replaceable>denominator</replaceable> is 0, the
result is system-missing.
</para></blockquote>
<indexterm role="cp"><primary>modulus, by 10</primary></indexterm>
<synopsis><indexterm role="fn"><primary>MOD10</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>MOD10</function> (<emphasis role="arg"><replaceable>number</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns the remainder when <replaceable>number</replaceable> is divided by 10. If
<replaceable>number</replaceable> is negative, MOD10(<replaceable>number</replaceable>) is negative or zero.
</para></blockquote>
<indexterm role="cp"><primary>rounding</primary></indexterm>
<synopsis><indexterm role="fn"><primary>RND</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RND</function> (<emphasis role="arg"><replaceable>number</replaceable></emphasis> [, <emphasis role="arg"><replaceable>mult</replaceable></emphasis>[, <emphasis role="arg"><replaceable>fuzzbits</replaceable></emphasis>]])</synopsis>
<blockquote><para>Rounds <replaceable>number</replaceable> and rounds it to a multiple of <replaceable>mult</replaceable> (by
default 1). Halves are rounded away from zero, as are values that
fall short of halves by less than <replaceable>fuzzbits</replaceable> of errors in the
least-significant bits of <replaceable>number</replaceable>. If <replaceable>fuzzbits</replaceable> is not
specified then the default is taken from SET FUZZBITS (see <link linkend="SET-FUZZBITS">SET
FUZZBITS</link>), which is 6 unless overridden.
</para></blockquote>
<indexterm role="cp"><primary>truncation</primary></indexterm>
<synopsis><indexterm role="fn"><primary>TRUNC</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>TRUNC</function> (<emphasis role="arg"><replaceable>number</replaceable></emphasis> [, <emphasis role="arg"><replaceable>mult</replaceable></emphasis>[, <emphasis role="arg"><replaceable>fuzzbits</replaceable></emphasis>]])</synopsis>
<blockquote><para>Rounds <replaceable>number</replaceable> to a multiple of <replaceable>mult</replaceable>, toward zero. For the
default <replaceable>mult</replaceable> of 1, this is equivalent to discarding the
fractional part of <replaceable>number</replaceable>. Values that fall short of a multiple
of <replaceable>mult</replaceable> by less than <replaceable>fuzzbits</replaceable> of errors in the
least-significant bits of <replaceable>number</replaceable> are rounded away from zero. If
<replaceable>fuzzbits</replaceable> is not specified then the default is taken from SET
FUZZBITS (see <link linkend="SET-FUZZBITS">SET FUZZBITS</link>), which is 6 unless overridden.
</para></blockquote>
</sect2>
<sect2 label="7.7.3" id="Trigonometry">
<title>Trigonometric Functions</title>
<indexterm role="cp"><primary>trigonometry</primary></indexterm>
<para>Trigonometric functions take numeric arguments and produce numeric
results.
</para>
<indexterm role="cp"><primary>arccosine</primary></indexterm>
<indexterm role="cp"><primary>inverse cosine</primary></indexterm>
<synopsis><indexterm role="fn"><primary>ARCOS</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>ARCOS</function> (<emphasis role="arg"><replaceable>number</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>ACOS</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>ACOS</function> (<emphasis role="arg"><replaceable>number</replaceable></emphasis>)</synopsis>
<blockquote><para>Takes the arccosine, in radians, of <replaceable>number</replaceable>. Results in
system-missing if <replaceable>number</replaceable> is not between -1 and 1 inclusive.
This function is a PSPP extension.
</para></blockquote>
<indexterm role="cp"><primary>arcsine</primary></indexterm>
<indexterm role="cp"><primary>inverse sine</primary></indexterm>
<synopsis><indexterm role="fn"><primary>ARSIN</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>ARSIN</function> (<emphasis role="arg"><replaceable>number</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>ASIN</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>ASIN</function> (<emphasis role="arg"><replaceable>number</replaceable></emphasis>)</synopsis>
<blockquote><para>Takes the arcsine, in radians, of <replaceable>number</replaceable>. Results in
system-missing if <replaceable>number</replaceable> is not between -1 and 1 inclusive.
</para></blockquote>
<indexterm role="cp"><primary>arctangent</primary></indexterm>
<indexterm role="cp"><primary>inverse tangent</primary></indexterm>
<synopsis><indexterm role="fn"><primary>ARTAN</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>ARTAN</function> (<emphasis role="arg"><replaceable>number</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>ATAN</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>ATAN</function> (<emphasis role="arg"><replaceable>number</replaceable></emphasis>)</synopsis>
<blockquote><para>Takes the arctangent, in radians, of <replaceable>number</replaceable>.
</para></blockquote>
<indexterm role="cp"><primary>cosine</primary></indexterm>
<synopsis><indexterm role="fn"><primary>COS</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>COS</function> (<emphasis role="arg"><replaceable>angle</replaceable></emphasis>)</synopsis>
<blockquote><para>Takes the cosine of <replaceable>angle</replaceable> which should be in radians.
</para></blockquote>
<indexterm role="cp"><primary>sine</primary></indexterm>
<synopsis><indexterm role="fn"><primary>SIN</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>SIN</function> (<emphasis role="arg"><replaceable>angle</replaceable></emphasis>)</synopsis>
<blockquote><para>Takes the sine of <replaceable>angle</replaceable> which should be in radians.
</para></blockquote>
<indexterm role="cp"><primary>tangent</primary></indexterm>
<synopsis><indexterm role="fn"><primary>TAN</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>TAN</function> (<emphasis role="arg"><replaceable>angle</replaceable></emphasis>)</synopsis>
<blockquote><para>Takes the tangent of <replaceable>angle</replaceable> which should be in radians.
Results in system-missing at values
of <replaceable>angle</replaceable> that are too close to odd multiples of <inlineequation><mathphrase>\pi/2</mathphrase></inlineequation>.
Portability: none.
</para></blockquote>
</sect2>
<sect2 label="7.7.4" id="Missing-Value-Functions">
<title>Missing-Value Functions</title>
<indexterm role="cp"><primary>missing values</primary></indexterm>
<indexterm role="cp"><primary>values, missing</primary></indexterm>
<indexterm role="cp"><primary>functions, missing-value</primary></indexterm>
<para>Missing-value functions take various numeric arguments and yield
various types of results. Except where otherwise stated below, the
normal rules of evaluation apply within expression arguments to these
functions. In particular, user-missing values for numeric variables
are converted to system-missing values.
</para>
<synopsis><indexterm role="fn"><primary>MISSING</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>MISSING</function> (<emphasis role="arg"><replaceable>expr</replaceable></emphasis>)</synopsis>
<blockquote><para>When <replaceable>expr</replaceable> is simply the name of a numeric variable, returns 1 if
the variable has the system-missing value or if it is user-missing.
For any other value 0 is returned.
If <replaceable>expr</replaceable> takes another form, the function returns 1 if the value is
system-missing, 0 otherwise.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>NMISS</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>NMISS</function> (<emphasis role="arg"><replaceable>expr</replaceable></emphasis> [, <emphasis role="arg"><replaceable>expr</replaceable></emphasis>]<emphasis role="arg">…</emphasis>)</synopsis>
<blockquote><para>Each argument must be a numeric expression. Returns the number of
system-missing values in the list, which may include variable ranges
using the <literal><replaceable>var1</replaceable> TO <replaceable>var2</replaceable></literal> syntax.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>NVALID</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>NVALID</function> (<emphasis role="arg"><replaceable>expr</replaceable></emphasis> [, <emphasis role="arg"><replaceable>expr</replaceable></emphasis>]<emphasis role="arg">…</emphasis>)</synopsis>
<blockquote><para>Each argument must be a numeric expression. Returns the number of
values in the list that are not system-missing. The list may include
variable ranges using the <literal><replaceable>var1</replaceable> TO <replaceable>var2</replaceable></literal> syntax.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>SYSMIS</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>SYSMIS</function> (<emphasis role="arg"><replaceable>expr</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns 1 if <replaceable>expr</replaceable> has the system-missing value, 0 otherwise.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>VALUE</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>VALUE</function> (<emphasis role="arg"><replaceable>variable</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>VALUE</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>VALUE</function> (<emphasis role="arg"><replaceable>vector</replaceable></emphasis>(<emphasis role="arg"><replaceable>index</replaceable></emphasis>))</synopsis>
<blockquote><para>Prevents the user-missing values of the variable or vector element
from being transformed into system-missing values, and always results
in its actual value, whether it is valid, user-missing, or
system-missing.
</para></blockquote>
</sect2>
<sect2 label="7.7.5" id="Set-Membership">
<title>Set-Membership Functions</title>
<indexterm role="cp"><primary>set membership</primary></indexterm>
<indexterm role="cp"><primary>membership, of set</primary></indexterm>
<para>Set membership functions determine whether a value is a member of a set.
They take a set of numeric arguments or a set of string arguments, and
produce Boolean results.
</para>
<para>String comparisons are performed according to the rules given in
<link linkend="Relational-Operators">Relational Operators</link>. User-missing string values are treated as
valid values.
</para>
<synopsis><indexterm role="fn"><primary>ANY</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>ANY</function> (<emphasis role="arg"><replaceable>value</replaceable></emphasis>, <emphasis role="arg"><replaceable>set</replaceable></emphasis> [, <emphasis role="arg"><replaceable>set</replaceable></emphasis>]<emphasis role="arg">…</emphasis>)</synopsis>
<blockquote><para>Returns true if <replaceable>value</replaceable> is equal to any of the <replaceable>set</replaceable> values,
and false otherwise. For numeric arguments, returns system-missing if
<replaceable>value</replaceable> is system-missing or if all the values in <replaceable>set</replaceable> are
system-missing. If <replaceable>value</replaceable>
</para></blockquote>
<synopsis><indexterm role="fn"><primary>RANGE</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RANGE</function> (<emphasis role="arg"><replaceable>value</replaceable></emphasis>, <emphasis role="arg"><replaceable>low</replaceable></emphasis>, <emphasis role="arg"><replaceable>high</replaceable></emphasis> [, <emphasis role="arg"><replaceable>low</replaceable></emphasis>, <emphasis role="arg"><replaceable>high</replaceable></emphasis>]<emphasis role="arg">…</emphasis>)</synopsis>
<blockquote><para>Returns true if <replaceable>value</replaceable> is in any of the intervals bounded by
<replaceable>low</replaceable> and <replaceable>high</replaceable> inclusive, and false otherwise. <replaceable>low</replaceable>
and <replaceable>high</replaceable> must be given in pairs. Returns system-missing if any
<replaceable>high</replaceable> is less than its <replaceable>low</replaceable> or, for numeric arguments, if
<replaceable>value</replaceable> is system-missing or if all the <replaceable>low</replaceable>-<replaceable>high</replaceable> pairs
contain one (or two) system-missing values. A pair does not match
<replaceable>value</replaceable> if either <replaceable>low</replaceable> or <replaceable>high</replaceable> is missing, even if
<replaceable>value</replaceable> equals the non-missing endpoint.
</para></blockquote>
</sect2>
<sect2 label="7.7.6" id="Statistical-Functions">
<title>Statistical Functions</title>
<indexterm role="cp"><primary>functions, statistical</primary></indexterm>
<indexterm role="cp"><primary>statistics</primary></indexterm>
<para>Statistical functions compute descriptive statistics on a list of
values. Some statistics can be computed on numeric or string values;
other can only be computed on numeric values. Their results have the
same type as their arguments. The current case’s weighting factor
(see <link linkend="WEIGHT">WEIGHT</link>) has no effect on statistical functions.
</para>
<para>These functions’ argument lists may include entire ranges of variables
using the <literal><replaceable>var1</replaceable> TO <replaceable>var2</replaceable></literal> syntax.
</para>
<indexterm role="cp"><primary>arguments, minimum valid</primary></indexterm>
<indexterm role="cp"><primary>minimum valid number of arguments</primary></indexterm>
<para>Unlike most functions, statistical functions can return non-missing
values even when some of their arguments are missing. Most
statistical functions, by default, require only 1 non-missing value to
have a non-missing return, but <literal>CFVAR</literal>, <literal>SD</literal>, and <literal>VARIANCE</literal> require 2.
These defaults can be increased (but not decreased) by appending a dot
and the minimum number of valid arguments to the function name. For
example, <literal>MEAN.3(X, Y, Z)</literal> would only return non-missing if all
of ‘<literal>X</literal>’, ‘<literal>Y</literal>’, and ‘<literal>Z</literal>’ were valid.
</para>
<indexterm role="cp"><primary>coefficient of variation</primary></indexterm>
<indexterm role="cp"><primary>variation, coefficient of</primary></indexterm>
<synopsis><indexterm role="fn"><primary>CFVAR</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CFVAR</function> (<emphasis role="arg"><replaceable>number</replaceable></emphasis>, <emphasis role="arg"><replaceable>number</replaceable></emphasis>[, <emphasis role="arg">…</emphasis>])</synopsis>
<blockquote><para>Results in the coefficient of variation of the values of <replaceable>number</replaceable>.
(The coefficient of variation is the standard deviation divided by the
mean.)
</para></blockquote>
<indexterm role="cp"><primary>maximum</primary></indexterm>
<synopsis><indexterm role="fn"><primary>MAX</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>MAX</function> (<emphasis role="arg"><replaceable>value</replaceable></emphasis>, <emphasis role="arg"><replaceable>value</replaceable></emphasis>[, <emphasis role="arg">…</emphasis>])</synopsis>
<blockquote><para>Results in the value of the greatest <replaceable>value</replaceable>. The <replaceable>value</replaceable>s may
be numeric or string.
</para></blockquote>
<indexterm role="cp"><primary>mean</primary></indexterm>
<synopsis><indexterm role="fn"><primary>MEAN</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>MEAN</function> (<emphasis role="arg"><replaceable>number</replaceable></emphasis>, <emphasis role="arg"><replaceable>number</replaceable></emphasis>[, <emphasis role="arg">…</emphasis>])</synopsis>
<blockquote><para>Results in the mean of the values of <replaceable>number</replaceable>.
</para></blockquote>
<indexterm role="cp"><primary>median</primary></indexterm>
<synopsis><indexterm role="fn"><primary>MEDIAN</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>MEDIAN</function> (<emphasis role="arg"><replaceable>number</replaceable></emphasis>, <emphasis role="arg"><replaceable>number</replaceable></emphasis>[, <emphasis role="arg">…</emphasis>])</synopsis>
<blockquote><para>Results in the median of the values of <replaceable>number</replaceable>. Given an even
number of nonmissing arguments, yields the mean of the two middle
values.
</para></blockquote>
<indexterm role="cp"><primary>minimum</primary></indexterm>
<synopsis><indexterm role="fn"><primary>MIN</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>MIN</function> (<emphasis role="arg"><replaceable>number</replaceable></emphasis>, <emphasis role="arg"><replaceable>number</replaceable></emphasis>[, <emphasis role="arg">…</emphasis>])</synopsis>
<blockquote><para>Results in the value of the least <replaceable>value</replaceable>. The <replaceable>value</replaceable>s may
be numeric or string.
</para></blockquote>
<indexterm role="cp"><primary>standard deviation</primary></indexterm>
<indexterm role="cp"><primary>deviation, standard</primary></indexterm>
<synopsis><indexterm role="fn"><primary>SD</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>SD</function> (<emphasis role="arg"><replaceable>number</replaceable></emphasis>, <emphasis role="arg"><replaceable>number</replaceable></emphasis>[, <emphasis role="arg">…</emphasis>])</synopsis>
<blockquote><para>Results in the standard deviation of the values of <replaceable>number</replaceable>.
</para></blockquote>
<indexterm role="cp"><primary>sum</primary></indexterm>
<synopsis><indexterm role="fn"><primary>SUM</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>SUM</function> (<emphasis role="arg"><replaceable>number</replaceable></emphasis>, <emphasis role="arg"><replaceable>number</replaceable></emphasis>[, <emphasis role="arg">…</emphasis>])</synopsis>
<blockquote><para>Results in the sum of the values of <replaceable>number</replaceable>.
</para></blockquote>
<indexterm role="cp"><primary>variance</primary></indexterm>
<synopsis><indexterm role="fn"><primary>VARIANCE</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>VARIANCE</function> (<emphasis role="arg"><replaceable>number</replaceable></emphasis>, <emphasis role="arg"><replaceable>number</replaceable></emphasis>[, <emphasis role="arg">…</emphasis>])</synopsis>
<blockquote><para>Results in the variance of the values of <replaceable>number</replaceable>.
</para></blockquote>
</sect2>
<sect2 label="7.7.7" id="String-Functions">
<title>String Functions</title>
<indexterm role="cp"><primary>functions, string</primary></indexterm>
<indexterm role="cp"><primary>string functions</primary></indexterm>
<para>String functions take various arguments and return various results.
</para>
<indexterm role="cp"><primary>concatenation</primary></indexterm>
<indexterm role="cp"><primary>strings, concatenation of</primary></indexterm>
<synopsis><indexterm role="fn"><primary>CONCAT</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CONCAT</function> (<emphasis role="arg"><replaceable>string</replaceable></emphasis>, <emphasis role="arg"><replaceable>string</replaceable></emphasis>[, <emphasis role="arg">…</emphasis>])</synopsis>
<blockquote><para>Returns a string consisting of each <replaceable>string</replaceable> in sequence.
<literal>CONCAT("abc", "def", "ghi")</literal> has a value of <literal>"abcdefghi"</literal>.
The resultant string is truncated to a maximum of 32767 bytes.
</para></blockquote>
<indexterm role="cp"><primary>searching strings</primary></indexterm>
<synopsis><indexterm role="fn"><primary>INDEX</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>INDEX</function> (<emphasis role="arg"><replaceable>haystack</replaceable></emphasis>, <emphasis role="arg"><replaceable>needle</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RINDEX</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RINDEX</function> (<emphasis role="arg"><replaceable>haystack</replaceable></emphasis>, <emphasis role="arg"><replaceable>needle</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns a positive integer indicating the position of the first (for
<literal>INDEX</literal>) or last (for <literal>RINDEX</literal>) occurrence of <replaceable>needle</replaceable>
in <replaceable>haystack</replaceable>. Returns 0 if <replaceable>haystack</replaceable> does not contain
<replaceable>needle</replaceable>. Returns 1 if <replaceable>needle</replaceable> is the empty string.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>INDEX</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>INDEX</function> (<emphasis role="arg"><replaceable>haystack</replaceable></emphasis>, <emphasis role="arg"><replaceable>needles</replaceable></emphasis>, <emphasis role="arg"><replaceable>needle_len</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RINDEX</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RINDEX</function> (<emphasis role="arg"><replaceable>haystack</replaceable></emphasis>, <emphasis role="arg"><replaceable>needle</replaceable></emphasis>, <emphasis role="arg"><replaceable>needle_len</replaceable></emphasis>)</synopsis>
<blockquote><para>Divides <replaceable>needles</replaceable> into multiple needles, each with length
<replaceable>needle_len</replaceable>, which must be a positive integer that evenly divides
the length of <replaceable>needles</replaceable>. Searches <replaceable>haystack</replaceable> for the
occurrences of each needle and returns a positive integer indicating
the byte index of the beginning of the first (for <literal>INDEX</literal>) or
last (for <literal>RINDEX</literal>) needle it finds. Returns 0 if <replaceable>haystack</replaceable>
does not contain any of the needles, or if <replaceable>needles</replaceable> is the empty
string.
</para></blockquote>
<indexterm role="cp"><primary>strings, finding length of</primary></indexterm>
<synopsis><indexterm role="fn"><primary>LENGTH</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>LENGTH</function> (<emphasis role="arg"><replaceable>string</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns the number of bytes in <replaceable>string</replaceable>.
</para></blockquote>
<indexterm role="cp"><primary>strings, case of</primary></indexterm>
<synopsis><indexterm role="fn"><primary>LOWER</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>LOWER</function> (<emphasis role="arg"><replaceable>string</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns a string identical to <replaceable>string</replaceable> except that all uppercase
letters are changed to lowercase letters. The definitions of
“uppercase” and “lowercase” are system-dependent.
</para></blockquote>
<indexterm role="cp"><primary>strings, padding</primary></indexterm>
<synopsis><indexterm role="fn"><primary>LPAD</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>LPAD</function> (<emphasis role="arg"><replaceable>string</replaceable></emphasis>, <emphasis role="arg"><replaceable>length</replaceable></emphasis>[, <emphasis role="arg"><replaceable>padding</replaceable></emphasis>])</synopsis>
<synopsis><indexterm role="fn"><primary>RPAD</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RPAD</function> (<emphasis role="arg"><replaceable>string</replaceable></emphasis>, <emphasis role="arg"><replaceable>length</replaceable></emphasis>[, <emphasis role="arg"><replaceable>padding</replaceable></emphasis>])</synopsis>
<blockquote><para>If <replaceable>string</replaceable> is at least <replaceable>length</replaceable> bytes long, these functions
return <replaceable>string</replaceable> unchanged. Otherwise, they return <replaceable>string</replaceable>
padded with <replaceable>padding</replaceable> on the left side (for <literal>LPAD</literal>) or right
side (for <literal>RPAD</literal>) to <replaceable>length</replaceable> bytes. These functions report
an error and return <replaceable>string</replaceable> unchanged if <replaceable>length</replaceable> is missing
or bigger than 32767.
</para>
<para>The <replaceable>padding</replaceable> argument must not be an empty string and defaults to
a space if not specified. If its length does not evenly fit the
amount of space needed for padding, the returned string will be
shorter than <replaceable>length</replaceable>.
</para></blockquote>
<indexterm role="cp"><primary>strings, trimming</primary></indexterm>
<indexterm role="cp"><primary>white space, trimming</primary></indexterm>
<synopsis><indexterm role="fn"><primary>LTRIM</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>LTRIM</function> (<emphasis role="arg"><replaceable>string</replaceable></emphasis>[, <emphasis role="arg"><replaceable>padding</replaceable></emphasis>])</synopsis>
<synopsis><indexterm role="fn"><primary>RTRIM</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RTRIM</function> (<emphasis role="arg"><replaceable>string</replaceable></emphasis>[, <emphasis role="arg"><replaceable>padding</replaceable></emphasis>])</synopsis>
<blockquote><para>These functions return <replaceable>string</replaceable>, after removing leading (for
<literal>LTRIM</literal>) or trailing (for <literal>RTRIM</literal>) copies of <replaceable>padding</replaceable>.
If <replaceable>padding</replaceable> is omitted, these functions remove spaces (but not
tabs or other white space). These functions return <replaceable>string</replaceable>
unchanged if <replaceable>padding</replaceable> is the empty string.
</para></blockquote>
<indexterm role="cp"><primary>numbers, converting from strings</primary></indexterm>
<indexterm role="cp"><primary>strings, converting to numbers</primary></indexterm>
<synopsis><indexterm role="fn"><primary>NUMBER</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>NUMBER</function> (<emphasis role="arg"><replaceable>string</replaceable></emphasis>, <emphasis role="arg"><replaceable>format</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns the number produced when <replaceable>string</replaceable> is interpreted according
to format specifier <replaceable>format</replaceable>. If the format width <replaceable>w</replaceable> is less
than the length of <replaceable>string</replaceable>, then only the first <replaceable>w</replaceable> bytes in
<replaceable>string</replaceable> are used, <emphasis>e.g.</emphasis> <literal>NUMBER("123", F3.0)</literal> and
<literal>NUMBER("1234", F3.0)</literal> both have value 123. If <replaceable>w</replaceable> is
greater than <replaceable>string</replaceable>’s length, then it is treated as if it were
right-padded with spaces. If <replaceable>string</replaceable> is not in the correct
format for <replaceable>format</replaceable>, system-missing is returned.
</para></blockquote>
<indexterm role="cp"><primary>strings, replacing substrings</primary></indexterm>
<indexterm role="cp"><primary>replacing substrings</primary></indexterm>
<synopsis><indexterm role="fn"><primary>REPLACE</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>REPLACE</function> (<emphasis role="arg"><replaceable>haystack</replaceable></emphasis>, <emphasis role="arg"><replaceable>needle</replaceable></emphasis>, <emphasis role="arg"><replaceable>replacement</replaceable></emphasis>[, <emphasis role="arg"><replaceable>n</replaceable></emphasis>])</synopsis>
<blockquote><para>Returns string <replaceable>haystack</replaceable> with instances of <replaceable>needle</replaceable> replaced
by <replaceable>replacement</replaceable>. If nonnegative integer <replaceable>n</replaceable> is specified, it
limits the maximum number of replacements; otherwise, all instances of
<replaceable>needle</replaceable> are replaced.
</para></blockquote>
<indexterm role="cp"><primary>strings, converting from numbers</primary></indexterm>
<indexterm role="cp"><primary>numbers, converting to strings</primary></indexterm>
<synopsis><indexterm role="fn"><primary>STRING</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>STRING</function> (<emphasis role="arg"><replaceable>number</replaceable></emphasis>, <emphasis role="arg"><replaceable>format</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns a string corresponding to <replaceable>number</replaceable> in the format given by
format specifier <replaceable>format</replaceable>. For example, <literal>STRING(123.56, F5.1)</literal>
has the value <literal>"123.6"</literal>.
</para></blockquote>
<indexterm role="cp"><primary>strings, trimming</primary></indexterm>
<indexterm role="cp"><primary>strings, truncating</primary></indexterm>
<indexterm role="cp"><primary>white space, trimming</primary></indexterm>
<synopsis><indexterm role="fn"><primary>STRUNC</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>STRUNC</function> (<emphasis role="arg"><replaceable>string</replaceable></emphasis>, <emphasis role="arg"><replaceable>n</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns <replaceable>string</replaceable>, first trimming it to at most <replaceable>n</replaceable> bytes, then
removing trailing spaces (but not tabs or other white space). Returns
an empty string if <replaceable>n</replaceable> is zero or negative, or <replaceable>string</replaceable>
unchanged if <replaceable>n</replaceable> is missing.
</para></blockquote>
<indexterm role="cp"><primary>substrings</primary></indexterm>
<indexterm role="cp"><primary>strings, taking substrings of</primary></indexterm>
<synopsis><indexterm role="fn"><primary>SUBSTR</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>SUBSTR</function> (<emphasis role="arg"><replaceable>string</replaceable></emphasis>, <emphasis role="arg"><replaceable>start</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns a string consisting of the value of <replaceable>string</replaceable> from position
<replaceable>start</replaceable> onward. Returns an empty string if <replaceable>start</replaceable> is system-missing,
less than 1, or greater than the length of <replaceable>string</replaceable>.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>SUBSTR</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>SUBSTR</function> (<emphasis role="arg"><replaceable>string</replaceable></emphasis>, <emphasis role="arg"><replaceable>start</replaceable></emphasis>, <emphasis role="arg"><replaceable>count</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns a string consisting of the first <replaceable>count</replaceable> bytes from
<replaceable>string</replaceable> beginning at position <replaceable>start</replaceable>. Returns an empty
string if <replaceable>start</replaceable> or <replaceable>count</replaceable> is system-missing, if <replaceable>start</replaceable>
is less than 1 or greater than the number of bytes in <replaceable>string</replaceable>, or
if <replaceable>count</replaceable> is less than 1. Returns a string shorter than
<replaceable>count</replaceable> bytes if <replaceable>start</replaceable> + <replaceable>count</replaceable> - 1 is greater than the
number of bytes in <replaceable>string</replaceable>. Examples: <literal>SUBSTR("abcdefg", 3,
2)</literal> has value <literal>"cd"</literal>; <literal>SUBSTR("nonsense", 4, 10)</literal> has the
value <literal>"sense"</literal>.
</para></blockquote>
<indexterm role="cp"><primary>case conversion</primary></indexterm>
<indexterm role="cp"><primary>strings, case of</primary></indexterm>
<synopsis><indexterm role="fn"><primary>UPCASE</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>UPCASE</function> (<emphasis role="arg"><replaceable>string</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns <replaceable>string</replaceable>, changing lowercase letters to uppercase letters.
</para></blockquote>
</sect2>
<sect2 label="7.7.8" id="Time-and-Date">
<title>Time & Date Functions</title>
<indexterm role="cp"><primary>functions, time & date</primary></indexterm>
<indexterm role="cp"><primary>times</primary></indexterm>
<indexterm role="cp"><primary>dates</primary></indexterm>
<indexterm role="cp"><primary>dates, valid</primary></indexterm>
<para>For compatibility, PSPP considers dates before 15 Oct 1582 invalid.
Most time and date functions will not accept earlier dates.
</para>
<sect3 label="7.7.8.1" id="Time-and-Date-Concepts">
<title>How times & dates are defined and represented</title>
<indexterm role="cp"><primary>time, concepts</primary></indexterm>
<indexterm role="cp"><primary>time, intervals</primary></indexterm>
<para>Times and dates are handled by PSPP as single numbers. A
<firstterm>time</firstterm> is an interval. PSPP measures times in seconds.
Thus, the following intervals correspond with the numeric values given:
</para>
<screen> 10 minutes 600
1 hour 3,600
1 day, 3 hours, 10 seconds 97,210
40 days 3,456,000
</screen>
<indexterm role="cp"><primary>dates, concepts</primary></indexterm>
<indexterm role="cp"><primary>time, instants of</primary></indexterm>
<para>A <firstterm>date</firstterm>, on the other hand, is a particular instant in the past
or the future. PSPP represents a date as a number of seconds since
midnight preceding 14 Oct 1582. Because midnight preceding the dates
given below correspond with the numeric PSPP dates given:
</para>
<screen> 15 Oct 1582 86,400
4 Jul 1776 6,113,318,400
1 Jan 1900 10,010,390,400
1 Oct 1978 12,495,427,200
24 Aug 1995 13,028,601,600
</screen>
</sect3>
<sect3 label="7.7.8.2" id="Time-Construction">
<title>Functions that Produce Times</title>
<indexterm role="cp"><primary>times, constructing</primary></indexterm>
<indexterm role="cp"><primary>constructing times</primary></indexterm>
<para>These functions take numeric arguments and return numeric values that
represent times.
</para>
<indexterm role="cp"><primary>days</primary></indexterm>
<indexterm role="cp"><primary>time, in days</primary></indexterm>
<synopsis><indexterm role="fn"><primary>TIME.DAYS</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>TIME.DAYS</function> (<emphasis role="arg"><replaceable>ndays</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns a time corresponding to <replaceable>ndays</replaceable> days.
</para></blockquote>
<indexterm role="cp"><primary>hours-minutes-seconds</primary></indexterm>
<indexterm role="cp"><primary>time, in hours-minutes-seconds</primary></indexterm>
<synopsis><indexterm role="fn"><primary>TIME.HMS</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>TIME.HMS</function> (<emphasis role="arg"><replaceable>nhours</replaceable></emphasis>, <emphasis role="arg"><replaceable>nmins</replaceable></emphasis>, <emphasis role="arg"><replaceable>nsecs</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns a time corresponding to <replaceable>nhours</replaceable> hours, <replaceable>nmins</replaceable>
minutes, and <replaceable>nsecs</replaceable> seconds. The arguments may not have mixed
signs: if any of them are positive, then none may be negative, and
vice versa.
</para></blockquote>
</sect3>
<sect3 label="7.7.8.3" id="Time-Extraction">
<title>Functions that Examine Times</title>
<indexterm role="cp"><primary>extraction, of time</primary></indexterm>
<indexterm role="cp"><primary>time examination</primary></indexterm>
<indexterm role="cp"><primary>examination, of times</primary></indexterm>
<indexterm role="cp"><primary>time, lengths of</primary></indexterm>
<para>These functions take numeric arguments in PSPP time format and
give numeric results.
</para>
<indexterm role="cp"><primary>days</primary></indexterm>
<indexterm role="cp"><primary>time, in days</primary></indexterm>
<synopsis><indexterm role="fn"><primary>CTIME.DAYS</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CTIME.DAYS</function> (<emphasis role="arg"><replaceable>time</replaceable></emphasis>)</synopsis>
<blockquote><para>Results in the number of days and fractional days in <replaceable>time</replaceable>.
</para></blockquote>
<indexterm role="cp"><primary>hours</primary></indexterm>
<indexterm role="cp"><primary>time, in hours</primary></indexterm>
<synopsis><indexterm role="fn"><primary>CTIME.HOURS</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CTIME.HOURS</function> (<emphasis role="arg"><replaceable>time</replaceable></emphasis>)</synopsis>
<blockquote><para>Results in the number of hours and fractional hours in <replaceable>time</replaceable>.
</para></blockquote>
<indexterm role="cp"><primary>minutes</primary></indexterm>
<indexterm role="cp"><primary>time, in minutes</primary></indexterm>
<synopsis><indexterm role="fn"><primary>CTIME.MINUTES</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CTIME.MINUTES</function> (<emphasis role="arg"><replaceable>time</replaceable></emphasis>)</synopsis>
<blockquote><para>Results in the number of minutes and fractional minutes in <replaceable>time</replaceable>.
</para></blockquote>
<indexterm role="cp"><primary>seconds</primary></indexterm>
<indexterm role="cp"><primary>time, in seconds</primary></indexterm>
<synopsis><indexterm role="fn"><primary>CTIME.SECONDS</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CTIME.SECONDS</function> (<emphasis role="arg"><replaceable>time</replaceable></emphasis>)</synopsis>
<blockquote><para>Results in the number of seconds and fractional seconds in <replaceable>time</replaceable>.
(<literal>CTIME.SECONDS</literal> does nothing; <literal>CTIME.SECONDS(<replaceable>x</replaceable>)</literal> is
equivalent to <literal><replaceable>x</replaceable></literal>.)
</para></blockquote>
</sect3>
<sect3 label="7.7.8.4" id="Date-Construction">
<title>Functions that Produce Dates</title>
<indexterm role="cp"><primary>dates, constructing</primary></indexterm>
<indexterm role="cp"><primary>constructing dates</primary></indexterm>
<indexterm role="cp"><primary>arguments, of date construction functions</primary></indexterm>
<para>These functions take numeric arguments and give numeric results that
represent dates. Arguments taken by these functions are:
</para>
<variablelist><varlistentry><term><replaceable>day</replaceable>
</term><listitem><para>Refers to a day of the month between 1 and 31. Day 0 is also accepted
and refers to the final day of the previous month. Days 29, 30, and
31 are accepted even in months that have fewer days and refer to a day
near the beginning of the following month.
</para>
</listitem></varlistentry><varlistentry><term><replaceable>month</replaceable>
</term><listitem><para>Refers to a month of the year between 1 and 12. Months 0 and 13 are
also accepted and refer to the last month of the preceding year and
the first month of the following year, respectively.
</para>
</listitem></varlistentry><varlistentry><term><replaceable>quarter</replaceable>
</term><listitem><para>Refers to a quarter of the year between 1 and 4. The quarters of the
year begin on the first day of months 1, 4, 7, and 10.
</para>
</listitem></varlistentry><varlistentry><term><replaceable>week</replaceable>
</term><listitem><para>Refers to a week of the year between 1 and 53.
</para>
</listitem></varlistentry><varlistentry><term><replaceable>yday</replaceable>
</term><listitem><para>Refers to a day of the year between 1 and 366.
</para>
</listitem></varlistentry><varlistentry><term><replaceable>year</replaceable>
</term><listitem><para>Refers to a year, 1582 or greater. Years between 0 and 99 are treated
according to the epoch set on SET EPOCH, by default beginning 69 years
before the current date (see <link linkend="SET-EPOCH">SET EPOCH</link>).
</para></listitem></varlistentry></variablelist>
<indexterm role="cp"><primary>arguments, invalid</primary></indexterm>
<para>If these functions’ arguments are out-of-range, they are correctly
normalized before conversion to date format. Non-integers are rounded
toward zero.
</para>
<indexterm role="cp"><primary>day-month-year</primary></indexterm>
<indexterm role="cp"><primary>dates, day-month-year</primary></indexterm>
<synopsis><indexterm role="fn"><primary>DATE.DMY</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>DATE.DMY</function> (<emphasis role="arg"><replaceable>day</replaceable></emphasis>, <emphasis role="arg"><replaceable>month</replaceable></emphasis>, <emphasis role="arg"><replaceable>year</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>DATE.MDY</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>DATE.MDY</function> (<emphasis role="arg"><replaceable>month</replaceable></emphasis>, <emphasis role="arg"><replaceable>day</replaceable></emphasis>, <emphasis role="arg"><replaceable>year</replaceable></emphasis>)</synopsis>
<blockquote><para>Results in a date value corresponding to the midnight before day
<replaceable>day</replaceable> of month <replaceable>month</replaceable> of year <replaceable>year</replaceable>.
</para></blockquote>
<indexterm role="cp"><primary>month-year</primary></indexterm>
<indexterm role="cp"><primary>dates, month-year</primary></indexterm>
<synopsis><indexterm role="fn"><primary>DATE.MOYR</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>DATE.MOYR</function> (<emphasis role="arg"><replaceable>month</replaceable></emphasis>, <emphasis role="arg"><replaceable>year</replaceable></emphasis>)</synopsis>
<blockquote><para>Results in a date value corresponding to the midnight before the first
day of month <replaceable>month</replaceable> of year <replaceable>year</replaceable>.
</para></blockquote>
<indexterm role="cp"><primary>quarter-year</primary></indexterm>
<indexterm role="cp"><primary>dates, quarter-year</primary></indexterm>
<synopsis><indexterm role="fn"><primary>DATE.QYR</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>DATE.QYR</function> (<emphasis role="arg"><replaceable>quarter</replaceable></emphasis>, <emphasis role="arg"><replaceable>year</replaceable></emphasis>)</synopsis>
<blockquote><para>Results in a date value corresponding to the midnight before the first
day of quarter <replaceable>quarter</replaceable> of year <replaceable>year</replaceable>.
</para></blockquote>
<indexterm role="cp"><primary>week-year</primary></indexterm>
<indexterm role="cp"><primary>dates, week-year</primary></indexterm>
<synopsis><indexterm role="fn"><primary>DATE.WKYR</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>DATE.WKYR</function> (<emphasis role="arg"><replaceable>week</replaceable></emphasis>, <emphasis role="arg"><replaceable>year</replaceable></emphasis>)</synopsis>
<blockquote><para>Results in a date value corresponding to the midnight before the first
day of week <replaceable>week</replaceable> of year <replaceable>year</replaceable>.
</para></blockquote>
<indexterm role="cp"><primary>year-day</primary></indexterm>
<indexterm role="cp"><primary>dates, year-day</primary></indexterm>
<synopsis><indexterm role="fn"><primary>DATE.YRDAY</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>DATE.YRDAY</function> (<emphasis role="arg"><replaceable>year</replaceable></emphasis>, <emphasis role="arg"><replaceable>yday</replaceable></emphasis>)</synopsis>
<blockquote><para>Results in a date value corresponding to the day
<replaceable>yday</replaceable> of year <replaceable>year</replaceable>.
</para></blockquote>
</sect3>
<sect3 label="7.7.8.5" id="Date-Extraction">
<title>Functions that Examine Dates</title>
<indexterm role="cp"><primary>extraction, of dates</primary></indexterm>
<indexterm role="cp"><primary>date examination</primary></indexterm>
<indexterm role="cp"><primary>arguments, of date extraction functions</primary></indexterm>
<para>These functions take numeric arguments in PSPP date or time
format and give numeric results. These names are used for arguments:
</para>
<variablelist><varlistentry><term><replaceable>date</replaceable>
</term><listitem><para>A numeric value in PSPP date format.
</para>
</listitem></varlistentry><varlistentry><term><replaceable>time</replaceable>
</term><listitem><para>A numeric value in PSPP time format.
</para>
</listitem></varlistentry><varlistentry><term><replaceable>time-or-date</replaceable>
</term><listitem><para>A numeric value in PSPP time or date format.
</para></listitem></varlistentry></variablelist>
<indexterm role="cp"><primary>days</primary></indexterm>
<indexterm role="cp"><primary>dates, in days</primary></indexterm>
<indexterm role="cp"><primary>time, in days</primary></indexterm>
<synopsis><indexterm role="fn"><primary>XDATE.DATE</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>XDATE.DATE</function> (<emphasis role="arg"><replaceable>time-or-date</replaceable></emphasis>)</synopsis>
<blockquote><para>For a time, results in the time corresponding to the number of whole
days <replaceable>date-or-time</replaceable> includes. For a date, results in the date
corresponding to the latest midnight at or before <replaceable>date-or-time</replaceable>;
that is, gives the date that <replaceable>date-or-time</replaceable> is in.
</para></blockquote>
<indexterm role="cp"><primary>hours</primary></indexterm>
<indexterm role="cp"><primary>dates, in hours</primary></indexterm>
<indexterm role="cp"><primary>time, in hours</primary></indexterm>
<synopsis><indexterm role="fn"><primary>XDATE.HOUR</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>XDATE.HOUR</function> (<emphasis role="arg"><replaceable>time-or-date</replaceable></emphasis>)</synopsis>
<blockquote><para>For a time, results in the number of whole hours beyond the number of
whole days represented by <replaceable>date-or-time</replaceable>. For a date, results in
the hour (as an integer between 0 and 23) corresponding to
<replaceable>date-or-time</replaceable>.
</para></blockquote>
<indexterm role="cp"><primary>day of the year</primary></indexterm>
<indexterm role="cp"><primary>dates, day of the year</primary></indexterm>
<synopsis><indexterm role="fn"><primary>XDATE.JDAY</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>XDATE.JDAY</function> (<emphasis role="arg"><replaceable>date</replaceable></emphasis>)</synopsis>
<blockquote><para>Results in the day of the year (as an integer between 1 and 366)
corresponding to <replaceable>date</replaceable>.
</para></blockquote>
<indexterm role="cp"><primary>day of the month</primary></indexterm>
<indexterm role="cp"><primary>dates, day of the month</primary></indexterm>
<synopsis><indexterm role="fn"><primary>XDATE.MDAY</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>XDATE.MDAY</function> (<emphasis role="arg"><replaceable>date</replaceable></emphasis>)</synopsis>
<blockquote><para>Results in the day of the month (as an integer between 1 and 31)
corresponding to <replaceable>date</replaceable>.
</para></blockquote>
<indexterm role="cp"><primary>minutes</primary></indexterm>
<indexterm role="cp"><primary>dates, in minutes</primary></indexterm>
<indexterm role="cp"><primary>time, in minutes</primary></indexterm>
<synopsis><indexterm role="fn"><primary>XDATE.MINUTE</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>XDATE.MINUTE</function> (<emphasis role="arg"><replaceable>time-or-date</replaceable></emphasis>)</synopsis>
<blockquote><para>Results in the number of minutes (as an integer between 0 and 59) after
the last hour in <replaceable>time-or-date</replaceable>.
</para></blockquote>
<indexterm role="cp"><primary>months</primary></indexterm>
<indexterm role="cp"><primary>dates, in months</primary></indexterm>
<synopsis><indexterm role="fn"><primary>XDATE.MONTH</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>XDATE.MONTH</function> (<emphasis role="arg"><replaceable>date</replaceable></emphasis>)</synopsis>
<blockquote><para>Results in the month of the year (as an integer between 1 and 12)
corresponding to <replaceable>date</replaceable>.
</para></blockquote>
<indexterm role="cp"><primary>quarters</primary></indexterm>
<indexterm role="cp"><primary>dates, in quarters</primary></indexterm>
<synopsis><indexterm role="fn"><primary>XDATE.QUARTER</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>XDATE.QUARTER</function> (<emphasis role="arg"><replaceable>date</replaceable></emphasis>)</synopsis>
<blockquote><para>Results in the quarter of the year (as an integer between 1 and 4)
corresponding to <replaceable>date</replaceable>.
</para></blockquote>
<indexterm role="cp"><primary>seconds</primary></indexterm>
<indexterm role="cp"><primary>dates, in seconds</primary></indexterm>
<indexterm role="cp"><primary>time, in seconds</primary></indexterm>
<synopsis><indexterm role="fn"><primary>XDATE.SECOND</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>XDATE.SECOND</function> (<emphasis role="arg"><replaceable>time-or-date</replaceable></emphasis>)</synopsis>
<blockquote><para>Results in the number of whole seconds after the last whole minute (as
an integer between 0 and 59) in <replaceable>time-or-date</replaceable>.
</para></blockquote>
<indexterm role="cp"><primary>days</primary></indexterm>
<indexterm role="cp"><primary>times, in days</primary></indexterm>
<synopsis><indexterm role="fn"><primary>XDATE.TDAY</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>XDATE.TDAY</function> (<emphasis role="arg"><replaceable>date</replaceable></emphasis>)</synopsis>
<blockquote><para>Results in the number of whole days from 14 Oct 1582 to <replaceable>date</replaceable>.
</para></blockquote>
<indexterm role="cp"><primary>time</primary></indexterm>
<indexterm role="cp"><primary>dates, time of day</primary></indexterm>
<synopsis><indexterm role="fn"><primary>XDATE.TIME</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>XDATE.TIME</function> (<emphasis role="arg"><replaceable>date</replaceable></emphasis>)</synopsis>
<blockquote><para>Results in the time of day at the instant corresponding to <replaceable>date</replaceable>,
as a time value. This is the number of seconds since
midnight on the day corresponding to <replaceable>date</replaceable>.
</para></blockquote>
<indexterm role="cp"><primary>week</primary></indexterm>
<indexterm role="cp"><primary>dates, in weeks</primary></indexterm>
<synopsis><indexterm role="fn"><primary>XDATE.WEEK</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>XDATE.WEEK</function> (<emphasis role="arg"><replaceable>date</replaceable></emphasis>)</synopsis>
<blockquote><para>Results in the week of the year (as an integer between 1 and 53)
corresponding to <replaceable>date</replaceable>.
</para></blockquote>
<indexterm role="cp"><primary>day of the week</primary></indexterm>
<indexterm role="cp"><primary>weekday</primary></indexterm>
<indexterm role="cp"><primary>dates, day of the week</primary></indexterm>
<indexterm role="cp"><primary>dates, in weekdays</primary></indexterm>
<synopsis><indexterm role="fn"><primary>XDATE.WKDAY</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>XDATE.WKDAY</function> (<emphasis role="arg"><replaceable>date</replaceable></emphasis>)</synopsis>
<blockquote><para>Results in the day of week (as an integer between 1 and 7) corresponding
to <replaceable>date</replaceable>, where 1 represents Sunday.
</para></blockquote>
<indexterm role="cp"><primary>years</primary></indexterm>
<indexterm role="cp"><primary>dates, in years</primary></indexterm>
<synopsis><indexterm role="fn"><primary>XDATE.YEAR</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>XDATE.YEAR</function> (<emphasis role="arg"><replaceable>date</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns the year (as an integer 1582 or greater) corresponding to
<replaceable>date</replaceable>.
</para></blockquote>
</sect3>
<sect3 label="7.7.8.6" id="Time-and-Date-Arithmetic">
<title>Time and Date Arithmetic</title>
<indexterm role="cp"><primary>time, mathematical properties of</primary></indexterm>
<indexterm role="cp"><primary>mathematics, applied to times & dates</primary></indexterm>
<indexterm role="cp"><primary>dates, mathematical properties of</primary></indexterm>
<para>Ordinary arithmetic operations on dates and times often produce
sensible results. Adding a time to, or subtracting one from, a date
produces a new date that much earlier or later. The difference of two
dates yields the time between those dates. Adding two times produces
the combined time. Multiplying a time by a scalar produces a time
that many times longer. Since times and dates are just numbers, the
ordinary addition and subtraction operators are employed for these
purposes.
</para>
<para>Adding two dates does not produce a useful result.
</para>
<para>Dates and times may have very large values. Thus,
it is not a good idea to take powers of these values; also, the
accuracy of some procedures may be affected. If necessary, convert
times or dates in seconds to some other unit, like days or years,
before performing analysis.
</para>
<para>PSPP supplies a few functions for date arithmetic:
</para>
<synopsis><indexterm role="fn"><primary>DATEDIFF</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>DATEDIFF</function> (<emphasis role="arg"><replaceable>date2</replaceable></emphasis>, <emphasis role="arg"><replaceable>date1</replaceable></emphasis>, <emphasis role="arg"><replaceable>unit</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns the span of time from <replaceable>date1</replaceable> to <replaceable>date2</replaceable> in terms of
<replaceable>unit</replaceable>, which must be a quoted string, one of ‘<literal>years</literal>’,
‘<literal>quarters</literal>’, ‘<literal>months</literal>’, ‘<literal>weeks</literal>’, ‘<literal>days</literal>’,
‘<literal>hours</literal>’, ‘<literal>minutes</literal>’, and ‘<literal>seconds</literal>’. The result is an
integer, truncated toward zero.
</para>
<para>One year is considered to span from a given date to the same month,
day, and time of day the next year. Thus, from Jan. 1 of one
year to Jan. 1 the next year is considered to be a full year, but
Feb. 29 of a leap year to the following Feb. 28 is not.
Similarly, one month spans from a given day of the month to the same
day of the following month. Thus, there is never a full month from
Jan. 31 of a given year to any day in the following February.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>DATESUM</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>DATESUM</function> (<emphasis role="arg"><replaceable>date</replaceable></emphasis>, <emphasis role="arg"><replaceable>quantity</replaceable></emphasis>, <emphasis role="arg"><replaceable>unit</replaceable></emphasis>[, <emphasis role="arg"><replaceable>method</replaceable></emphasis>])</synopsis>
<blockquote><para>Returns <replaceable>date</replaceable> advanced by the given <replaceable>quantity</replaceable> of the
specified <replaceable>unit</replaceable>, which must be one of the strings ‘<literal>years</literal>’,
‘<literal>quarters</literal>’, ‘<literal>months</literal>’, ‘<literal>weeks</literal>’, ‘<literal>days</literal>’,
‘<literal>hours</literal>’, ‘<literal>minutes</literal>’, and ‘<literal>seconds</literal>’.
</para>
<para>When <replaceable>unit</replaceable> is ‘<literal>years</literal>’, ‘<literal>quarters</literal>’, or ‘<literal>months</literal>’,
only the integer part of <replaceable>quantity</replaceable> is considered. Adding one of
these units can cause the day of the month to exceed the number of
days in the month. In this case, the <replaceable>method</replaceable> comes into
play: if it is omitted or specified as ‘<literal>closest</literal>’ (as a quoted
string), then the resulting day is the last day of the month;
otherwise, if it is specified as ‘<literal>rollover</literal>’, then the extra days
roll over into the following month.
</para>
<para>When <replaceable>unit</replaceable> is ‘<literal>weeks</literal>’, ‘<literal>days</literal>’, ‘<literal>hours</literal>’,
‘<literal>minutes</literal>’, or ‘<literal>seconds</literal>’, the <replaceable>quantity</replaceable> is not rounded
to an integer and <replaceable>method</replaceable>, if specified, is ignored.
</para></blockquote>
</sect3>
</sect2>
<sect2 label="7.7.9" id="Miscellaneous-Functions">
<title>Miscellaneous Functions</title>
<indexterm role="cp"><primary>functions, miscellaneous</primary></indexterm>
<indexterm role="cp"><primary>cross-case function</primary></indexterm>
<indexterm role="cp"><primary>function, cross-case</primary></indexterm>
<synopsis><indexterm role="fn"><primary>LAG</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>LAG</function> (<emphasis role="arg"><replaceable>variable</replaceable></emphasis>[, <emphasis role="arg"><replaceable>n</replaceable></emphasis>])</synopsis>
<blockquote><anchor id="LAG"/>
<para><replaceable>variable</replaceable> must be a numeric or string variable name. <literal>LAG</literal>
yields the value of that variable for the case <replaceable>n</replaceable> before the
current one. Results in system-missing (for numeric variables) or
blanks (for string variables) for the first <replaceable>n</replaceable> cases.
</para>
<para><literal>LAG</literal> obtains values from the cases that become the new active
dataset
after a procedure executes. Thus, <literal>LAG</literal> will not return values
from cases dropped by transformations such as <literal>SELECT IF</literal>, and
transformations like <literal>COMPUTE</literal> that modify data will change the
values returned by <literal>LAG</literal>. These are both the case whether these
transformations precede or follow the use of <literal>LAG</literal>.
</para>
<para>If <literal>LAG</literal> is used before <literal>TEMPORARY</literal>, then the values it returns
are those in cases just before <literal>TEMPORARY</literal>. <literal>LAG</literal> may not be
used after <literal>TEMPORARY</literal>.
</para>
<para>If omitted, <replaceable>ncases</replaceable> defaults to 1. Otherwise, <replaceable>ncases</replaceable> must
be a small positive constant integer. There is no explicit limit, but
use of a large value will increase memory consumption.
</para></blockquote>
<indexterm role="cp"><primary>date, Julian</primary></indexterm>
<indexterm role="cp"><primary>Julian date</primary></indexterm>
<synopsis><indexterm role="fn"><primary>YRMODA</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>YRMODA</function> (<emphasis role="arg"><replaceable>year</replaceable></emphasis>, <emphasis role="arg"><replaceable>month</replaceable></emphasis>, <emphasis role="arg"><replaceable>day</replaceable></emphasis>)</synopsis>
<blockquote><para><replaceable>year</replaceable> is a year, either between 0 and 99 or at least 1582.
Unlike other PSPP date functions, years between 0 and 99 always
correspond to 1900 through 1999. <replaceable>month</replaceable> is a month between 1 and
13. <replaceable>day</replaceable> is a day between 0 and 31. A <replaceable>day</replaceable> of 0 refers to
the last day of the previous month, and a <replaceable>month</replaceable> of 13 refers to
the first month of the next year. <replaceable>year</replaceable> must be in range.
<replaceable>year</replaceable>, <replaceable>month</replaceable>, and <replaceable>day</replaceable> must all be integers.
</para>
<para><literal>YRMODA</literal> results in the number of days between 15 Oct 1582 and
the date specified, plus one. The date passed to <literal>YRMODA</literal> must be
on or after 15 Oct 1582. 15 Oct 1582 has a value of 1.
</para></blockquote>
<indexterm role="cp"><primary>value label</primary></indexterm>
<synopsis><indexterm role="fn"><primary>(<replaceable>variable</replaceable>)</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue>VALUELABEL</returnvalue> <function>(<replaceable>variable</replaceable>)</function></synopsis>
<blockquote><para>Returns a string matching the label associated with the current value
of <replaceable>variable</replaceable>. If the current value of <replaceable>variable</replaceable> has no
associated label, then this function returns the empty string.
<replaceable>variable</replaceable> may be a numeric or string variable.
</para></blockquote>
</sect2>
<sect2 label="7.7.10" id="Statistical-Distribution-Functions">
<title>Statistical Distribution Functions</title>
<para>PSPP can calculate several functions of standard statistical
distributions. These functions are named systematically based on the
function and the distribution. The table below describes the
statistical distribution functions in general:
</para>
<variablelist><varlistentry><term>PDF.<replaceable>dist</replaceable> (<replaceable>x</replaceable>[, <replaceable>param</replaceable>…])
</term><listitem><para>Probability density function for <replaceable>dist</replaceable>. The domain of <replaceable>x</replaceable>
depends on <replaceable>dist</replaceable>. For continuous distributions, the result is
the density of the probability function at <replaceable>x</replaceable>, and the range is
nonnegative real numbers. For discrete distributions, the result is
the probability of <replaceable>x</replaceable>.
</para>
</listitem></varlistentry><varlistentry><term>CDF.<replaceable>dist</replaceable> (<replaceable>x</replaceable>[, <replaceable>param</replaceable>…])
</term><listitem><para>Cumulative distribution function for <replaceable>dist</replaceable>, that is, the
probability that a random variate drawn from the distribution is less
than <replaceable>x</replaceable>. The domain of <replaceable>x</replaceable> depends <replaceable>dist</replaceable>. The result is
a probability.
</para>
</listitem></varlistentry><varlistentry><term>SIG.<replaceable>dist</replaceable> (<replaceable>x</replaceable>[, <replaceable>param</replaceable>…)
</term><listitem><para>Tail probability function for <replaceable>dist</replaceable>, that is, the probability
that a random variate drawn from the distribution is greater than
<replaceable>x</replaceable>. The domain of <replaceable>x</replaceable> depends <replaceable>dist</replaceable>. The result is a
probability. Only a few distributions include an <literal>SIG</literal> function.
</para>
</listitem></varlistentry><varlistentry><term>IDF.<replaceable>dist</replaceable> (<replaceable>p</replaceable>[, <replaceable>param</replaceable>…])
</term><listitem><para>Inverse distribution function for <replaceable>dist</replaceable>, the value of <replaceable>x</replaceable> for
which the CDF would yield <replaceable>p</replaceable>. The value of <replaceable>p</replaceable> is a
probability. The range depends on <replaceable>dist</replaceable> and is identical to the
domain for the corresponding CDF.
</para>
</listitem></varlistentry><varlistentry><term>RV.<replaceable>dist</replaceable> ([<replaceable>param</replaceable>…])
</term><listitem><para>Random variate function for <replaceable>dist</replaceable>. The range depends on the
distribution.
</para>
</listitem></varlistentry><varlistentry><term>NPDF.<replaceable>dist</replaceable> (<replaceable>x</replaceable>[, <replaceable>param</replaceable>…])
</term><listitem><para>Noncentral probability density function. The result is the density of
the given noncentral distribution at <replaceable>x</replaceable>. The domain of <replaceable>x</replaceable>
depends on <replaceable>dist</replaceable>. The range is nonnegative real numbers. Only a
few distributions include an <literal>NPDF</literal> function.
</para>
</listitem></varlistentry><varlistentry><term>NCDF.<replaceable>dist</replaceable> (<replaceable>x</replaceable>[, <replaceable>param</replaceable>…])
</term><listitem><para>Noncentral cumulative distribution function for <replaceable>dist</replaceable>, that is,
the probability that a random variate drawn from the given noncentral
distribution is less than <replaceable>x</replaceable>. The domain of <replaceable>x</replaceable> depends
<replaceable>dist</replaceable>. The result is a probability. Only a few distributions
include an NCDF function.
</para></listitem></varlistentry></variablelist>
<para>The individual distributions are described individually below.
</para>
<sect3 label="7.7.10.1" id="Continuous-Distributions">
<title>Continuous Distributions</title>
<para>The following continuous distributions are available:
</para>
<synopsis><indexterm role="fn"><primary>PDF.BETA</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.BETA</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>CDF.BETA</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CDF.BETA</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>IDF.BETA</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>IDF.BETA</function> (<emphasis role="arg"><replaceable>p</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RV.BETA</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.BETA</function> (<emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>NPDF.BETA</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>NPDF.BETA</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>, <emphasis role="arg"><replaceable>lambda</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>NCDF.BETA</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>NCDF.BETA</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>, <emphasis role="arg"><replaceable>lambda</replaceable></emphasis>)</synopsis>
<blockquote><para>Beta distribution with shape parameters <replaceable>a</replaceable> and <replaceable>b</replaceable>. The
noncentral distribution takes an additional parameter <replaceable>lambda</replaceable>.
Constraints: <replaceable>a</replaceable> > 0, <replaceable>b</replaceable> > 0, <replaceable>lambda</replaceable> >= 0, 0 <= <replaceable>x</replaceable>
<= 1, 0 <= <replaceable>p</replaceable> <= 1.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>PDF.BVNOR</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.BVNOR</function> (<emphasis role="arg"><replaceable>x0</replaceable></emphasis>, <emphasis role="arg"><replaceable>x1</replaceable></emphasis>, <emphasis role="arg"><replaceable>rho</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>CDF.BVNOR</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CDF.BVNOR</function> (<emphasis role="arg"><replaceable>x0</replaceable></emphasis>, <emphasis role="arg"><replaceable>x1</replaceable></emphasis>, <emphasis role="arg"><replaceable>rho</replaceable></emphasis>)</synopsis>
<blockquote><para>Bivariate normal distribution of two standard normal variables with
correlation coefficient <replaceable>rho</replaceable>. Two variates <replaceable>x0</replaceable> and <replaceable>x1</replaceable>
must be provided. Constraints: 0 <= <replaceable>rho</replaceable> <= 1, 0 <= <replaceable>p</replaceable> <= 1.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>PDF.CAUCHY</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.CAUCHY</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>CDF.CAUCHY</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CDF.CAUCHY</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>IDF.CAUCHY</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>IDF.CAUCHY</function> (<emphasis role="arg"><replaceable>p</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RV.CAUCHY</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.CAUCHY</function> (<emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<blockquote><para>Cauchy distribution with location parameter <replaceable>a</replaceable> and scale
parameter <replaceable>b</replaceable>. Constraints: <replaceable>b</replaceable> > 0, 0 < <replaceable>p</replaceable> < 1.
</para></blockquote>
<!-- @deftypefn {Function} {} PDF.CHISQ (@var{x}, @var{df}) -->
<synopsis><indexterm role="fn"><primary>CDF.CHISQ</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CDF.CHISQ</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>df</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>SIG.CHISQ</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>SIG.CHISQ</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>df</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>IDF.CHISQ</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>IDF.CHISQ</function> (<emphasis role="arg"><replaceable>p</replaceable></emphasis>, <emphasis role="arg"><replaceable>df</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RV.CHISQ</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.CHISQ</function> (<emphasis role="arg"><replaceable>df</replaceable></emphasis>)</synopsis>
<!-- @deftypefnx {Function} {} NPDF.CHISQ (@var{x}, @var{df}, @var{lambda}) -->
<synopsis><indexterm role="fn"><primary>NCDF.CHISQ</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>NCDF.CHISQ</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>df</replaceable></emphasis>, <emphasis role="arg"><replaceable>lambda</replaceable></emphasis>)</synopsis>
<blockquote><para>Chi-squared distribution with <replaceable>df</replaceable> degrees of freedom. The
noncentral distribution takes an additional parameter <replaceable>lambda</replaceable>.
Constraints: <replaceable>df</replaceable> > 0, <replaceable>lambda</replaceable> > 0, <replaceable>x</replaceable> >= 0, 0 <=
<replaceable>p</replaceable> < 1.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>PDF.EXP</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.EXP</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>CDF.EXP</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CDF.EXP</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>IDF.EXP</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>IDF.EXP</function> (<emphasis role="arg"><replaceable>p</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RV.EXP</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.EXP</function> (<emphasis role="arg"><replaceable>a</replaceable></emphasis>)</synopsis>
<blockquote><para>Exponential distribution with scale parameter <replaceable>a</replaceable>. The inverse of
<replaceable>a</replaceable> represents the rate of decay. Constraints: <replaceable>a</replaceable> > 0,
<replaceable>x</replaceable> >= 0, 0 <= <replaceable>p</replaceable> < 1.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>PDF.XPOWER</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.XPOWER</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RV.XPOWER</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.XPOWER</function> (<emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<blockquote><para>Exponential power distribution with positive scale parameter <replaceable>a</replaceable>
and nonnegative power parameter <replaceable>b</replaceable>. Constraints: <replaceable>a</replaceable> > 0,
<replaceable>b</replaceable> >= 0, <replaceable>x</replaceable> >= 0, 0 <= <replaceable>p</replaceable> <= 1. This distribution is a
PSPP extension.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>PDF.F</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.F</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>df1</replaceable></emphasis>, <emphasis role="arg"><replaceable>df2</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>CDF.F</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CDF.F</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>df1</replaceable></emphasis>, <emphasis role="arg"><replaceable>df2</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>SIG.F</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>SIG.F</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>df1</replaceable></emphasis>, <emphasis role="arg"><replaceable>df2</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>IDF.F</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>IDF.F</function> (<emphasis role="arg"><replaceable>p</replaceable></emphasis>, <emphasis role="arg"><replaceable>df1</replaceable></emphasis>, <emphasis role="arg"><replaceable>df2</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RV.F</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.F</function> (<emphasis role="arg"><replaceable>df1</replaceable></emphasis>, <emphasis role="arg"><replaceable>df2</replaceable></emphasis>)</synopsis>
<blockquote><!-- @deftypefnx {Function} {} NPDF.F (@var{x}, @var{df1}, @var{df2}, @var{lambda}) -->
<!-- @deftypefnx {Function} {} NCDF.F (@var{x}, @var{df1}, @var{df2}, @var{lambda}) -->
<para>F-distribution of two chi-squared deviates with <replaceable>df1</replaceable> and
<replaceable>df2</replaceable> degrees of freedom. The noncentral distribution takes an
additional parameter <replaceable>lambda</replaceable>. Constraints: <replaceable>df1</replaceable> > 0,
<replaceable>df2</replaceable> > 0, <replaceable>lambda</replaceable> >= 0, <replaceable>x</replaceable> >= 0, 0 <= <replaceable>p</replaceable> < 1.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>PDF.GAMMA</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.GAMMA</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>CDF.GAMMA</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CDF.GAMMA</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>IDF.GAMMA</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>IDF.GAMMA</function> (<emphasis role="arg"><replaceable>p</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RV.GAMMA</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.GAMMA</function> (<emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<blockquote><para>Gamma distribution with shape parameter <replaceable>a</replaceable> and scale parameter
<replaceable>b</replaceable>. Constraints: <replaceable>a</replaceable> > 0, <replaceable>b</replaceable> > 0, <replaceable>x</replaceable> >= 0, 0 <=
<replaceable>p</replaceable> < 1.
</para></blockquote>
<!-- @deftypefn {Function} {} PDF.HALFNRM (@var{x}, @var{a}, @var{b}) -->
<!-- @deftypefnx {Function} {} CDF.HALFNRM (@var{x}, @var{a}, @var{b}) -->
<!-- @deftypefnx {Function} {} IDF.HALFNRM (@var{p}, @var{a}, @var{b}) -->
<!-- @deftypefnx {Function} {} RV.HALFNRM (@var{a}, @var{b}) -->
<!-- Half-normal distribution with location parameter @var{a} and shape -->
<!-- parameter @var{b}. Constraints: @var{b} > 0, 0 < @var{p} < 1. -->
<!-- @end deftypefn -->
<!-- @deftypefn {Function} {} PDF.IGAUSS (@var{x}, @var{a}, @var{b}) -->
<!-- @deftypefnx {Function} {} CDF.IGAUSS (@var{x}, @var{a}, @var{b}) -->
<!-- @deftypefnx {Function} {} IDF.IGAUSS (@var{p}, @var{a}, @var{b}) -->
<!-- @deftypefnx {Function} {} RV.IGAUSS (@var{a}, @var{b}) -->
<!-- Inverse Gaussian distribution with parameters @var{a} and @var{b}. -->
<!-- Constraints: @var{a} > 0, @var{b} > 0, @var{x} > 0, 0 <= @var{p} < 1. -->
<!-- @end deftypefn -->
<synopsis><indexterm role="fn"><primary>PDF.LANDAU</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.LANDAU</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RV.LANDAU</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.LANDAU</function> ()</synopsis>
<blockquote><para>Landau distribution.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>PDF.LAPLACE</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.LAPLACE</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>CDF.LAPLACE</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CDF.LAPLACE</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>IDF.LAPLACE</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>IDF.LAPLACE</function> (<emphasis role="arg"><replaceable>p</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RV.LAPLACE</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.LAPLACE</function> (<emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<blockquote><para>Laplace distribution with location parameter <replaceable>a</replaceable> and scale
parameter <replaceable>b</replaceable>. Constraints: <replaceable>b</replaceable> > 0, 0 < <replaceable>p</replaceable> < 1.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>RV.LEVY</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.LEVY</function> (<emphasis role="arg"><replaceable>c</replaceable></emphasis>, <emphasis role="arg"><replaceable>alpha</replaceable></emphasis>)</synopsis>
<blockquote><para>Levy symmetric alpha-stable distribution with scale <replaceable>c</replaceable> and
exponent <replaceable>alpha</replaceable>. Constraints: 0 < <replaceable>alpha</replaceable> <= 2.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>RV.LVSKEW</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.LVSKEW</function> (<emphasis role="arg"><replaceable>c</replaceable></emphasis>, <emphasis role="arg"><replaceable>alpha</replaceable></emphasis>, <emphasis role="arg"><replaceable>beta</replaceable></emphasis>)</synopsis>
<blockquote><para>Levy skew alpha-stable distribution with scale <replaceable>c</replaceable>, exponent
<replaceable>alpha</replaceable>, and skewness parameter <replaceable>beta</replaceable>. Constraints: 0 <
<replaceable>alpha</replaceable> <= 2, -1 <= <replaceable>beta</replaceable> <= 1.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>PDF.LOGISTIC</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.LOGISTIC</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>CDF.LOGISTIC</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CDF.LOGISTIC</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>IDF.LOGISTIC</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>IDF.LOGISTIC</function> (<emphasis role="arg"><replaceable>p</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RV.LOGISTIC</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.LOGISTIC</function> (<emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<blockquote><para>Logistic distribution with location parameter <replaceable>a</replaceable> and scale
parameter <replaceable>b</replaceable>. Constraints: <replaceable>b</replaceable> > 0, 0 < <replaceable>p</replaceable> < 1.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>PDF.LNORMAL</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.LNORMAL</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>CDF.LNORMAL</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CDF.LNORMAL</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>IDF.LNORMAL</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>IDF.LNORMAL</function> (<emphasis role="arg"><replaceable>p</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RV.LNORMAL</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.LNORMAL</function> (<emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<blockquote><para>Lognormal distribution with parameters <replaceable>a</replaceable> and <replaceable>b</replaceable>.
Constraints: <replaceable>a</replaceable> > 0, <replaceable>b</replaceable> > 0, <replaceable>x</replaceable> >= 0, 0 <= <replaceable>p</replaceable> < 1.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>PDF.NORMAL</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.NORMAL</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>mu</replaceable></emphasis>, <emphasis role="arg"><replaceable>sigma</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>CDF.NORMAL</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CDF.NORMAL</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>mu</replaceable></emphasis>, <emphasis role="arg"><replaceable>sigma</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>IDF.NORMAL</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>IDF.NORMAL</function> (<emphasis role="arg"><replaceable>p</replaceable></emphasis>, <emphasis role="arg"><replaceable>mu</replaceable></emphasis>, <emphasis role="arg"><replaceable>sigma</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RV.NORMAL</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.NORMAL</function> (<emphasis role="arg"><replaceable>mu</replaceable></emphasis>, <emphasis role="arg"><replaceable>sigma</replaceable></emphasis>)</synopsis>
<blockquote><para>Normal distribution with mean <replaceable>mu</replaceable> and standard deviation
<replaceable>sigma</replaceable>. Constraints: <replaceable>b</replaceable> > 0, 0 < <replaceable>p</replaceable> < 1. Three
additional functions are available as shorthand:
</para>
<synopsis><indexterm role="fn"><primary>CDFNORM</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CDFNORM</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>)</synopsis>
<blockquote><para>Equivalent to CDF.NORMAL(<replaceable>x</replaceable>, 0, 1).
</para></blockquote>
<synopsis><indexterm role="fn"><primary>PROBIT</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PROBIT</function> (<emphasis role="arg"><replaceable>p</replaceable></emphasis>)</synopsis>
<blockquote><para>Equivalent to IDF.NORMAL(<replaceable>p</replaceable>, 0, 1).
</para></blockquote>
<synopsis><indexterm role="fn"><primary>NORMAL</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>NORMAL</function> (<emphasis role="arg"><replaceable>sigma</replaceable></emphasis>)</synopsis>
<blockquote><para>Equivalent to RV.NORMAL(0, <replaceable>sigma</replaceable>).
</para></blockquote></blockquote>
<synopsis><indexterm role="fn"><primary>PDF.NTAIL</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.NTAIL</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>sigma</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RV.NTAIL</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.NTAIL</function> (<emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>sigma</replaceable></emphasis>)</synopsis>
<blockquote><para>Normal tail distribution with lower limit <replaceable>a</replaceable> and standard
deviation <replaceable>sigma</replaceable>. This distribution is a PSPP extension.
Constraints: <replaceable>a</replaceable> > 0, <replaceable>x</replaceable> > <replaceable>a</replaceable>, 0 < <replaceable>p</replaceable> < 1.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>PDF.PARETO</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.PARETO</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>CDF.PARETO</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CDF.PARETO</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>IDF.PARETO</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>IDF.PARETO</function> (<emphasis role="arg"><replaceable>p</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RV.PARETO</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.PARETO</function> (<emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<blockquote><para>Pareto distribution with threshold parameter <replaceable>a</replaceable> and shape
parameter <replaceable>b</replaceable>. Constraints: <replaceable>a</replaceable> > 0, <replaceable>b</replaceable> > 0, <replaceable>x</replaceable> >=
<replaceable>a</replaceable>, 0 <= <replaceable>p</replaceable> < 1.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>PDF.RAYLEIGH</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.RAYLEIGH</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>sigma</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>CDF.RAYLEIGH</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CDF.RAYLEIGH</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>sigma</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>IDF.RAYLEIGH</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>IDF.RAYLEIGH</function> (<emphasis role="arg"><replaceable>p</replaceable></emphasis>, <emphasis role="arg"><replaceable>sigma</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RV.RAYLEIGH</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.RAYLEIGH</function> (<emphasis role="arg"><replaceable>sigma</replaceable></emphasis>)</synopsis>
<blockquote><para>Rayleigh distribution with scale parameter <replaceable>sigma</replaceable>. This
distribution is a PSPP extension. Constraints: <replaceable>sigma</replaceable> > 0,
<replaceable>x</replaceable> > 0.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>PDF.RTAIL</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.RTAIL</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>sigma</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RV.RTAIL</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.RTAIL</function> (<emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>sigma</replaceable></emphasis>)</synopsis>
<blockquote><para>Rayleigh tail distribution with lower limit <replaceable>a</replaceable> and scale
parameter <replaceable>sigma</replaceable>. This distribution is a PSPP extension.
Constraints: <replaceable>a</replaceable> > 0, <replaceable>sigma</replaceable> > 0, <replaceable>x</replaceable> > <replaceable>a</replaceable>.
</para></blockquote>
<!-- @deftypefn {Function} {} CDF.SMOD (@var{x}, @var{a}, @var{b}) -->
<!-- @deftypefnx {Function} {} IDF.SMOD (@var{p}, @var{a}, @var{b}) -->
<!-- Studentized maximum modulus distribution with parameters @var{a} and -->
<!-- @var{b}. Constraints: @var{a} > 0, @var{b} > 0, @var{x} > 0, 0 <= -->
<!-- @var{p} < 1. -->
<!-- @end deftypefn -->
<!-- @deftypefn {Function} {} CDF.SRANGE (@var{x}, @var{a}, @var{b}) -->
<!-- @deftypefnx {Function} {} IDF.SRANGE (@var{p}, @var{a}, @var{b}) -->
<!-- Studentized range distribution with parameters @var{a} and @var{b}. -->
<!-- Constraints: @var{a} >= 1, @var{b} >= 1, @var{x} > 0, 0 <= @var{p} < -->
<!-- 1. -->
<!-- @end deftypefn -->
<synopsis><indexterm role="fn"><primary>PDF.T</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.T</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>df</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>CDF.T</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CDF.T</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>df</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>IDF.T</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>IDF.T</function> (<emphasis role="arg"><replaceable>p</replaceable></emphasis>, <emphasis role="arg"><replaceable>df</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RV.T</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.T</function> (<emphasis role="arg"><replaceable>df</replaceable></emphasis>)</synopsis>
<blockquote><!-- @deftypefnx {Function} {} NPDF.T (@var{x}, @var{df}, @var{lambda}) -->
<!-- @deftypefnx {Function} {} NCDF.T (@var{x}, @var{df}, @var{lambda}) -->
<para>T-distribution with <replaceable>df</replaceable> degrees of freedom. The noncentral
distribution takes an additional parameter <replaceable>lambda</replaceable>. Constraints:
<replaceable>df</replaceable> > 0, 0 < <replaceable>p</replaceable> < 1.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>PDF.T1G</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.T1G</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>CDF.T1G</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CDF.T1G</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>IDF.T1G</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>IDF.T1G</function> (<emphasis role="arg"><replaceable>p</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<blockquote><para>Type-1 Gumbel distribution with parameters <replaceable>a</replaceable> and <replaceable>b</replaceable>. This
distribution is a PSPP extension. Constraints: 0 < <replaceable>p</replaceable> < 1.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>PDF.T2G</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.T2G</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>CDF.T2G</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CDF.T2G</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>IDF.T2G</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>IDF.T2G</function> (<emphasis role="arg"><replaceable>p</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<blockquote><para>Type-2 Gumbel distribution with parameters <replaceable>a</replaceable> and <replaceable>b</replaceable>. This
distribution is a PSPP extension. Constraints: <replaceable>x</replaceable> > 0, 0 <
<replaceable>p</replaceable> < 1.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>PDF.UNIFORM</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.UNIFORM</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>CDF.UNIFORM</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CDF.UNIFORM</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>IDF.UNIFORM</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>IDF.UNIFORM</function> (<emphasis role="arg"><replaceable>p</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RV.UNIFORM</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.UNIFORM</function> (<emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<blockquote><para>Uniform distribution with parameters <replaceable>a</replaceable> and <replaceable>b</replaceable>.
Constraints: <replaceable>a</replaceable> <= <replaceable>x</replaceable> <= <replaceable>b</replaceable>, 0 <= <replaceable>p</replaceable> <= 1. An
additional function is available as shorthand:
</para>
<synopsis><indexterm role="fn"><primary>UNIFORM</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>UNIFORM</function> (<emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<blockquote><para>Equivalent to RV.UNIFORM(0, <replaceable>b</replaceable>).
</para></blockquote></blockquote>
<synopsis><indexterm role="fn"><primary>PDF.WEIBULL</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.WEIBULL</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>CDF.WEIBULL</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CDF.WEIBULL</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>IDF.WEIBULL</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>IDF.WEIBULL</function> (<emphasis role="arg"><replaceable>p</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RV.WEIBULL</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.WEIBULL</function> (<emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>)</synopsis>
<blockquote><para>Weibull distribution with parameters <replaceable>a</replaceable> and <replaceable>b</replaceable>.
Constraints: <replaceable>a</replaceable> > 0, <replaceable>b</replaceable> > 0, <replaceable>x</replaceable> >= 0, 0 <= <replaceable>p</replaceable> < 1.
</para></blockquote>
</sect3>
<sect3 label="7.7.10.2" id="Discrete-Distributions">
<title>Discrete Distributions</title>
<para>The following discrete distributions are available:
</para>
<synopsis><indexterm role="fn"><primary>PDF.BERNOULLI</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.BERNOULLI</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>CDF.BERNOULLI</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CDF.BERNOULLI</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>p</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RV.BERNOULLI</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.BERNOULLI</function> (<emphasis role="arg"><replaceable>p</replaceable></emphasis>)</synopsis>
<blockquote><para>Bernoulli distribution with probability of success <replaceable>p</replaceable>.
Constraints: <replaceable>x</replaceable> = 0 or 1, 0 <= <replaceable>p</replaceable> <= 1.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>PDF.BINOM</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.BINOM</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>n</replaceable></emphasis>, <emphasis role="arg"><replaceable>p</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>CDF.BINOM</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CDF.BINOM</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>n</replaceable></emphasis>, <emphasis role="arg"><replaceable>p</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RV.BINOM</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.BINOM</function> (<emphasis role="arg"><replaceable>n</replaceable></emphasis>, <emphasis role="arg"><replaceable>p</replaceable></emphasis>)</synopsis>
<blockquote><para>Binomial distribution with <replaceable>n</replaceable> trials and probability of success
<replaceable>p</replaceable>. Constraints: integer <replaceable>n</replaceable> > 0, 0 <= <replaceable>p</replaceable> <= 1, integer
<replaceable>x</replaceable> <= <replaceable>n</replaceable>.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>PDF.GEOM</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.GEOM</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>n</replaceable></emphasis>, <emphasis role="arg"><replaceable>p</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>CDF.GEOM</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CDF.GEOM</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>n</replaceable></emphasis>, <emphasis role="arg"><replaceable>p</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RV.GEOM</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.GEOM</function> (<emphasis role="arg"><replaceable>n</replaceable></emphasis>, <emphasis role="arg"><replaceable>p</replaceable></emphasis>)</synopsis>
<blockquote><para>Geometric distribution with probability of success <replaceable>p</replaceable>.
Constraints: 0 <= <replaceable>p</replaceable> <= 1, integer <replaceable>x</replaceable> > 0.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>PDF.HYPER</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.HYPER</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>, <emphasis role="arg"><replaceable>c</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>CDF.HYPER</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CDF.HYPER</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>, <emphasis role="arg"><replaceable>c</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RV.HYPER</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.HYPER</function> (<emphasis role="arg"><replaceable>a</replaceable></emphasis>, <emphasis role="arg"><replaceable>b</replaceable></emphasis>, <emphasis role="arg"><replaceable>c</replaceable></emphasis>)</synopsis>
<blockquote><para>Hypergeometric distribution when <replaceable>b</replaceable> objects out of <replaceable>a</replaceable> are
drawn and <replaceable>c</replaceable> of the available objects are distinctive.
Constraints: integer <replaceable>a</replaceable> > 0, integer <replaceable>b</replaceable> <= <replaceable>a</replaceable>, integer
<replaceable>c</replaceable> <= <replaceable>a</replaceable>, integer <replaceable>x</replaceable> >= 0.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>PDF.LOG</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.LOG</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>p</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RV.LOG</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.LOG</function> (<emphasis role="arg"><replaceable>p</replaceable></emphasis>)</synopsis>
<blockquote><para>Logarithmic distribution with probability parameter <replaceable>p</replaceable>.
Constraints: 0 <= <replaceable>p</replaceable> < 1, <replaceable>x</replaceable> >= 1.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>PDF.NEGBIN</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.NEGBIN</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>n</replaceable></emphasis>, <emphasis role="arg"><replaceable>p</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>CDF.NEGBIN</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CDF.NEGBIN</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>n</replaceable></emphasis>, <emphasis role="arg"><replaceable>p</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RV.NEGBIN</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.NEGBIN</function> (<emphasis role="arg"><replaceable>n</replaceable></emphasis>, <emphasis role="arg"><replaceable>p</replaceable></emphasis>)</synopsis>
<blockquote><para>Negative binomial distribution with number of successes parameter
<replaceable>n</replaceable> and probability of success parameter <replaceable>p</replaceable>. Constraints:
integer <replaceable>n</replaceable> >= 0, 0 < <replaceable>p</replaceable> <= 1, integer <replaceable>x</replaceable> >= 1.
</para></blockquote>
<synopsis><indexterm role="fn"><primary>PDF.POISSON</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>PDF.POISSON</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>mu</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>CDF.POISSON</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>CDF.POISSON</function> (<emphasis role="arg"><replaceable>x</replaceable></emphasis>, <emphasis role="arg"><replaceable>mu</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RV.POISSON</primary></indexterm><phrase role="category"><emphasis role="bold">Function</emphasis>:</phrase> <returnvalue></returnvalue> <function>RV.POISSON</function> (<emphasis role="arg"><replaceable>mu</replaceable></emphasis>)</synopsis>
<blockquote><para>Poisson distribution with mean <replaceable>mu</replaceable>. Constraints: <replaceable>mu</replaceable> > 0,
integer <replaceable>x</replaceable> >= 0.
</para></blockquote>
</sect3>
</sect2>
</sect1>
<sect1 label="7.8" id="Order-of-Operations">
<title>Operator Precedence</title>
<indexterm role="cp"><primary>operator precedence</primary></indexterm>
<indexterm role="cp"><primary>precedence, operator</primary></indexterm>
<indexterm role="cp"><primary>order of operations</primary></indexterm>
<indexterm role="cp"><primary>operations, order of</primary></indexterm>
<para>The following table describes operator precedence. Smaller-numbered
levels in the table have higher precedence. Within a level,
operations are always performed from left to right. The first
occurrence of ‘<literal>-</literal>’ represents unary negation, the second binary
subtraction.
</para>
<orderedlist numeration="arabic"><listitem><para><literal>()</literal>
</para></listitem><listitem><para><literal>**</literal>
</para></listitem><listitem><para><literal>-</literal>
</para></listitem><listitem><para><literal>* /</literal>
</para></listitem><listitem><para><literal>+ -</literal>
</para></listitem><listitem><para><literal>= >= > <= < <></literal>
</para></listitem><listitem><para><literal>NOT</literal>
</para></listitem><listitem><para><literal>AND</literal>
</para></listitem><listitem><para><literal>OR</literal>
</para></listitem></orderedlist><!-- PSPP - a program for statistical analysis. -->
<!-- Copyright (C) 2017, 2020 Free Software Foundation, Inc. -->
<!-- Permission is granted to copy, distribute and/or modify this document -->
<!-- under the terms of the GNU Free Documentation License, Version 1.3 -->
<!-- or any later version published by the Free Software Foundation; -->
<!-- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -->
<!-- A copy of the license is included in the section entitled "GNU -->
<!-- Free Documentation License". -->
<!-- -->
<!-- (modify-syntax-entry ?_ "w") -->
<!-- (modify-syntax-entry ?' "'") -->
<!-- (modify-syntax-entry ?@ "'") -->
</sect1>
</chapter>
<chapter label="8" id="Data-Input-and-Output">
<title>Data Input and Output</title>
<indexterm role="cp"><primary>input</primary></indexterm>
<indexterm role="cp"><primary>output</primary></indexterm>
<indexterm role="cp"><primary>data</primary></indexterm>
<indexterm role="cp"><primary>cases</primary></indexterm>
<indexterm role="cp"><primary>observations</primary></indexterm>
<para>Data are the focus of the PSPP language.
Each datum belongs to a <firstterm>case</firstterm> (also called an <firstterm>observation</firstterm>).
Each case represents an individual or “experimental unit”.
For example, in the results of a survey, the names of the respondents,
their sex, age, etc. and their responses are all data and the data
pertaining to single respondent is a case.
This chapter examines
the PSPP commands for defining variables and reading and writing data.
There are alternative commands to read data from predefined sources
such as system files or databases (See <link linkend="GET">GET DATA</link>.)
</para>
<note><para>These commands tell PSPP how to read data, but the data will not
actually be read until a procedure is executed.
</para></note>
<sect1 label="8.1" id="BEGIN-DATA">
<title>BEGIN DATA</title>
<indexterm role="vr"><primary>BEGIN DATA</primary></indexterm>
<indexterm role="vr"><primary>END DATA</primary></indexterm>
<indexterm role="cp"><primary>Embedding data in syntax files</primary></indexterm>
<indexterm role="cp"><primary>Data, embedding in syntax files</primary></indexterm>
<literallayout>BEGIN DATA.
…
END DATA.
</literallayout>
<para><literal>BEGIN DATA</literal> and <literal>END DATA</literal> can be used to embed raw ASCII
data in a PSPP syntax file. <literal>DATA LIST</literal> or another input
procedure must be used before <literal>BEGIN DATA</literal> (see <link linkend="DATA-LIST">DATA LIST</link>).
<literal>BEGIN DATA</literal> and <literal>END DATA</literal> must be used together. <literal>END
DATA</literal> must appear by itself on a single line, with no leading
white space and exactly one space between the words <literal>END</literal> and
<literal>DATA</literal>, like this:
</para>
<screen>END DATA.
</screen>
</sect1>
<sect1 label="8.2" id="CLOSE-FILE-HANDLE">
<title>CLOSE FILE HANDLE</title>
<literallayout>CLOSE FILE HANDLE <replaceable>handle_name</replaceable>.
</literallayout>
<para><literal>CLOSE FILE HANDLE</literal> disassociates the name of a file handle with a
given file. The only specification is the name of the handle to close.
Afterward
<literal>FILE HANDLE</literal>.
</para>
<para>The file named INLINE, which represents data entered between <literal>BEGIN
DATA</literal> and <literal>END DATA</literal>, cannot be closed. Attempts to close it with
<literal>CLOSE FILE HANDLE</literal> have no effect.
</para>
<para><literal>CLOSE FILE HANDLE</literal> is a PSPP extension.
</para>
</sect1>
<sect1 label="8.3" id="DATAFILE-ATTRIBUTE">
<title>DATAFILE ATTRIBUTE</title>
<indexterm role="vr"><primary>DATAFILE ATTRIBUTE</primary></indexterm>
<literallayout>DATAFILE ATTRIBUTE
ATTRIBUTE=<replaceable>name</replaceable>(’<replaceable>value</replaceable>’) [<replaceable>name</replaceable>(’<replaceable>value</replaceable>’)]…
ATTRIBUTE=<replaceable>name</replaceable><emphasis role="bold">[</emphasis><replaceable>index</replaceable><emphasis role="bold">]</emphasis>(’<replaceable>value</replaceable>’) [<replaceable>name</replaceable><emphasis role="bold">[</emphasis><replaceable>index</replaceable><emphasis role="bold">]</emphasis>(’<replaceable>value</replaceable>’)]…
DELETE=<replaceable>name</replaceable> [<replaceable>name</replaceable>]…
DELETE=<replaceable>name</replaceable><emphasis role="bold">[</emphasis><replaceable>index</replaceable><emphasis role="bold">]</emphasis> [<replaceable>name</replaceable><emphasis role="bold">[</emphasis><replaceable>index</replaceable><emphasis role="bold">]</emphasis>]…
</literallayout>
<para><literal>DATAFILE ATTRIBUTE</literal> adds, modifies, or removes user-defined
attributes associated with the active dataset. Custom data file
attributes are not interpreted by PSPP, but they are saved as part of
system files and may be used by other software that reads them.
</para>
<para>Use the <literal>ATTRIBUTE</literal> subcommand to add or modify a custom data file
attribute. Specify the name of the attribute as an identifier
(see <link linkend="Tokens">Tokens</link>), followed by the desired value, in parentheses, as a
quoted string. Attribute names that begin with <literal>$</literal> are reserved
for PSPP’s internal use, and attribute names that begin with <literal>@</literal>
or <literal>$@</literal> are not displayed by most PSPP commands that display
other attributes. Other attribute names are not treated specially.
</para>
<para>Attributes may also be organized into arrays. To assign to an array
element, add an integer array index enclosed in square brackets
(<literal>[</literal> and <literal>]</literal>) between the attribute name and value. Array
indexes start at 1, not 0. An attribute array that has a single
element (number 1) is not distinguished from a non-array attribute.
</para>
<para>Use the <literal>DELETE</literal> subcommand to delete an attribute. Specify an
attribute name by itself to delete an entire attribute, including all
array elements for attribute arrays. Specify an attribute name
followed by an array index in square brackets to delete a single
element of an attribute array. In the latter case, all the array
elements numbered higher than the deleted element are shifted down,
filling the vacated position.
</para>
<para>To associate custom attributes with particular variables, instead of
with the entire active dataset, use <literal>VARIABLE ATTRIBUTE</literal>
(see <link linkend="VARIABLE-ATTRIBUTE">VARIABLE ATTRIBUTE</link>) instead.
</para>
<para><literal>DATAFILE ATTRIBUTE</literal> takes effect immediately. It is not affected
by conditional and looping structures such as <literal>DO IF</literal> or
<literal>LOOP</literal>.
</para>
</sect1>
<sect1 label="8.4" id="DATASET">
<title>DATASET commands</title>
<indexterm role="vr"><primary>DATASET</primary></indexterm>
<literallayout>DATASET NAME <replaceable>name</replaceable> [WINDOW={ASIS,FRONT}].
DATASET ACTIVATE <replaceable>name</replaceable> [WINDOW={ASIS,FRONT}].
DATASET COPY <replaceable>name</replaceable> [WINDOW={MINIMIZED,HIDDEN,FRONT}].
DATASET DECLARE <replaceable>name</replaceable> [WINDOW={MINIMIZED,HIDDEN,FRONT}].
DATASET CLOSE {<replaceable>name</replaceable>,*,ALL}.
DATASET DISPLAY.
</literallayout>
<para>The <literal>DATASET</literal> commands simplify use of multiple datasets within a
PSPP session. They allow datasets to be created and destroyed. At
any given time, most PSPP commands work with a single dataset, called
the active dataset.
</para>
<indexterm role="vr"><primary>DATASET NAME</primary></indexterm>
<para>The DATASET NAME command gives the active dataset the specified name, or
if it already had a name, it renames it. If another dataset already
had the given name, that dataset is deleted.
</para>
<indexterm role="vr"><primary>DATASET ACTIVATE</primary></indexterm>
<para>The DATASET ACTIVATE command selects the named dataset, which must
already exist, as the active dataset. Before switching the active
dataset, any pending transformations are executed, as if <literal>EXECUTE</literal>
had been specified. If the active dataset is unnamed before
switching, then it is deleted and becomes unavailable after switching.
</para>
<indexterm role="vr"><primary>DATASET COPY</primary></indexterm>
<para>The DATASET COPY command creates a new dataset with the specified
name, whose contents are a copy of the active dataset. Any pending
transformations are executed, as if <literal>EXECUTE</literal> had been specified,
before making the copy. If a dataset with the given name already
exists, it is replaced. If the name is the name of the active
dataset, then the active dataset becomes unnamed.
</para>
<indexterm role="vr"><primary>DATASET DECLARE</primary></indexterm>
<para>The DATASET DECLARE command creates a new dataset that is initially
“empty,” that is, it has no dictionary or data. If a dataset with
the given name already exists, this has no effect. The new dataset
can be used with commands that support output to a dataset,
<emphasis>e.g.</emphasis> AGGREGATE (see <link linkend="AGGREGATE">AGGREGATE</link>).
</para>
<indexterm role="vr"><primary>DATASET CLOSE</primary></indexterm>
<para>The DATASET CLOSE command deletes a dataset. If the active dataset is
specified by name, or if ‘<literal>*</literal>’ is specified, then the active
dataset becomes unnamed. If a different dataset is specified by name,
then it is deleted and becomes unavailable. Specifying ALL deletes
all datasets except for the active dataset, which becomes unnamed.
</para>
<indexterm role="vr"><primary>DATASET DISPLAY</primary></indexterm>
<para>The DATASET DISPLAY command lists all the currently defined datasets.
</para>
<para>Many DATASET commands accept an optional <literal>WINDOW</literal> subcommand. In the
PSPPIRE GUI, the value given for this subcommand influences how the
dataset’s window is displayed. Outside the GUI, the <literal>WINDOW</literal> subcommand
has no effect. The valid values are:
</para>
<variablelist><varlistentry><term>ASIS
</term><listitem><para>Do not change how the window is displayed. This is the default for
DATASET NAME and DATASET ACTIVATE.
</para>
</listitem></varlistentry><varlistentry><term>FRONT
</term><listitem><para>Raise the dataset’s window to the top. Make it the default dataset
for running syntax.
</para>
</listitem></varlistentry><varlistentry><term>MINIMIZED
</term><listitem><para>Display the window “minimized” to an icon. Prefer other datasets
for running syntax. This is the default for DATASET COPY and DATASET
DECLARE.
</para>
</listitem></varlistentry><varlistentry><term>HIDDEN
</term><listitem><para>Hide the dataset’s window. Prefer other datasets for running syntax.
</para></listitem></varlistentry></variablelist>
</sect1>
<sect1 label="8.5" id="DATA-LIST">
<title>DATA LIST</title>
<indexterm role="vr"><primary>DATA LIST</primary></indexterm>
<indexterm role="cp"><primary>reading data from a file</primary></indexterm>
<indexterm role="cp"><primary>data, reading from a file</primary></indexterm>
<indexterm role="cp"><primary>data, embedding in syntax files</primary></indexterm>
<indexterm role="cp"><primary>embedding data in syntax files</primary></indexterm>
<para>Used to read text or binary data, <literal>DATA LIST</literal> is the most
fundamental data-reading command. Even the more sophisticated input
methods use <literal>DATA LIST</literal> commands as a building block.
Understanding <literal>DATA LIST</literal> is important to understanding how to use
PSPP to read your data files.
</para>
<para>There are two major variants of <literal>DATA LIST</literal>, which are fixed
format and free format. In addition, free format has a minor variant,
list format, which is discussed in terms of its differences from vanilla
free format.
</para>
<para>Each form of <literal>DATA LIST</literal> is described in detail below.
</para>
<para>See <link linkend="GET-DATA">GET DATA</link>, for a command that offers a few enhancements over
DATA LIST and that may be substituted for DATA LIST in many
situations.
</para>
<sect2 label="8.5.1" id="DATA-LIST-FIXED">
<title>DATA LIST FIXED</title>
<indexterm role="vr"><primary>DATA LIST FIXED</primary></indexterm>
<indexterm role="cp"><primary>reading fixed-format data</primary></indexterm>
<indexterm role="cp"><primary>fixed-format data, reading</primary></indexterm>
<indexterm role="cp"><primary>data, fixed-format, reading</primary></indexterm>
<indexterm role="cp"><primary>embedding fixed-format data</primary></indexterm>
<literallayout>DATA LIST [FIXED]
{TABLE,NOTABLE}
[FILE=’<replaceable>file_name</replaceable>’ [ENCODING=’<replaceable>encoding</replaceable>’]]
[RECORDS=<replaceable>record_count</replaceable>]
[END=<replaceable>end_var</replaceable>]
[SKIP=<replaceable>record_count</replaceable>]
/[line_no] <replaceable>var_spec</replaceable>…
where each <replaceable>var_spec</replaceable> takes one of the forms
<replaceable>var_list</replaceable> <replaceable>start</replaceable>-<replaceable>end</replaceable> [<replaceable>type_spec</replaceable>]
<replaceable>var_list</replaceable> (<replaceable>fortran_spec</replaceable>)
</literallayout>
<para><literal>DATA LIST FIXED</literal> is used to read data files that have values at fixed
positions on each line of single-line or multiline records. The
keyword FIXED is optional.
</para>
<para>The <literal>FILE</literal> subcommand must be used if input is to be taken from an
external file. It may be used to specify a file name as a string or a
file handle (see <link linkend="File-Handles">File Handles</link>). If the <literal>FILE</literal> subcommand is not used,
then input is assumed to be specified within the command file using
<literal>BEGIN DATA</literal>…<literal>END DATA</literal> (see <link linkend="BEGIN-DATA">BEGIN DATA</link>).
The <literal>ENCODING</literal> subcommand may only be used if the <literal>FILE</literal>
subcommand is also used. It specifies the character encoding of the
file. See <link linkend="INSERT">INSERT</link>, for information on supported encodings.
</para>
<para>The optional <literal>RECORDS</literal> subcommand, which takes a single integer as an
argument, is used to specify the number of lines per record.
If <literal>RECORDS</literal>
is not specified, then the number of lines per record is calculated from
the list of variable specifications later in <literal>DATA LIST</literal>.
</para>
<para>The <literal>END</literal> subcommand is only useful in conjunction with <literal>INPUT
PROGRAM</literal>. See <link linkend="INPUT-PROGRAM">INPUT PROGRAM</link>, for details.
</para>
<para>The optional <literal>SKIP</literal> subcommand specifies a number of records to skip at
the beginning of an input file. It can be used to skip over a row
that contains variable names, for example.
</para>
<para><literal>DATA LIST</literal> can optionally output a table describing how the data file
is read. The <literal>TABLE</literal> subcommand enables this output, and
<literal>NOTABLE</literal> disables it. The default is to output the table.
</para>
<para>The list of variables to be read from the data list must come last.
Each line in the data record is introduced by a slash (‘<literal>/</literal>’).
Optionally, a line number may follow the slash. Following, any number
of variable specifications may be present.
</para>
<para>Each variable specification consists of a list of variable names
followed by a description of their location on the input line. Sets of
variables may be specified using the <literal>DATA LIST</literal> <literal>TO</literal> convention
(see <link linkend="Sets-of-Variables">Sets of
Variables</link>). There are two ways to specify the location of the variable
on the line: columnar style and FORTRAN style.
</para>
<para>In columnar style, the starting column and ending column for the field
are specified after the variable name, separated by a dash (‘<literal>-</literal>’).
For instance, the third through fifth columns on a line would be
specified ‘<literal>3-5</literal>’. By default, variables are considered to be in
‘<literal>F</literal>’ format (see <link linkend="Input-and-Output-Formats">Input and Output Formats</link>). (This default can be
changed; see <link linkend="SET">SET</link> for more information.)
</para>
<para>In columnar style, to use a variable format other than the default,
specify the format type in parentheses after the column numbers. For
instance, for alphanumeric ‘<literal>A</literal>’ format, use ‘<literal>(A)</literal>’.
</para>
<para>In addition, implied decimal places can be specified in parentheses
after the column numbers. As an example, suppose that a data file has a
field in which the characters ‘<literal>1234</literal>’ should be interpreted as
having the value 12.34. Then this field has two implied decimal places,
and the corresponding specification would be ‘<literal>(2)</literal>’. If a field
that has implied decimal places contains a decimal point, then the
implied decimal places are not applied.
</para>
<para>Changing the variable format and adding implied decimal places can be
done together; for instance, ‘<literal>(N,5)</literal>’.
</para>
<para>When using columnar style, the input and output width of each variable is
computed from the field width. The field width must be evenly divisible
into the number of variables specified.
</para>
<para>FORTRAN style is an altogether different approach to specifying field
locations. With this approach, a list of variable input format
specifications, separated by commas, are placed after the variable names
inside parentheses. Each format specifier advances as many characters
into the input line as it uses.
</para>
<para>Implied decimal places also exist in FORTRAN style. A format
specification with <replaceable>d</replaceable> decimal places also has <replaceable>d</replaceable> implied
decimal places.
</para>
<para>In addition to the standard format specifiers (see <link linkend="Input-and-Output-Formats">Input and Output
Formats</link>), FORTRAN style defines some extensions:
</para>
<variablelist><varlistentry><term><literal>X</literal>
</term><listitem><para>Advance the current column on this line by one character position.
</para>
</listitem></varlistentry><varlistentry><term><literal>T</literal><replaceable>x</replaceable>
</term><listitem><para>Set the current column on this line to column <replaceable>x</replaceable>, with column
numbers considered to begin with 1 at the left margin.
</para>
</listitem></varlistentry><varlistentry><term><literal>NEWREC</literal><replaceable>x</replaceable>
</term><listitem><para>Skip forward <replaceable>x</replaceable> lines in the current record, resetting the active
column to the left margin.
</para>
</listitem></varlistentry><varlistentry><term>Repeat count
</term><listitem><para>Any format specifier may be preceded by a number. This causes the
action of that format specifier to be repeated the specified number of
times.
</para>
</listitem></varlistentry><varlistentry><term>(<replaceable>spec1</replaceable>, …, <replaceable>specN</replaceable>)
</term><listitem><para>Group the given specifiers together. This is most useful when preceded
by a repeat count. Groups may be nested arbitrarily.
</para></listitem></varlistentry></variablelist>
<para>FORTRAN and columnar styles may be freely intermixed. Columnar style
leaves the active column immediately after the ending column
specified. Record motion using <literal>NEWREC</literal> in FORTRAN style also
applies to later FORTRAN and columnar specifiers.
</para>
<sect3 label="" id="DATA-LIST-FIXED-Examples">
<title>Examples</title>
<orderedlist numeration="arabic"><listitem><!-- Update the corresponding test in tests/language/commands/data-list.at if you change this. -->
<screen>DATA LIST TABLE /NAME 1-10 (A) INFO1 TO INFO3 12-17 (1).
BEGIN DATA.
John Smith 102311
Bob Arnold 122015
Bill Yates 918 6
END DATA.
</screen>
<para>Defines the following variables:
</para>
<itemizedlist><listitem><para><literal>NAME</literal>, a 10-character-wide string variable, in columns 1
through 10.
</para>
</listitem><listitem><para><literal>INFO1</literal>, a numeric variable, in columns 12 through 13.
</para>
</listitem><listitem><para><literal>INFO2</literal>, a numeric variable, in columns 14 through 15.
</para>
</listitem><listitem><para><literal>INFO3</literal>, a numeric variable, in columns 16 through 17.
</para></listitem></itemizedlist>
<para>The <literal>BEGIN DATA</literal>/<literal>END DATA</literal> commands cause three cases to be
defined:
</para>
<screen>Case NAME INFO1 INFO2 INFO3
1 John Smith 10 23 11
2 Bob Arnold 12 20 15
3 Bill Yates 9 18 6
</screen>
<para>The <literal>TABLE</literal> keyword causes PSPP to print out a table
describing the four variables defined.
</para>
</listitem><listitem><!-- Update the corresponding test in tests/language/commands/data-list.at if you change this. -->
<screen>DATA LIST FILE="survey.dat"
/ID 1-5 NAME 7-36 (A) SURNAME 38-67 (A) MINITIAL 69 (A)
/Q01 TO Q50 7-56
/.
</screen>
<para>Defines the following variables:
</para>
<itemizedlist><listitem><para><literal>ID</literal>, a numeric variable, in columns 1-5 of the first record.
</para>
</listitem><listitem><para><literal>NAME</literal>, a 30-character string variable, in columns 7-36 of the
first record.
</para>
</listitem><listitem><para><literal>SURNAME</literal>, a 30-character string variable, in columns 38-67 of
the first record.
</para>
</listitem><listitem><para><literal>MINITIAL</literal>, a 1-character string variable, in column 69 of
the first record.
</para>
</listitem><listitem><para>Fifty variables <literal>Q01</literal>, <literal>Q02</literal>, <literal>Q03</literal>, …, <literal>Q49</literal>,
<literal>Q50</literal>, all numeric, <literal>Q01</literal> in column 7, <literal>Q02</literal> in column 8,
…, <literal>Q49</literal> in column 55, <literal>Q50</literal> in column 56, all in the second
record.
</para></listitem></itemizedlist>
<para>Cases are separated by a blank record.
</para>
<para>Data is read from file <filename>survey.dat</filename> in the current directory.
</para></listitem></orderedlist>
</sect3>
</sect2>
<sect2 label="8.5.2" id="DATA-LIST-FREE">
<title>DATA LIST FREE</title>
<indexterm role="vr"><primary>DATA LIST FREE</primary></indexterm>
<literallayout>DATA LIST FREE
[({TAB,’<replaceable>c</replaceable>’}, …)]
[{NOTABLE,TABLE}]
[FILE=’<replaceable>file_name</replaceable>’ [ENCODING=’<replaceable>encoding</replaceable>’]]
[SKIP=<replaceable>n_records</replaceable>]
/<replaceable>var_spec</replaceable>…
where each <replaceable>var_spec</replaceable> takes one of the forms
<replaceable>var_list</replaceable> [(<replaceable>type_spec</replaceable>)]
<replaceable>var_list</replaceable> *
</literallayout>
<para>In free format, the input data is, by default, structured as a series
of fields separated by spaces, tabs, or line breaks.
If the current <literal>DECIMAL</literal> separator is <literal>DOT</literal> (see <link linkend="SET">SET</link>),
then commas are also treated as field separators.
Each
field’s content may be unquoted, or it may be quoted with a pairs of
apostrophes (‘<literal>'</literal>’) or double quotes (‘<literal>"</literal>’). Unquoted white
space separates fields but is not part of any field. Any mix of
spaces, tabs, and line breaks is equivalent to a single space for the
purpose of separating fields, but consecutive commas will skip a
field.
</para>
<para>Alternatively, delimiters can be specified explicitly, as a
parenthesized, comma-separated list of single-character strings
immediately following FREE. The word TAB may also be used to specify
a tab character as a delimiter. When delimiters are specified
explicitly, only the given characters, plus line breaks, separate
fields. Furthermore, leading spaces at the beginnings of fields are
not trimmed, consecutive delimiters define empty fields, and no form
of quoting is allowed.
</para>
<para>The <literal>NOTABLE</literal> and <literal>TABLE</literal> subcommands are as in <literal>DATA LIST FIXED</literal> above.
<literal>NOTABLE</literal> is the default.
</para>
<para>The <literal>FILE</literal>, <literal>SKIP</literal>, and <literal>ENCODING</literal> subcommands
are as in <literal>DATA LIST FIXED</literal> above.
</para>
<para>The variables to be parsed are given as a single list of variable names.
This list must be introduced by a single slash (‘<literal>/</literal>’). The set of
variable names may contain format specifications in parentheses
(see <link linkend="Input-and-Output-Formats">Input and Output Formats</link>). Format specifications apply to all
variables back to the previous parenthesized format specification.
</para>
<para>In addition, an asterisk may be used to indicate that all variables
preceding it are to have input/output format ‘<literal>F8.0</literal>’.
</para>
<para>Specified field widths are ignored on input, although all normal limits
on field width apply, but they are honored on output.
</para>
</sect2>
<sect2 label="8.5.3" id="DATA-LIST-LIST">
<title>DATA LIST LIST</title>
<indexterm role="vr"><primary>DATA LIST LIST</primary></indexterm>
<literallayout>DATA LIST LIST
[({TAB,’<replaceable>c</replaceable>’}, …)]
[{NOTABLE,TABLE}]
[FILE=’<replaceable>file_name</replaceable>’ [ENCODING=’<replaceable>encoding</replaceable>’]]
[SKIP=<replaceable>record_count</replaceable>]
/<replaceable>var_spec</replaceable>…
where each <replaceable>var_spec</replaceable> takes one of the forms
<replaceable>var_list</replaceable> [(<replaceable>type_spec</replaceable>)]
<replaceable>var_list</replaceable> *
</literallayout>
<para>With one exception, <literal>DATA LIST LIST</literal> is syntactically and
semantically equivalent to <literal>DATA LIST FREE</literal>. The exception is
that each input line is expected to correspond to exactly one input
record. If more or fewer fields are found on an input line than
expected, an appropriate diagnostic is issued.
</para>
</sect2>
</sect1>
<sect1 label="8.6" id="END-CASE">
<title>END CASE</title>
<indexterm role="vr"><primary>END CASE</primary></indexterm>
<literallayout>END CASE.
</literallayout>
<para><literal>END CASE</literal> is used only within <literal>INPUT PROGRAM</literal> to output the
current case. See <link linkend="INPUT-PROGRAM">INPUT PROGRAM</link>, for details.
</para>
</sect1>
<sect1 label="8.7" id="END-FILE">
<title>END FILE</title>
<indexterm role="vr"><primary>END FILE</primary></indexterm>
<literallayout>END FILE.
</literallayout>
<para><literal>END FILE</literal> is used only within <literal>INPUT PROGRAM</literal> to terminate
the current input program. See <link linkend="INPUT-PROGRAM">INPUT PROGRAM</link>.
</para>
</sect1>
<sect1 label="8.8" id="FILE-HANDLE">
<title>FILE HANDLE</title>
<indexterm role="vr"><primary>FILE HANDLE</primary></indexterm>
<literallayout>For text files:
FILE HANDLE <replaceable>handle_name</replaceable>
/NAME=’<replaceable>file_name</replaceable>
[/MODE=CHARACTER]
[/ENDS={CR,CRLF}]
/TABWIDTH=<replaceable>tab_width</replaceable>
[ENCODING=’<replaceable>encoding</replaceable>’]
For binary files in native encoding with fixed-length records:
FILE HANDLE <replaceable>handle_name</replaceable>
/NAME=’<replaceable>file_name</replaceable>’
/MODE=IMAGE
[/LRECL=<replaceable>rec_len</replaceable>]
[ENCODING=’<replaceable>encoding</replaceable>’]
For binary files in native encoding with variable-length records:
FILE HANDLE <replaceable>handle_name</replaceable>
/NAME=’<replaceable>file_name</replaceable>’
/MODE=BINARY
[/LRECL=<replaceable>rec_len</replaceable>]
[ENCODING=’<replaceable>encoding</replaceable>’]
For binary files encoded in EBCDIC:
FILE HANDLE <replaceable>handle_name</replaceable>
/NAME=’<replaceable>file_name</replaceable>’
/MODE=360
/RECFORM={FIXED,VARIABLE,SPANNED}
[/LRECL=<replaceable>rec_len</replaceable>]
[ENCODING=’<replaceable>encoding</replaceable>’]
</literallayout>
<para>Use <literal>FILE HANDLE</literal> to associate a file handle name with a file and
its attributes, so that later commands can refer to the file by its
handle name. Names of text files can be specified directly on
commands that access files, so that <literal>FILE HANDLE</literal> is only needed when a
file is not an ordinary file containing lines of text. However,
<literal>FILE HANDLE</literal> may be used even for text files, and it may be
easier to specify a file’s name once and later refer to it by an
abstract handle.
</para>
<para>Specify the file handle name as the identifier immediately following the
<literal>FILE HANDLE</literal> command name. The identifier INLINE is reserved for
representing data embedded in the syntax file (see <link linkend="BEGIN-DATA">BEGIN DATA</link>) The
file handle name must not already have been used in a previous
invocation of <literal>FILE HANDLE</literal>, unless it has been closed by an
intervening command (see <link linkend="CLOSE-FILE-HANDLE">CLOSE FILE HANDLE</link>).
</para>
<para>The effect and syntax of <literal>FILE HANDLE</literal> depends on the selected MODE:
</para>
<itemizedlist><listitem><para>In CHARACTER mode, the default, the data file is read as a text file.
Each text line is read as one record.
</para>
<para>In CHARACTER mode only, tabs are expanded to spaces by input programs,
except by <literal>DATA LIST FREE</literal> with explicitly specified delimiters.
Each tab is 4 characters wide by default, but TABWIDTH (a PSPP
extension) may be used to specify an alternate width. Use a TABWIDTH
of 0 to suppress tab expansion.
</para>
<para>A file written in CHARACTER mode by default uses the line ends of the
system on which PSPP is running, that is, on Windows, the default is
CR LF line ends, and on other systems the default is LF only. Specify
ENDS as CR or CRLF to override the default. PSPP reads files using
either convention on any kind of system, regardless of ENDS.
</para>
</listitem><listitem><para>In IMAGE mode, the data file is treated as a series of fixed-length
binary records. LRECL should be used to specify the record length in
bytes, with a default of 1024. On input, it is an error if an IMAGE
file’s length is not an integer multiple of the record length. On
output, each record is padded with spaces or truncated, if necessary,
to make it exactly the correct length.
</para>
</listitem><listitem><para>In BINARY mode, the data file is treated as a series of
variable-length binary records. LRECL may be specified, but its value
is ignored. The data for each record is both preceded and followed by
a 32-bit signed integer in little-endian byte order that specifies the
length of the record. (This redundancy permits records in these
files to be efficiently read in reverse order, although PSPP always
reads them in forward order.) The length does not include either
integer.
</para>
</listitem><listitem><para>Mode 360 reads and writes files in formats first used for tapes in the
1960s on IBM mainframe operating systems and still supported today by
the modern successors of those operating systems. For more
information, see <citetitle>OS/400 Tape and Diskette Device Programming</citetitle>,
available on IBM’s website.
</para>
<para>Alphanumeric data in mode 360 files are encoded in EBCDIC. PSPP
translates EBCDIC to or from the host’s native format as necessary on
input or output, using an ASCII/EBCDIC translation that is one-to-one,
so that a “round trip” from ASCII to EBCDIC back to ASCII, or vice
versa, always yields exactly the original data.
</para>
<para>The <literal>RECFORM</literal> subcommand is required in mode 360. The precise file
format depends on its setting:
</para>
<variablelist><varlistentry><term>F
</term><term>FIXED
</term><listitem><para>This record format is equivalent to IMAGE mode, except for EBCDIC
translation.
</para>
<para>IBM documentation calls this <literal>*F</literal> (fixed-length, deblocked)
format.
</para>
</listitem></varlistentry><varlistentry><term>V
</term><term>VARIABLE
</term><listitem><para>The file comprises a sequence of zero or more variable-length blocks.
Each block begins with a 4-byte <firstterm>block descriptor word</firstterm> (BDW).
The first two bytes of the BDW are an unsigned integer in big-endian
byte order that specifies the length of the block, including the BDW
itself. The other two bytes of the BDW are ignored on input and
written as zeros on output.
</para>
<para>Following the BDW, the remainder of each block is a sequence of one or
more variable-length records, each of which in turn begins with a
4-byte <firstterm>record descriptor word</firstterm> (RDW) that has the same format as
the BDW. Following the RDW, the remainder of each record is the
record data.
</para>
<para>The maximum length of a record in VARIABLE mode is 65,527 bytes:
65,535 bytes (the maximum value of a 16-bit unsigned integer), minus 4
bytes for the BDW, minus 4 bytes for the RDW.
</para>
<para>In mode VARIABLE, LRECL specifies a maximum, not a fixed, record
length, in bytes. The default is 8,192.
</para>
<para>IBM documentation calls this <literal>*VB</literal> (variable-length, blocked,
unspanned) format.
</para>
</listitem></varlistentry><varlistentry><term>VS
</term><term>SPANNED
</term><listitem><para>The file format is like that of VARIABLE mode, except that logical
records may be split among multiple physical records (called
<firstterm>segments</firstterm>) or blocks. In SPANNED mode, the third byte of each
RDW is called the segment control character (SCC). Odd SCC values
cause the segment to be appended to a record buffer maintained in
memory; even values also append the segment and then flush its
contents to the input procedure. Canonically, SCC value 0 designates
a record not spanned among multiple segments, and values 1 through 3
designate the first segment, the last segment, or an intermediate
segment, respectively, within a multi-segment record. The record
buffer is also flushed at end of file regardless of the final record’s
SCC.
</para>
<para>The maximum length of a logical record in VARIABLE mode is limited
only by memory available to PSPP. Segments are limited to 65,527
bytes, as in VARIABLE mode.
</para>
<para>This format is similar to what IBM documentation call <literal>*VS</literal>
(variable-length, deblocked, spanned) format.
</para></listitem></varlistentry></variablelist>
<para>In mode 360, fields of type A that extend beyond the end of a record
read from disk are padded with spaces in the host’s native character
set, which are then translated from EBCDIC to the native character
set. Thus, when the host’s native character set is based on ASCII,
these fields are effectively padded with character <literal>X'80'</literal>. This
wart is implemented for compatibility.
</para></listitem></itemizedlist>
<para>The <literal>NAME</literal> subcommand specifies the name of the file associated with the
handle. It is required in all modes but SCRATCH mode, in which its
use is forbidden.
</para>
<para>The ENCODING subcommand specifies the encoding of text in the file.
For reading text files in CHARACTER mode, all of the forms described
for ENCODING on the INSERT command are supported (see <link linkend="INSERT">INSERT</link>).
For reading in other file-based modes, encoding autodetection is not
supported; if the specified encoding requests autodetection then the
default encoding is used. This is also true when a file handle
is used for writing a file in any mode.
</para>
</sect1>
<sect1 label="8.9" id="INPUT-PROGRAM">
<title>INPUT PROGRAM</title>
<indexterm role="vr"><primary>INPUT PROGRAM</primary></indexterm>
<literallayout>INPUT PROGRAM.
… input commands …
END INPUT PROGRAM.
</literallayout>
<para><literal>INPUT PROGRAM</literal>…<literal>END INPUT PROGRAM</literal> specifies a
complex input program. By placing data input commands within <literal>INPUT
PROGRAM</literal>, PSPP programs can take advantage of more complex file
structures than available with only <literal>DATA LIST</literal>.
</para>
<para>The first sort of extended input program is to simply put multiple <literal>DATA
LIST</literal> commands within the <literal>INPUT PROGRAM</literal>. This will cause all of
the data
files to be read in parallel. Input will stop when end of file is
reached on any of the data files.
</para>
<para>Transformations, such as conditional and looping constructs, can also be
included within <literal>INPUT PROGRAM</literal>. These can be used to combine input
from several data files in more complex ways. However, input will still
stop when end of file is reached on any of the data files.
</para>
<para>To prevent <literal>INPUT PROGRAM</literal> from terminating at the first end of
file, use
the <literal>END</literal> subcommand on <literal>DATA LIST</literal>. This subcommand takes a
variable name,
which should be a numeric scratch variable (see <link linkend="Scratch-Variables">Scratch Variables</link>).
(It need not be a scratch variable but otherwise the results can be
surprising.) The value of this variable is set to 0 when reading the
data file, or 1 when end of file is encountered.
</para>
<para>Two additional commands are useful in conjunction with <literal>INPUT PROGRAM</literal>.
<literal>END CASE</literal> is the first. Normally each loop through the
<literal>INPUT PROGRAM</literal>
structure produces one case. <literal>END CASE</literal> controls exactly
when cases are output. When <literal>END CASE</literal> is used, looping from the end of
<literal>INPUT PROGRAM</literal> to the beginning does not cause a case to be output.
</para>
<para><literal>END FILE</literal> is the second. When the <literal>END</literal> subcommand is used on <literal>DATA
LIST</literal>, there is no way for the <literal>INPUT PROGRAM</literal> construct to stop
looping,
so an infinite loop results. <literal>END FILE</literal>, when executed,
stops the flow of input data and passes out of the <literal>INPUT PROGRAM</literal>
structure.
</para>
<para><literal>INPUT PROGRAM</literal> must contain at least one <literal>DATA LIST</literal> or
<literal>END FILE</literal> command.
</para>
<bridgehead renderas="sect2">Example 1: Read two files in parallel to the end of the shorter</bridgehead>
<para>The following example reads variable X from file <filename>a.txt</filename> and
variable Y from file <filename>b.txt</filename>. If one file is shorter than the
other then the extra data in the longer file is ignored.
</para>
<screen>INPUT PROGRAM.
DATA LIST NOTABLE FILE='a.txt'/X 1-10.
DATA LIST NOTABLE FILE='b.txt'/Y 1-10.
END INPUT PROGRAM.
LIST.
</screen>
<bridgehead renderas="sect2">Example 2: Read two files in parallel, supplementing the shorter</bridgehead>
<para>The following example also reads variable X from <filename>a.txt</filename> and
variable Y from <filename>b.txt</filename>. If one file is shorter than the other
then it continues reading the longer to its end, setting the other
variable to system-missing.
</para>
<screen>INPUT PROGRAM.
NUMERIC #A #B.
DO IF NOT #A.
DATA LIST NOTABLE END=#A FILE='a.txt'/X 1-10.
END IF.
DO IF NOT #B.
DATA LIST NOTABLE END=#B FILE='b.txt'/Y 1-10.
END IF.
DO IF #A AND #B.
END FILE.
END IF.
END CASE.
END INPUT PROGRAM.
LIST.
</screen>
<bridgehead renderas="sect2">Example 3: Concatenate two files (version 1)</bridgehead>
<para>The following example reads data from file <filename>a.txt</filename>, then from
<filename>b.txt</filename>, and concatenates them into a single active dataset.
</para>
<screen>INPUT PROGRAM.
NUMERIC #A #B.
DO IF #A.
DATA LIST NOTABLE END=#B FILE='b.txt'/X 1-10.
DO IF #B.
END FILE.
ELSE.
END CASE.
END IF.
ELSE.
DATA LIST NOTABLE END=#A FILE='a.txt'/X 1-10.
DO IF NOT #A.
END CASE.
END IF.
END IF.
END INPUT PROGRAM.
LIST.
</screen>
<bridgehead renderas="sect2">Example 4: Concatenate two files (version 2)</bridgehead>
<para>This is another way to do the same thing as Example 3.
</para>
<screen>INPUT PROGRAM.
NUMERIC #EOF.
LOOP IF NOT #EOF.
DATA LIST NOTABLE END=#EOF FILE='a.txt'/X 1-10.
DO IF NOT #EOF.
END CASE.
END IF.
END LOOP.
COMPUTE #EOF = 0.
LOOP IF NOT #EOF.
DATA LIST NOTABLE END=#EOF FILE='b.txt'/X 1-10.
DO IF NOT #EOF.
END CASE.
END IF.
END LOOP.
END FILE.
END INPUT PROGRAM.
LIST.
</screen>
<bridgehead renderas="sect2">Example 5: Generate random variates</bridgehead>
<para>The follows example creates a dataset that consists of 50 random
variates between 0 and 10.
</para>
<screen>INPUT PROGRAM.
LOOP #I=1 TO 50.
COMPUTE X=UNIFORM(10).
END CASE.
END LOOP.
END FILE.
END INPUT PROGRAM.
LIST /FORMAT=NUMBERED.
</screen>
</sect1>
<sect1 label="8.10" id="LIST">
<title>LIST</title>
<indexterm role="vr"><primary>LIST</primary></indexterm>
<literallayout>LIST
/VARIABLES=<replaceable>var_list</replaceable>
/CASES=FROM <replaceable>start_index</replaceable> TO <replaceable>end_index</replaceable> BY <replaceable>incr_index</replaceable>
/FORMAT={UNNUMBERED,NUMBERED} {WRAP,SINGLE}
</literallayout>
<para>The <literal>LIST</literal> procedure prints the values of specified variables to the
listing file.
</para>
<para>The <literal>VARIABLES</literal> subcommand specifies the variables whose values are to be
printed. Keyword VARIABLES is optional. If <literal>VARIABLES</literal> subcommand is not
specified then all variables in the active dataset are printed.
</para>
<para>The <literal>CASES</literal> subcommand can be used to specify a subset of cases to be
printed. Specify <literal>FROM</literal> and the case number of the first case to print,
<literal>TO</literal> and the case number of the last case to print, and <literal>BY</literal> and the number
of cases to advance between printing cases, or any subset of those
settings. If <literal>CASES</literal> is not specified then all cases are printed.
</para>
<para>The <literal>FORMAT</literal> subcommand can be used to change the output format. <literal>NUMBERED</literal>
will print case numbers along with each case; <literal>UNNUMBERED</literal>, the default,
causes the case numbers to be omitted. The <literal>WRAP</literal> and <literal>SINGLE</literal> settings are
currently not used.
</para>
<para>Case numbers start from 1. They are counted after all transformations
have been considered.
</para>
<para><literal>LIST</literal> is a procedure. It causes the data to be read.
</para>
</sect1>
<sect1 label="8.11" id="NEW-FILE">
<title>NEW FILE</title>
<indexterm role="vr"><primary>NEW FILE</primary></indexterm>
<literallayout>NEW FILE.
</literallayout>
<para><literal>NEW FILE</literal> command clears the dictionary and data from the current
active dataset.
</para>
</sect1>
<sect1 label="8.12" id="PRINT">
<title>PRINT</title>
<indexterm role="vr"><primary>PRINT</primary></indexterm>
<literallayout>PRINT
[OUTFILE=’<replaceable>file_name</replaceable>’]
[RECORDS=<replaceable>n_lines</replaceable>]
[{NOTABLE,TABLE}]
[ENCODING=’<replaceable>encoding</replaceable>’]
[/[<replaceable>line_no</replaceable>] <replaceable>arg</replaceable>…]
<replaceable>arg</replaceable> takes one of the following forms:
’<replaceable>string</replaceable>’ [<replaceable>start</replaceable>]
<replaceable>var_list</replaceable> <replaceable>start</replaceable>-<replaceable>end</replaceable> [<replaceable>type_spec</replaceable>]
<replaceable>var_list</replaceable> (<replaceable>fortran_spec</replaceable>)
<replaceable>var_list</replaceable> *
</literallayout>
<para>The <literal>PRINT</literal> transformation writes variable data to the listing
file or an output file. <literal>PRINT</literal> is executed when a procedure
causes the data to be read. Follow <literal>PRINT</literal> by <literal>EXECUTE</literal> to
print variable data without invoking a procedure (see <link linkend="EXECUTE">EXECUTE</link>).
</para>
<para>All <literal>PRINT</literal> subcommands are optional. If no strings or variables
are specified, <literal>PRINT</literal> outputs a single blank line.
</para>
<para>The <literal>OUTFILE</literal> subcommand specifies the file to receive the output. The
file may be a file name as a string or a file handle (see <link linkend="File-Handles">File
Handles</link>). If <literal>OUTFILE</literal> is not present then output is sent to
PSPP’s output listing file. When <literal>OUTFILE</literal> is present, the
output is written to <replaceable>file_name</replaceable> in a plain text format, with a
space inserted at beginning of each output line, even lines that
otherwise would be blank.
</para>
<para>The <literal>ENCODING</literal> subcommand may only be used if the
<literal>OUTFILE</literal> subcommand is also used. It specifies the character
encoding of the file. See <link linkend="INSERT">INSERT</link>, for information on supported
encodings.
</para>
<para>The <literal>RECORDS</literal> subcommand specifies the number of lines to be output. The
number of lines may optionally be surrounded by parentheses.
</para>
<para><literal>TABLE</literal> will cause the <literal>PRINT</literal> command to output a table to the listing file
that describes what it will print to the output file. <literal>NOTABLE</literal>, the
default, suppresses this output table.
</para>
<para>Introduce the strings and variables to be printed with a slash
(‘<literal>/</literal>’). Optionally, the slash may be followed by a number
indicating which output line is specified. In the absence of this
line number, the next line number is specified. Multiple lines may
be specified using multiple slashes with the intended output for a line
following its respective slash.
</para>
<para>Literal strings may be printed. Specify the string itself.
Optionally the string may be followed by a column number, specifying
the column on the line where the string should start. Otherwise, the
string is printed at the current position on the line.
</para>
<para>Variables to be printed can be specified in the same ways as available
for <literal>DATA LIST FIXED</literal> (see <link linkend="DATA-LIST-FIXED">DATA LIST FIXED</link>). In addition, a
variable
list may be followed by an asterisk (‘<literal>*</literal>’), which indicates that the
variables should be printed in their dictionary print formats, separated
by spaces. A variable list followed by a slash or the end of command
is interpreted in the same way.
</para>
<para>If a FORTRAN type specification is used to move backwards on the current
line, then text is written at that point on the line, the line is
truncated to that length, although additional text being added will
again extend the line to that length.
</para>
</sect1>
<sect1 label="8.13" id="PRINT-EJECT">
<title>PRINT EJECT</title>
<indexterm role="vr"><primary>PRINT EJECT</primary></indexterm>
<literallayout>PRINT EJECT
OUTFILE=’<replaceable>file_name</replaceable>’
RECORDS=<replaceable>n_lines</replaceable>
{NOTABLE,TABLE}
/[<replaceable>line_no</replaceable>] <replaceable>arg</replaceable>…
<replaceable>arg</replaceable> takes one of the following forms:
’<replaceable>string</replaceable>’ [<replaceable>start</replaceable>-<replaceable>end</replaceable>]
<replaceable>var_list</replaceable> <replaceable>start</replaceable>-<replaceable>end</replaceable> [<replaceable>type_spec</replaceable>]
<replaceable>var_list</replaceable> (<replaceable>fortran_spec</replaceable>)
<replaceable>var_list</replaceable> *
</literallayout>
<para><literal>PRINT EJECT</literal> advances to the beginning of a new output page in
the listing file or output file. It can also output data in the same
way as <literal>PRINT</literal>.
</para>
<para>All <literal>PRINT EJECT</literal> subcommands are optional.
</para>
<para>Without <literal>OUTFILE</literal>, <literal>PRINT EJECT</literal> ejects the current page in
the listing file, then it produces other output, if any is specified.
</para>
<para>With <literal>OUTFILE</literal>, <literal>PRINT EJECT</literal> writes its output to the specified file.
The first line of output is written with ‘<literal>1</literal>’ inserted in the
first column. Commonly, this is the only line of output. If
additional lines of output are specified, these additional lines are
written with a space inserted in the first column, as with <literal>PRINT</literal>.
</para>
<para>See <link linkend="PRINT">PRINT</link>, for more information on syntax and usage.
</para>
</sect1>
<sect1 label="8.14" id="PRINT-SPACE">
<title>PRINT SPACE</title>
<indexterm role="vr"><primary>PRINT SPACE</primary></indexterm>
<literallayout>PRINT SPACE [OUTFILE=’file_name’] [ENCODING=’<replaceable>encoding</replaceable>’] [n_lines].
</literallayout>
<para><literal>PRINT SPACE</literal> prints one or more blank lines to an output file.
</para>
<para>The <literal>OUTFILE</literal> subcommand is optional. It may be used to direct output to
a file specified by file name as a string or file handle (see <link linkend="File-Handles">File
Handles</link>). If OUTFILE is not specified then output is directed to
the listing file.
</para>
<para>The <literal>ENCODING</literal> subcommand may only be used if <literal>OUTFILE</literal>
is also used. It specifies the character encoding of the file.
See <link linkend="INSERT">INSERT</link>, for information on supported encodings.
</para>
<para>n_lines is also optional. If present, it is an expression
(see <link linkend="Expressions">Expressions</link>) specifying the number of blank lines to be
printed. The expression must evaluate to a nonnegative value.
</para>
</sect1>
<sect1 label="8.15" id="REREAD">
<title>REREAD</title>
<indexterm role="vr"><primary>REREAD</primary></indexterm>
<literallayout>REREAD [FILE=handle] [COLUMN=column] [ENCODING=’<replaceable>encoding</replaceable>’].
</literallayout>
<para>The <literal>REREAD</literal> transformation allows the previous input line in a
data file
already processed by <literal>DATA LIST</literal> or another input command to be re-read
for further processing.
</para>
<para>The <literal>FILE</literal> subcommand, which is optional, is used to specify the file to
have its line re-read. The file must be specified as the name of a file
handle (see <link linkend="File-Handles">File Handles</link>). If FILE is not specified then the last
file specified on <literal>DATA LIST</literal> is assumed (last file specified
lexically, not in terms of flow-of-control).
</para>
<para>By default, the line re-read is re-read in its entirety. With the
<literal>COLUMN</literal> subcommand, a prefix of the line can be exempted from
re-reading. Specify an expression (see <link linkend="Expressions">Expressions</link>) evaluating to
the first column that should be included in the re-read line. Columns
are numbered from 1 at the left margin.
</para>
<para>The <literal>ENCODING</literal> subcommand may only be used if the <literal>FILE</literal>
subcommand is also used. It specifies the character encoding of the
file. See <link linkend="INSERT">INSERT</link>, for information on supported encodings.
</para>
<para>Issuing <literal>REREAD</literal> multiple times will not back up in the data
file. Instead, it will re-read the same line multiple times.
</para>
</sect1>
<sect1 label="8.16" id="WRITE">
<title>WRITE</title>
<indexterm role="vr"><primary>WRITE</primary></indexterm>
<literallayout>WRITE
OUTFILE=’<replaceable>file_name</replaceable>’
RECORDS=<replaceable>n_lines</replaceable>
{NOTABLE,TABLE}
/[<replaceable>line_no</replaceable>] <replaceable>arg</replaceable>…
<replaceable>arg</replaceable> takes one of the following forms:
’<replaceable>string</replaceable>’ [<replaceable>start</replaceable>-<replaceable>end</replaceable>]
<replaceable>var_list</replaceable> <replaceable>start</replaceable>-<replaceable>end</replaceable> [<replaceable>type_spec</replaceable>]
<replaceable>var_list</replaceable> (<replaceable>fortran_spec</replaceable>)
<replaceable>var_list</replaceable> *
</literallayout>
<para><literal>WRITE</literal> writes text or binary data to an output file.
</para>
<para>See <link linkend="PRINT">PRINT</link>, for more information on syntax and usage. <literal>PRINT</literal>
and <literal>WRITE</literal> differ in only a few ways:
</para>
<itemizedlist><listitem><para><literal>WRITE</literal> uses write formats by default, whereas <literal>PRINT</literal> uses
print formats.
</para>
</listitem><listitem><para><literal>PRINT</literal> inserts a space between variables unless a format is
explicitly specified, but <literal>WRITE</literal> never inserts space between
variables in output.
</para>
</listitem><listitem><para><literal>PRINT</literal> inserts a space at the beginning of each line that it
writes to an output file (and <literal>PRINT EJECT</literal> inserts ‘<literal>1</literal>’ at
the beginning of each line that should begin a new page), but
<literal>WRITE</literal> does not.
</para>
</listitem><listitem><para><literal>PRINT</literal> outputs the system-missing value according to its
specified output format, whereas <literal>WRITE</literal> outputs the
system-missing value as a field filled with spaces. Binary formats
are an exception.
</para></listitem></itemizedlist><!-- PSPP - a program for statistical analysis. -->
<!-- Copyright (C) 2017, 2020 Free Software Foundation, Inc. -->
<!-- Permission is granted to copy, distribute and/or modify this document -->
<!-- under the terms of the GNU Free Documentation License, Version 1.3 -->
<!-- or any later version published by the Free Software Foundation; -->
<!-- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -->
<!-- A copy of the license is included in the section entitled "GNU -->
<!-- Free Documentation License". -->
<!-- -->
</sect1>
</chapter>
<chapter label="9" id="System-and-Portable-File-IO">
<title>System and Portable File I/O</title>
<para>The commands in this chapter read, write, and examine system files and
portable files.
</para>
<sect1 label="9.1" id="APPLY-DICTIONARY">
<title>APPLY DICTIONARY</title>
<indexterm role="vr"><primary>APPLY DICTIONARY</primary></indexterm>
<literallayout>APPLY DICTIONARY FROM={’<replaceable>file_name</replaceable>’,<replaceable>file_handle</replaceable>}.
</literallayout>
<para><literal>APPLY DICTIONARY</literal> applies the variable labels, value labels,
and missing values taken from a file to corresponding
variables in the active dataset. In some cases it also updates the
weighting variable.
</para>
<para>The <literal>FROM</literal> clause is mandatory. Use it to specify a system
file or portable file’s name in single quotes, a data set name
(see <link linkend="Datasets">Datasets</link>), or a file handle name (see <link linkend="File-Handles">File Handles</link>).
The dictionary in the file is be read, but it does not replace the active
dataset’s dictionary. The file’s data is not read.
</para>
<para>Only variables with names that exist in both the active dataset and the
system file are considered. Variables with the same name but different
types (numeric, string) cause an error message. Otherwise, the
system file variables’ attributes replace those in their matching
active dataset variables:
</para>
<itemizedlist><listitem><para>If a system file variable has a variable label, then it replaces
the variable label of the active dataset variable. If the system
file variable does not have a variable label, then the active dataset
variable’s variable label, if any, is retained.
</para>
</listitem><listitem><para>If the system file variable has custom attributes (see <link linkend="VARIABLE-ATTRIBUTE">VARIABLE
ATTRIBUTE</link>), then those attributes replace the active dataset variable’s
custom attributes. If the system file variable does not have custom
attributes, then the active dataset variable’s custom attributes, if any,
is retained.
</para>
</listitem><listitem><para>If the active dataset variable is numeric or short string, then value
labels and missing values, if any, are copied to the active dataset
variable. If the system file variable does not have value labels or
missing values, then those in the active dataset variable, if any, are not
disturbed.
</para></listitem></itemizedlist>
<para>In addition to properties of variables, some properties of the active
file dictionary as a whole are updated:
</para>
<itemizedlist><listitem><para>If the system file has custom attributes (see <link linkend="DATAFILE-ATTRIBUTE">DATAFILE ATTRIBUTE</link>),
then those attributes replace the active dataset variable’s custom
attributes.
</para>
</listitem><listitem><para>If the active dataset has a weighting variable (see <link linkend="WEIGHT">WEIGHT</link>), and the
system file does not, or if the weighting variable in the system file
does not exist in the active dataset, then the active dataset weighting
variable, if any, is retained. Otherwise, the weighting variable in
the system file becomes the active dataset weighting variable.
</para></listitem></itemizedlist>
<para><literal>APPLY DICTIONARY</literal> takes effect immediately. It does not read the
active dataset. The system file is not modified.
</para>
</sect1>
<sect1 label="9.2" id="EXPORT">
<title>EXPORT</title>
<indexterm role="vr"><primary>EXPORT</primary></indexterm>
<literallayout>EXPORT
/OUTFILE=’<replaceable>file_name</replaceable>’
/UNSELECTED={RETAIN,DELETE}
/DIGITS=<replaceable>n</replaceable>
/DROP=<replaceable>var_list</replaceable>
/KEEP=<replaceable>var_list</replaceable>
/RENAME=(<replaceable>src_names</replaceable>=<replaceable>target_names</replaceable>)…
/TYPE={COMM,TAPE}
/MAP
</literallayout>
<para>The <literal>EXPORT</literal> procedure writes the active dataset’s dictionary and
data to a specified portable file.
</para>
<para>By default, cases excluded with FILTER are written to the
file. These can be excluded by specifying DELETE on the <literal>UNSELECTED</literal>
subcommand. Specifying RETAIN makes the default explicit.
</para>
<para>Portable files express real numbers in base 30. Integers are always
expressed to the maximum precision needed to make them exact.
Non-integers are, by default, expressed to the machine’s maximum
natural precision (approximately 15 decimal digits on many machines).
If many numbers require this many digits, the portable file may
significantly increase in size. As an alternative, the <literal>DIGITS</literal>
subcommand may be used to specify the number of decimal digits of
precision to write. <literal>DIGITS</literal> applies only to non-integers.
</para>
<para>The <literal>OUTFILE</literal> subcommand, which is the only required subcommand, specifies
the portable file to be written as a file name string or
a file handle (see <link linkend="File-Handles">File Handles</link>).
</para>
<para><literal>DROP</literal>, <literal>KEEP</literal>, and <literal>RENAME</literal> follow the same format as the
<literal>SAVE</literal> procedure (see <link linkend="SAVE">SAVE</link>).
</para>
<para>The <literal>TYPE</literal> subcommand specifies the character set for use in the
portable file. Its value is currently not used.
</para>
<para>The <literal>MAP</literal> subcommand is currently ignored.
</para>
<para><literal>EXPORT</literal> is a procedure. It causes the active dataset to be read.
</para>
</sect1>
<sect1 label="9.3" id="GET">
<title>GET</title>
<indexterm role="vr"><primary>GET</primary></indexterm>
<literallayout>GET
/FILE={’<replaceable>file_name</replaceable>’,<replaceable>file_handle</replaceable>}
/DROP=<replaceable>var_list</replaceable>
/KEEP=<replaceable>var_list</replaceable>
/RENAME=(<replaceable>src_names</replaceable>=<replaceable>target_names</replaceable>)…
/ENCODING=’<replaceable>encoding</replaceable>’
</literallayout>
<para><literal>GET</literal> clears the current dictionary and active dataset and
replaces them with the dictionary and data from a specified file.
</para>
<para>The <literal>FILE</literal> subcommand is the only required subcommand. Specify
the SPSS system file, SPSS/PC+ system file, or SPSS portable file to
be read as a string file name or a file handle (see <link linkend="File-Handles">File Handles</link>).
</para>
<para>By default, all the variables in a file are read. The DROP
subcommand can be used to specify a list of variables that are not to be
read. By contrast, the <literal>KEEP</literal> subcommand can be used to specify
variable that are to be read, with all other variables not read.
</para>
<para>Normally variables in a file retain the names that they were
saved under. Use the <literal>RENAME</literal> subcommand to change these names.
Specify,
within parentheses, a list of variable names followed by an equals sign
(‘<literal>=</literal>’) and the names that they should be renamed to. Multiple
parenthesized groups of variable names can be included on a single
<literal>RENAME</literal> subcommand.
Variables’ names may be swapped using a <literal>RENAME</literal>
subcommand of the form <literal>/RENAME=(<replaceable>A</replaceable> <replaceable>B</replaceable>=<replaceable>B</replaceable> <replaceable>A</replaceable>)</literal>.
</para>
<para>Alternate syntax for the <literal>RENAME</literal> subcommand allows the parentheses to be
eliminated. When this is done, only a single variable may be renamed at
once. For instance, <literal>/RENAME=<replaceable>A</replaceable>=<replaceable>B</replaceable></literal>. This alternate syntax is
deprecated.
</para>
<para><literal>DROP</literal>, <literal>KEEP</literal>, and <literal>RENAME</literal> are executed in left-to-right order.
Each may be present any number of times. <literal>GET</literal> never modifies a
file on disk. Only the active dataset read from the file
is affected by these subcommands.
</para>
<para>PSPP automatically detects the encoding of string data in the file,
when possible. The character encoding of old SPSS system files cannot
always be guessed correctly, and SPSS/PC+ system files do not include
any indication of their encoding. Specify the <literal>ENCODING</literal>
subcommand with an <acronym>IANA</acronym> character set name as its string
argument to override the default. Use <literal>SYSFILE INFO</literal> to analyze
the encodings that might be valid for a system file. The
<literal>ENCODING</literal> subcommand is a PSPP extension.
</para>
<para><literal>GET</literal> does not cause the data to be read, only the dictionary. The data
is read later, when a procedure is executed.
</para>
<para>Use of <literal>GET</literal> to read a portable file is a PSPP extension.
</para>
</sect1>
<sect1 label="9.4" id="GET-DATA">
<title>GET DATA</title>
<indexterm role="vr"><primary>GET DATA</primary></indexterm>
<literallayout>GET DATA
/TYPE={GNM,ODS,PSQL,TXT}
…additional subcommands depending on TYPE…
</literallayout>
<para>The <literal>GET DATA</literal> command is used to read files and other data
sources created by other applications. When this command is executed,
the current dictionary and active dataset are replaced with variables
and data read from the specified source.
</para>
<para>The <literal>TYPE</literal> subcommand is mandatory and must be the first subcommand
specified. It determines the type of the file or source to read.
PSPP currently supports the following file types:
</para>
<variablelist><varlistentry><term>GNM
</term><listitem><para>Spreadsheet files created by Gnumeric (<ulink url="http://gnumeric.org">http://gnumeric.org</ulink>).
</para>
</listitem></varlistentry><varlistentry><term>ODS
</term><listitem><para>Spreadsheet files in OpenDocument format (<ulink url="http://opendocumentformat.org">http://opendocumentformat.org</ulink>).
</para>
</listitem></varlistentry><varlistentry><term>PSQL
</term><listitem><para>Relations from PostgreSQL databases (<ulink url="http://postgresql.org">http://postgresql.org</ulink>).
</para>
</listitem></varlistentry><varlistentry><term>TXT
</term><listitem><para>Textual data files in columnar and delimited formats.
</para></listitem></varlistentry></variablelist>
<para>Each supported file type has additional subcommands, explained in
separate sections below.
</para>
<sect2 label="9.4.1" id="GET-DATA-_002fTYPE_003dGNM_002fODS">
<title>Spreadsheet Files</title>
<literallayout>GET DATA /TYPE={GNM, ODS}
/FILE={’<replaceable>file_name</replaceable>’}
/SHEET={NAME ’<replaceable>sheet_name</replaceable>’, INDEX <replaceable>n</replaceable>}
/CELLRANGE={RANGE ’<replaceable>range</replaceable>’, FULL}
/READNAMES={ON, OFF}
/ASSUMEDSTRWIDTH=<replaceable>n</replaceable>.
</literallayout>
<indexterm role="cp"><primary>Gnumeric</primary></indexterm>
<indexterm role="cp"><primary>OpenDocument</primary></indexterm>
<indexterm role="cp"><primary>spreadsheet files</primary></indexterm>
<para>Gnumeric spreadsheets (<ulink url="http://gnumeric.org">http://gnumeric.org</ulink>), and spreadsheets
in OpenDocument format
(<ulink url="http://libreplanet.org/wiki/Group:OpenDocument/Software">http://libreplanet.org/wiki/Group:OpenDocument/Software</ulink>)
can be read using the <literal>GET DATA</literal> command.
Use the <literal>TYPE</literal> subcommand to indicate the file’s format.
/TYPE=GNM indicates Gnumeric files,
/TYPE=ODS indicates OpenDocument.
The <literal>FILE</literal> subcommand is mandatory.
Use it to specify the name file to be read.
All other subcommands are optional.
</para>
<para>The format of each variable is determined by the format of the spreadsheet
cell containing the first datum for the variable.
If this cell is of string (text) format, then the width of the variable is
determined from the length of the string it contains, unless the
<literal>ASSUMEDSTRWIDTH</literal> subcommand is given.
</para>
<para>The <literal>SHEET</literal> subcommand specifies the sheet within the spreadsheet file to read.
There are two forms of the <literal>SHEET</literal> subcommand.
In the first form,
<literal>/SHEET=name <replaceable>sheet_name</replaceable></literal>, the string <replaceable>sheet_name</replaceable> is the
name of the sheet to read.
In the second form, <literal>/SHEET=index <replaceable>idx</replaceable></literal>, <replaceable>idx</replaceable> is a
integer which is the index of the sheet to read.
The first sheet has the index 1.
If the <literal>SHEET</literal> subcommand is omitted, then the command reads the
first sheet in the file.
</para>
<para>The <literal>CELLRANGE</literal> subcommand specifies the range of cells within the sheet to read.
If the subcommand is given as <literal>/CELLRANGE=FULL</literal>, then the entire
sheet is read.
To read only part of a sheet, use the form
<literal>/CELLRANGE=range '<replaceable>top_left_cell</replaceable>:<replaceable>bottom_right_cell</replaceable>'</literal>.
For example, the subcommand <literal>/CELLRANGE=range 'C3:P19'</literal> reads
columns C–P, and rows 3–19 inclusive.
If no <literal>CELLRANGE</literal> subcommand is given, then the entire sheet is read.
</para>
<para>If <literal>/READNAMES=ON</literal> is specified, then the contents of cells of
the first row are used as the names of the variables in which to store
the data from subsequent rows. This is the default.
If <literal>/READNAMES=OFF</literal> is
used, then the variables receive automatically assigned names.
</para>
<para>The <literal>ASSUMEDSTRWIDTH</literal> subcommand specifies the maximum width of string
variables read from the file.
If omitted, the default value is determined from the length of the
string in the first spreadsheet cell for each variable.
</para>
</sect2>
<sect2 label="9.4.2" id="GET-DATA-_002fTYPE_003dPSQL">
<title>Postgres Database Queries</title>
<literallayout>GET DATA /TYPE=PSQL
/CONNECT={<replaceable>connection info</replaceable>}
/SQL={<replaceable>query</replaceable>}
[/ASSUMEDSTRWIDTH=<replaceable>w</replaceable>]
[/UNENCRYPTED]
[/BSIZE=<replaceable>n</replaceable>].
</literallayout>
<indexterm role="cp"><primary>postgres</primary></indexterm>
<indexterm role="cp"><primary>databases</primary></indexterm>
<para><literal>GET DATA /TYPE=PSQL</literal> imports data from a local or remote
Postgres database server.
It automatically creates variables based on the table column names
or the names specified in the SQL query.
PSPP cannot support the full precision of some Postgres data types,
so data of those types will lose some precision when PSPP imports them.
PSPP does not support all Postgres data types.
If PSPP cannot support a datum, <literal>GET DATA</literal> issues a warning
and substitutes the system-missing value.
</para>
<para>The <literal>CONNECT</literal> subcommand is mandatory.
It is a string specifying the parameters of the database server from
which the data should be fetched.
The format of the string is given in the postgres manual
<ulink url="http://www.postgresql.org/docs/8.0/static/libpq.html#LIBPQ-CONNECT">http://www.postgresql.org/docs/8.0/static/libpq.html#LIBPQ-CONNECT</ulink>.
</para>
<para>The <literal>SQL</literal> subcommand is mandatory.
It must be a valid SQL string to retrieve data from the database.
</para>
<para>The <literal>ASSUMEDSTRWIDTH</literal> subcommand specifies the maximum width of string
variables read from the database.
If omitted, the default value is determined from the length of the
string in the first value read for each variable.
</para>
<para>The <literal>UNENCRYPTED</literal> subcommand allows data to be retrieved over an insecure
connection.
If the connection is not encrypted, and the <literal>UNENCRYPTED</literal> subcommand is
not given, then an error occurs.
Whether or not the connection is
encrypted depends upon the underlying psql library and the
capabilities of the database server.
</para>
<para>The <literal>BSIZE</literal> subcommand serves only to optimise the speed of data transfer.
It specifies an upper limit on
number of cases to fetch from the database at once.
The default value is 4096.
If your SQL statement fetches a large number of cases but only a small number of
variables, then the data transfer may be faster if you increase this value.
Conversely, if the number of variables is large, or if the machine on which
PSPP is running has only a
small amount of memory, then a smaller value is probably better.
</para>
<para>The following syntax is an example:
</para><screen>GET DATA /TYPE=PSQL
/CONNECT='host=example.com port=5432 dbname=product user=fred passwd=xxxx'
/SQL='select * from manufacturer'.
</screen>
</sect2>
<sect2 label="9.4.3" id="GET-DATA-_002fTYPE_003dTXT">
<title>Textual Data Files</title>
<literallayout>GET DATA /TYPE=TXT
/FILE={’<replaceable>file_name</replaceable>’,<replaceable>file_handle</replaceable>}
[ENCODING=’<replaceable>encoding</replaceable>’]
[/ARRANGEMENT={DELIMITED,FIXED}]
[/FIRSTCASE={<replaceable>first_case</replaceable>}]
[/IMPORTCASES=...]
…additional subcommands depending on ARRANGEMENT…
</literallayout>
<indexterm role="cp"><primary>text files</primary></indexterm>
<indexterm role="cp"><primary>data files</primary></indexterm>
<para>When TYPE=TXT is specified, GET DATA reads data in a delimited or
fixed columnar format, much like DATA LIST (see <link linkend="DATA-LIST">DATA LIST</link>).
</para>
<para>The <literal>FILE</literal> subcommand is mandatory. Specify the file to be read as
a string file name or (for textual data only) a
file handle (see <link linkend="File-Handles">File Handles</link>).
</para>
<para>The <literal>ENCODING</literal> subcommand specifies the character encoding of
the file to be read. See <link linkend="INSERT">INSERT</link>, for information on supported
encodings.
</para>
<para>The <literal>ARRANGEMENT</literal> subcommand determines the file’s basic format.
DELIMITED, the default setting, specifies that fields in the input
data are separated by spaces, tabs, or other user-specified
delimiters. FIXED specifies that fields in the input data appear at
particular fixed column positions within records of a case.
</para>
<para>By default, cases are read from the input file starting from the first
line. To skip lines at the beginning of an input file, set <literal>FIRSTCASE</literal>
to the number of the first line to read: 2 to skip the first line, 3
to skip the first two lines, and so on.
</para>
<para><literal>IMPORTCASES</literal> is ignored, for compatibility. Use <literal>N OF
CASES</literal> to limit the number of cases read from a file (see <link linkend="N-OF-CASES">N OF
CASES</link>), or <literal>SAMPLE</literal> to obtain a random sample of cases
(see <link linkend="SAMPLE">SAMPLE</link>).
</para>
<para>The remaining subcommands apply only to one of the two file
arrangements, described below.
</para>
<sect3 label="9.4.3.1" id="GET-DATA-_002fTYPE_003dTXT-_002fARRANGEMENT_003dDELIMITED">
<title>Reading Delimited Data</title>
<literallayout>GET DATA /TYPE=TXT
/FILE={’<replaceable>file_name</replaceable>’,<replaceable>file_handle</replaceable>}
[/ARRANGEMENT={DELIMITED,FIXED}]
[/FIRSTCASE={<replaceable>first_case</replaceable>}]
[/IMPORTCASE={ALL,FIRST <replaceable>max_cases</replaceable>,PERCENT <replaceable>percent</replaceable>}]
/DELIMITERS="<replaceable>delimiters</replaceable>"
[/QUALIFIER="<replaceable>quotes</replaceable>"
[/DELCASE={LINE,VARIABLES <replaceable>n_variables</replaceable>}]
/VARIABLES=<replaceable>del_var1</replaceable> [<replaceable>del_var2</replaceable>]…
where each <replaceable>del_var</replaceable> takes the form:
variable format
</literallayout>
<para>The GET DATA command with TYPE=TXT and ARRANGEMENT=DELIMITED reads
input data from text files in delimited format, where fields are
separated by a set of user-specified delimiters. Its capabilities are
similar to those of DATA LIST FREE (see <link linkend="DATA-LIST-FREE">DATA LIST FREE</link>), with a
few enhancements.
</para>
<para>The required <literal>FILE</literal> subcommand and optional <literal>FIRSTCASE</literal> and <literal>IMPORTCASE</literal>
subcommands are described above (see <link linkend="GET-DATA-_002fTYPE_003dTXT">GET DATA /TYPE=TXT</link>).
</para>
<para><literal>DELIMITERS</literal>, which is required, specifies the set of characters that
may separate fields. Each character in the string specified on
<literal>DELIMITERS</literal> separates one field from the next. The end of a line also
separates fields, regardless of <literal>DELIMITERS</literal>. Two consecutive
delimiters in the input yield an empty field, as does a delimiter at
the end of a line. A space character as a delimiter is an exception:
consecutive spaces do not yield an empty field and neither does any
number of spaces at the end of a line.
</para>
<para>To use a tab as a delimiter, specify ‘<literal>\t</literal>’ at the beginning of the
<literal>DELIMITERS</literal> string. To use a backslash as a delimiter, specify
‘<literal>\\</literal>’ as the first delimiter or, if a tab should also be a
delimiter, immediately following ‘<literal>\t</literal>’. To read a data file in
which each field appears on a separate line, specify the empty string
for <literal>DELIMITERS</literal>.
</para>
<para>The optional <literal>QUALIFIER</literal> subcommand names one or more characters that
can be used to quote values within fields in the input. A field that
begins with one of the specified quote characters ends at the next
matching quote. Intervening delimiters become part of the field,
instead of terminating it. The ability to specify more than one quote
character is a PSPP extension.
</para>
<para>The character specified on <literal>QUALIFIER</literal> can be embedded within a
field that it quotes by doubling the qualifier. For example, if
‘<literal>'</literal>’ is specified on <literal>QUALIFIER</literal>, then <literal>'a''b'</literal>
specifies a field that contains ‘<literal>a'b</literal>’.
</para>
<para>The <literal>DELCASE</literal> subcommand controls how data may be broken across lines in
the data file. With LINE, the default setting, each line must contain
all the data for exactly one case. For additional flexibility, to
allow a single case to be split among lines or multiple cases to be
contained on a single line, specify VARIABLES <emphasis>n_variables</emphasis>, where
<emphasis>n_variables</emphasis> is the number of variables per case.
</para>
<para>The <literal>VARIABLES</literal> subcommand is required and must be the last subcommand.
Specify the name of each variable and its input format (see <link linkend="Input-and-Output-Formats">Input
and Output Formats</link>) in the order they should be read from the input
file.
</para>
<bridgehead renderas="sect3">Examples</bridgehead>
<para>On a Unix-like system, the ‘<literal>/etc/passwd</literal>’ file has a format
similar to this:
</para>
<screen>root:$1$nyeSP5gD$pDq/:0:0:,,,:/root:/bin/bash
blp:$1$BrP/pFg4$g7OG:1000:1000:Ben Pfaff,,,:/home/blp:/bin/bash
john:$1$JBuq/Fioq$g4A:1001:1001:John Darrington,,,:/home/john:/bin/bash
jhs:$1$D3li4hPL$88X1:1002:1002:Jason Stover,,,:/home/jhs:/bin/csh
</screen>
<para>The following syntax reads a file in the format used by
‘<literal>/etc/passwd</literal>’:
</para>
<!-- If you change this example, change the regression test in -->
<!-- tests/language/commands/get-data.at to match. -->
<screen>GET DATA /TYPE=TXT /FILE='/etc/passwd' /DELIMITERS=':'
/VARIABLES=username A20
password A40
uid F10
gid F10
gecos A40
home A40
shell A40.
</screen>
<para>Consider the following data on used cars:
</para>
<screen>model year mileage price type age
Civic 2002 29883 15900 Si 2
Civic 2003 13415 15900 EX 1
Civic 1992 107000 3800 n/a 12
Accord 2002 26613 17900 EX 1
</screen>
<para>The following syntax can be used to read the used car data:
</para>
<!-- If you change this example, change the regression test in -->
<!-- tests/language/commands/get-data.at to match. -->
<screen>GET DATA /TYPE=TXT /FILE='cars.data' /DELIMITERS=' ' /FIRSTCASE=2
/VARIABLES=model A8
year F4
mileage F6
price F5
type A4
age F2.
</screen>
<para>Consider the following information on animals in a pet store:
</para>
<screen>'Pet''s Name', "Age", "Color", "Date Received", "Price", "Height", "Type"
, (Years), , , (Dollars), ,
"Rover", 4.5, Brown, "12 Feb 2004", 80, '1''4"', "Dog"
"Charlie", , Gold, "5 Apr 2007", 12.3, "3""", "Fish"
"Molly", 2, Black, "12 Dec 2006", 25, '5"', "Cat"
"Gilly", , White, "10 Apr 2007", 10, "3""", "Guinea Pig"
</screen>
<para>The following syntax can be used to read the pet store data:
</para>
<!-- If you change this example, change the regression test in -->
<!-- tests/language/commands/get-data.at to match. -->
<screen>GET DATA /TYPE=TXT /FILE='pets.data' /DELIMITERS=', ' /QUALIFIER='''"' /ESCAPE
/FIRSTCASE=3
/VARIABLES=name A10
age F3.1
color A5
received EDATE10
price F5.2
height a5
type a10.
</screen>
</sect3>
<sect3 label="9.4.3.2" id="GET-DATA-_002fTYPE_003dTXT-_002fARRANGEMENT_003dFIXED">
<title>Reading Fixed Columnar Data</title>
<!-- (modify-syntax-entry ?_ "w") -->
<!-- (modify-syntax-entry ?' "'") -->
<!-- (modify-syntax-entry ?@ "'") -->
<literallayout>GET DATA /TYPE=TXT
/FILE={’file_name’,<replaceable>file_handle</replaceable>}
[/ARRANGEMENT={DELIMITED,FIXED}]
[/FIRSTCASE={<replaceable>first_case</replaceable>}]
[/IMPORTCASE={ALL,FIRST <replaceable>max_cases</replaceable>,PERCENT <replaceable>percent</replaceable>}]
[/FIXCASE=<replaceable>n</replaceable>]
/VARIABLES <replaceable>fixed_var</replaceable> [<replaceable>fixed_var</replaceable>]…
[/rec# <replaceable>fixed_var</replaceable> [<replaceable>fixed_var</replaceable>]…]…
where each <replaceable>fixed_var</replaceable> takes the form:
<replaceable>variable</replaceable> <replaceable>start</replaceable>-<replaceable>end</replaceable> <replaceable>format</replaceable>
</literallayout>
<para>The <literal>GET DATA</literal> command with TYPE=TXT and ARRANGEMENT=FIXED reads input
data from text files in fixed format, where each field is located in
particular fixed column positions within records of a case. Its
capabilities are similar to those of DATA LIST FIXED (see <link linkend="DATA-LIST-FIXED">DATA LIST
FIXED</link>), with a few enhancements.
</para>
<para>The required <literal>FILE</literal> subcommand and optional <literal>FIRSTCASE</literal> and <literal>IMPORTCASE</literal>
subcommands are described above (see <link linkend="GET-DATA-_002fTYPE_003dTXT">GET DATA /TYPE=TXT</link>).
</para>
<para>The optional <literal>FIXCASE</literal> subcommand may be used to specify the positive
integer number of input lines that make up each case. The default
value is 1.
</para>
<para>The <literal>VARIABLES</literal> subcommand, which is required, specifies the positions
at which each variable can be found. For each variable, specify its
name, followed by its start and end column separated by ‘<literal>-</literal>’
(<emphasis>e.g.</emphasis> ‘<literal>0-9</literal>’), followed by an input format type (<emphasis>e.g.</emphasis>
‘<literal>F</literal>’) or a full format specification (<emphasis>e.g.</emphasis> ‘<literal>DOLLAR12.2</literal>’).
For this command, columns are numbered starting from 0 at
the left column. Introduce the variables in the second and later
lines of a case by a slash followed by the number of the line within
the case, <emphasis>e.g.</emphasis> ‘<literal>/2</literal>’ for the second line.
</para>
<bridgehead renderas="sect3">Examples</bridgehead>
<para>Consider the following data on used cars:
</para>
<screen>model year mileage price type age
Civic 2002 29883 15900 Si 2
Civic 2003 13415 15900 EX 1
Civic 1992 107000 3800 n/a 12
Accord 2002 26613 17900 EX 1
</screen>
<para>The following syntax can be used to read the used car data:
</para>
<!-- If you change this example, change the regression test in -->
<!-- tests/language/commands/get-data.at to match. -->
<screen>GET DATA /TYPE=TXT /FILE='cars.data' /ARRANGEMENT=FIXED /FIRSTCASE=2
/VARIABLES=model 0-7 A
year 8-15 F
mileage 16-23 F
price 24-31 F
type 32-40 A
age 40-47 F.
</screen>
</sect3>
</sect2>
</sect1>
<sect1 label="9.5" id="IMPORT">
<title>IMPORT</title>
<indexterm role="vr"><primary>IMPORT</primary></indexterm>
<literallayout>IMPORT
/FILE=’<replaceable>file_name</replaceable>’
/TYPE={COMM,TAPE}
/DROP=<replaceable>var_list</replaceable>
/KEEP=<replaceable>var_list</replaceable>
/RENAME=(<replaceable>src_names</replaceable>=<replaceable>target_names</replaceable>)…
</literallayout>
<para>The <literal>IMPORT</literal> transformation clears the active dataset dictionary and
data and
replaces them with a dictionary and data from a system file or
portable file.
</para>
<para>The <literal>FILE</literal> subcommand, which is the only required subcommand, specifies
the portable file to be read as a file name string or a file handle
(see <link linkend="File-Handles">File Handles</link>).
</para>
<para>The <literal>TYPE</literal> subcommand is currently not used.
</para>
<para><literal>DROP</literal>, <literal>KEEP</literal>, and <literal>RENAME</literal> follow the syntax used by <literal>GET</literal> (see <link linkend="GET">GET</link>).
</para>
<para><literal>IMPORT</literal> does not cause the data to be read; only the dictionary. The
data is read later, when a procedure is executed.
</para>
<para>Use of <literal>IMPORT</literal> to read a system file is a PSPP extension.
</para>
</sect1>
<sect1 label="9.6" id="SAVE">
<title>SAVE</title>
<indexterm role="vr"><primary>SAVE</primary></indexterm>
<literallayout>SAVE
/OUTFILE={’<replaceable>file_name</replaceable>’,<replaceable>file_handle</replaceable>}
/UNSELECTED={RETAIN,DELETE}
/{UNCOMPRESSED,COMPRESSED,ZCOMPRESSED}
/PERMISSIONS={WRITEABLE,READONLY}
/DROP=<replaceable>var_list</replaceable>
/KEEP=<replaceable>var_list</replaceable>
/VERSION=<replaceable>version</replaceable>
/RENAME=(<replaceable>src_names</replaceable>=<replaceable>target_names</replaceable>)…
/NAMES
/MAP
</literallayout>
<para>The <literal>SAVE</literal> procedure causes the dictionary and data in the active
dataset to
be written to a system file.
</para>
<para>OUTFILE is the only required subcommand. Specify the system file
to be written as a string file name or a file handle
(see <link linkend="File-Handles">File Handles</link>).
</para>
<para>By default, cases excluded with FILTER are written to the system file.
These can be excluded by specifying <literal>DELETE</literal> on the <literal>UNSELECTED</literal>
subcommand. Specifying <literal>RETAIN</literal> makes the default explicit.
</para>
<para>The <literal>UNCOMPRESSED</literal>, <literal>COMPRESSED</literal>, and
<literal>ZCOMPRESSED</literal> subcommand determine the system file’s
compression level:
</para>
<variablelist><varlistentry><term><literal>UNCOMPRESSED</literal>
</term><listitem><para>Data is not compressed. Each numeric value uses 8 bytes of disk
space. Each string value uses one byte per column width, rounded up
to a multiple of 8 bytes.
</para>
</listitem></varlistentry><varlistentry><term><literal>COMPRESSED</literal>
</term><listitem><para>Data is compressed with a simple algorithm. Each integer numeric
value between −99 and 151, inclusive, or system missing value
uses one byte of disk space. Each 8-byte segment of a string that
consists only of spaces uses 1 byte. Any other numeric value or
8-byte string segment uses 9 bytes of disk space.
</para>
</listitem></varlistentry><varlistentry><term><literal>ZCOMPRESSED</literal>
</term><listitem><para>Data is compressed with the “deflate” compression algorithm
specified in RFC 1951 (the same algorithm used by
<command>gzip</command>). Files written with this compression level cannot be
read by PSPP 0.8.1 or earlier or by SPSS 20 or earlier.
</para></listitem></varlistentry></variablelist>
<para><literal>COMPRESSED</literal> is the default compression level. The SET command
(see <link linkend="SET">SET</link>) can change this default.
</para>
<para>The <literal>PERMISSIONS</literal> subcommand specifies permissions for the new system
file. WRITEABLE, the default, creates the file with read and write
permission. READONLY creates the file for read-only access.
</para>
<para>By default, all the variables in the active dataset dictionary are written
to the system file. The <literal>DROP</literal> subcommand can be used to specify a list
of variables not to be written. In contrast, KEEP specifies variables
to be written, with all variables not specified not written.
</para>
<para>Normally variables are saved to a system file under the same names they
have in the active dataset. Use the <literal>RENAME</literal> subcommand to change these names.
Specify, within parentheses, a list of variable names followed by an
equals sign (‘<literal>=</literal>’) and the names that they should be renamed to.
Multiple parenthesized groups of variable names can be included on a
single <literal>RENAME</literal> subcommand. Variables’ names may be swapped using a
<literal>RENAME</literal> subcommand of the
form <literal>/RENAME=(<replaceable>A</replaceable> <replaceable>B</replaceable>=<replaceable>B</replaceable> <replaceable>A</replaceable>)</literal>.
</para>
<para>Alternate syntax for the <literal>RENAME</literal> subcommand allows the parentheses to be
eliminated. When this is done, only a single variable may be renamed at
once. For instance, <literal>/RENAME=<replaceable>A</replaceable>=<replaceable>B</replaceable></literal>. This alternate syntax is
deprecated.
</para>
<para><literal>DROP</literal>, <literal>KEEP</literal>, and <literal>RENAME</literal> are performed in
left-to-right order. They
each may be present any number of times. <literal>SAVE</literal> never modifies
the active dataset. <literal>DROP</literal>, <literal>KEEP</literal>, and <literal>RENAME</literal> only
affect the system file written to disk.
</para>
<para>The <literal>VERSION</literal> subcommand specifies the version of the file format. Valid
versions are 2 and 3. The default version is 3. In version 2 system
files, variable names longer than 8 bytes are truncated. The two
versions are otherwise identical.
</para>
<para>The <literal>NAMES</literal> and <literal>MAP</literal> subcommands are currently ignored.
</para>
<para><literal>SAVE</literal> causes the data to be read. It is a procedure.
</para>
</sect1>
<sect1 label="9.7" id="SAVE-DATA-COLLECTION">
<title>SAVE DATA COLLECTION</title>
<indexterm role="vr"><primary>SAVE DATA COLLECTION</primary></indexterm>
<literallayout>SAVE DATA COLLECTION
/OUTFILE={’<replaceable>file_name</replaceable>’,<replaceable>file_handle</replaceable>}
/METADATA={’<replaceable>file_name</replaceable>’,<replaceable>file_handle</replaceable>}
/{UNCOMPRESSED,COMPRESSED,ZCOMPRESSED}
/PERMISSIONS={WRITEABLE,READONLY}
/DROP=<replaceable>var_list</replaceable>
/KEEP=<replaceable>var_list</replaceable>
/VERSION=<replaceable>version</replaceable>
/RENAME=(<replaceable>src_names</replaceable>=<replaceable>target_names</replaceable>)…
/NAMES
/MAP
</literallayout>
<para>Like <literal>SAVE</literal>, <literal>SAVE DATA COLLECTION</literal> writes the dictionary and
data in the active dataset to a system file. In addition, it writes
metadata to an additional XML metadata file.
</para>
<para>OUTFILE is required. Specify the system file to be written as a
string file name or a file handle (see <link linkend="File-Handles">File Handles</link>).
</para>
<para>METADATA is also required. Specify the metadata file to be written as
a string file name or a file handle. Metadata files customarily use a
<filename>.mdd</filename> extension.
</para>
<para>The current implementation of this command is experimental. It only
outputs an approximation of the metadata file format. Please report
bugs.
</para>
<para>Other subcommands are optional. They have the same meanings as in the
<literal>SAVE</literal> command.
</para>
<para><literal>SAVE DATA COLLECTION</literal> causes the data to be read. It is a
procedure.
</para>
</sect1>
<sect1 label="9.8" id="SAVE-TRANSLATE">
<title>SAVE TRANSLATE</title>
<indexterm role="vr"><primary>SAVE TRANSLATE</primary></indexterm>
<literallayout>SAVE TRANSLATE
/OUTFILE={’<replaceable>file_name</replaceable>’,<replaceable>file_handle</replaceable>}
/TYPE={CSV,TAB}
[/REPLACE]
[/MISSING={IGNORE,RECODE}]
[/DROP=<replaceable>var_list</replaceable>]
[/KEEP=<replaceable>var_list</replaceable>]
[/RENAME=(<replaceable>src_names</replaceable>=<replaceable>target_names</replaceable>)…]
[/UNSELECTED={RETAIN,DELETE}]
[/MAP]
…additional subcommands depending on TYPE…
</literallayout>
<para>The <literal>SAVE TRANSLATE</literal> command is used to save data into various
formats understood by other applications.
</para>
<para>The <literal>OUTFILE</literal> and <literal>TYPE</literal> subcommands are mandatory.
<literal>OUTFILE</literal> specifies the file to be written, as a string file name or a file handle
(see <link linkend="File-Handles">File Handles</link>). <literal>TYPE</literal> determines the type of the file or
source to read. It must be one of the following:
</para>
<variablelist><varlistentry><term>CSV
</term><listitem><para>Comma-separated value format,
</para>
</listitem></varlistentry><varlistentry><term>TAB
</term><listitem><para>Tab-delimited format.
</para></listitem></varlistentry></variablelist>
<para>By default, <literal>SAVE TRANSLATE</literal> does not overwrite an existing file. Use
<literal>REPLACE</literal> to force an existing file to be overwritten.
</para>
<para>With MISSING=IGNORE, the default, <literal>SAVE TRANSLATE</literal> treats user-missing
values as if they were not missing. Specify MISSING=RECODE to output
numeric user-missing values like system-missing values and string
user-missing values as all spaces.
</para>
<para>By default, all the variables in the active dataset dictionary are
saved to the system file, but <literal>DROP</literal> or <literal>KEEP</literal> can
select a subset of variable to save. The <literal>RENAME</literal> subcommand
can also be used to change the names under which variables are saved;
because they are used only in the output, these names do not have to
conform to the usual PSPP variable naming rules. <literal>UNSELECTED</literal>
determines whether cases filtered out by the <literal>FILTER</literal> command are
written to the output file. These subcommands have the same syntax
and meaning as on the <literal>SAVE</literal> command (see <link linkend="SAVE">SAVE</link>).
</para>
<para>Each supported file type has additional subcommands, explained in
separate sections below.
</para>
<para><literal>SAVE TRANSLATE</literal> causes the data to be read. It is a procedure.
</para>
<sect2 label="9.8.1" id="SAVE-TRANSLATE-_002fTYPE_003dCSV-and-TYPE_003dTAB">
<title>Writing Comma- and Tab-Separated Data Files</title>
<literallayout>SAVE TRANSLATE
/OUTFILE={’<replaceable>file_name</replaceable>’,<replaceable>file_handle</replaceable>}
/TYPE=CSV
[/REPLACE]
[/MISSING={IGNORE,RECODE}]
[/DROP=<replaceable>var_list</replaceable>]
[/KEEP=<replaceable>var_list</replaceable>]
[/RENAME=(<replaceable>src_names</replaceable>=<replaceable>target_names</replaceable>)…]
[/UNSELECTED={RETAIN,DELETE}]
[/FIELDNAMES]
[/CELLS={VALUES,LABELS}]
[/TEXTOPTIONS DELIMITER=’<replaceable>delimiter</replaceable>’]
[/TEXTOPTIONS QUALIFIER=’<replaceable>qualifier</replaceable>’]
[/TEXTOPTIONS DECIMAL={DOT,COMMA}]
[/TEXTOPTIONS FORMAT={PLAIN,VARIABLE}]
</literallayout>
<para>The SAVE TRANSLATE command with TYPE=CSV or TYPE=TAB writes data in a
comma- or tab-separated value format similar to that described by
RFC 4180. Each variable becomes one output column, and each case
becomes one line of output. If FIELDNAMES is specified, an additional
line at the top of the output file lists variable names.
</para>
<para>The CELLS and TEXTOPTIONS FORMAT settings determine how values are
written to the output file:
</para>
<variablelist><varlistentry><term>CELLS=VALUES FORMAT=PLAIN (the default settings)
</term><listitem><para>Writes variables to the output in “plain” formats that ignore the
details of variable formats. Numeric values are written as plain
decimal numbers with enough digits to indicate their exact values in
machine representation. Numeric values include ‘<literal>e</literal>’ followed by
an exponent if the exponent value would be less than -4 or greater
than 16. Dates are written in MM/DD/YYYY format and times in HH:MM:SS
format. WKDAY and MONTH values are written as decimal numbers.
</para>
<para>Numeric values use, by default, the decimal point character set with
SET DECIMAL (see <link linkend="SET-DECIMAL">SET DECIMAL</link>). Use DECIMAL=DOT or DECIMAL=COMMA
to force a particular decimal point character.
</para>
</listitem></varlistentry><varlistentry><term>CELLS=VALUES FORMAT=VARIABLE
</term><listitem><para>Writes variables using their print formats. Leading and trailing
spaces are removed from numeric values, and trailing spaces are
removed from string values.
</para>
</listitem></varlistentry><varlistentry><term>CELLS=LABEL FORMAT=PLAIN
</term><term>CELLS=LABEL FORMAT=VARIABLE
</term><listitem><para>Writes value labels where they exist, and otherwise writes the values
themselves as described above.
</para></listitem></varlistentry></variablelist>
<para>Regardless of CELLS and TEXTOPTIONS FORMAT, numeric system-missing
values are output as a single space.
</para>
<para>For TYPE=TAB, tab characters delimit values. For TYPE=CSV, the
TEXTOPTIONS DELIMITER and DECIMAL settings determine the character
that separate values within a line. If DELIMITER is specified, then
the specified string separate values. If DELIMITER is not specified,
then the default is a comma with DECIMAL=DOT or a semicolon with
DECIMAL=COMMA. If DECIMAL is not given either, it is implied by the
decimal point character set with SET DECIMAL (see <link linkend="SET-DECIMAL">SET DECIMAL</link>).
</para>
<para>The TEXTOPTIONS QUALIFIER setting specifies a character that is output
before and after a value that contains the delimiter character or the
qualifier character. The default is a double quote (‘<literal>"</literal>’). A
qualifier character that appears within a value is doubled.
</para>
</sect2>
</sect1>
<sect1 label="9.9" id="SYSFILE-INFO">
<title>SYSFILE INFO</title>
<indexterm role="vr"><primary>SYSFILE INFO</primary></indexterm>
<literallayout>SYSFILE INFO FILE=’<replaceable>file_name</replaceable>’ [ENCODING=’<replaceable>encoding</replaceable>’].
</literallayout>
<para><literal>SYSFILE INFO</literal> reads the dictionary in an SPSS system file,
SPSS/PC+ system file, or SPSS portable file, and displays the
information in its dictionary.
</para>
<para>Specify a file name or file handle. <literal>SYSFILE INFO</literal> reads that
file and displays information on its dictionary.
</para>
<para>PSPP automatically detects the encoding of string data in the file,
when possible. The character encoding of old SPSS system files cannot
always be guessed correctly, and SPSS/PC+ system files do not include
any indication of their encoding. Specify the <literal>ENCODING</literal>
subcommand with an <acronym>IANA</acronym> character set name as its string
argument to override the default, or specify <literal>ENCODING='DETECT'</literal>
to analyze and report possibly valid encodings for the system file.
The <literal>ENCODING</literal> subcommand is a PSPP extension.
</para>
<para><literal>SYSFILE INFO</literal> does not affect the current active dataset.
</para>
</sect1>
<sect1 label="9.10" id="XEXPORT">
<title>XEXPORT</title>
<indexterm role="vr"><primary>XEXPORT</primary></indexterm>
<literallayout>XEXPORT
/OUTFILE=’<replaceable>file_name</replaceable>’
/DIGITS=<replaceable>n</replaceable>
/DROP=<replaceable>var_list</replaceable>
/KEEP=<replaceable>var_list</replaceable>
/RENAME=(<replaceable>src_names</replaceable>=<replaceable>target_names</replaceable>)…
/TYPE={COMM,TAPE}
/MAP
</literallayout>
<para>The <literal>XEXPORT</literal> transformation writes the active dataset dictionary and
data to a specified portable file.
</para>
<para>This transformation is a PSPP extension.
</para>
<para>It is similar to the <literal>EXPORT</literal> procedure, with two differences:
</para>
<itemizedlist><listitem><para><literal>XEXPORT</literal> is a transformation, not a procedure. It is executed when
the data is read by a procedure or procedure-like command.
</para>
</listitem><listitem><para><literal>XEXPORT</literal> does not support the <literal>UNSELECTED</literal> subcommand.
</para></listitem></itemizedlist>
<para>See <link linkend="EXPORT">EXPORT</link>, for more information.
</para>
</sect1>
<sect1 label="9.11" id="XSAVE">
<title>XSAVE</title>
<indexterm role="vr"><primary>XSAVE</primary></indexterm>
<literallayout>XSAVE
/OUTFILE=’<replaceable>file_name</replaceable>’
/{UNCOMPRESSED,COMPRESSED,ZCOMPRESSED}
/PERMISSIONS={WRITEABLE,READONLY}
/DROP=<replaceable>var_list</replaceable>
/KEEP=<replaceable>var_list</replaceable>
/VERSION=<replaceable>version</replaceable>
/RENAME=(<replaceable>src_names</replaceable>=<replaceable>target_names</replaceable>)…
/NAMES
/MAP
</literallayout>
<para>The <literal>XSAVE</literal> transformation writes the active dataset’s dictionary and
data to a system file. It is similar to the <literal>SAVE</literal>
procedure, with two differences:
</para>
<itemizedlist><listitem><para><literal>XSAVE</literal> is a transformation, not a procedure. It is executed when
the data is read by a procedure or procedure-like command.
</para>
</listitem><listitem><para><literal>XSAVE</literal> does not support the <literal>UNSELECTED</literal> subcommand.
</para></listitem></itemizedlist>
<para>See <link linkend="SAVE">SAVE</link>, for more information.
<!-- PSPP - a program for statistical analysis. -->
<!-- Copyright (C) 2017, 2020 Free Software Foundation, Inc. -->
<!-- Permission is granted to copy, distribute and/or modify this document -->
<!-- under the terms of the GNU Free Documentation License, Version 1.3 -->
<!-- or any later version published by the Free Software Foundation; -->
<!-- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -->
<!-- A copy of the license is included in the section entitled "GNU -->
<!-- Free Documentation License". -->
<!-- -->
</para></sect1>
</chapter>
<chapter label="10" id="Combining-Data-Files">
<title>Combining Data Files</title>
<para>This chapter describes commands that allow data from system files,
portable files, and open datasets to be combined to
form a new active dataset. These commands can combine data files in the
following ways:
</para>
<itemizedlist><listitem><para><literal>ADD FILES</literal> interleaves or appends the cases from each input file.
It is used with input files that have variables in common, but
distinct sets of cases.
</para>
</listitem><listitem><para><literal>MATCH FILES</literal> adds the data together in cases that match across
multiple input files. It is used with input files that have cases in
common, but different information about each case.
</para>
</listitem><listitem><para><literal>UPDATE</literal> updates a master data file from data in a set of
transaction files. Each case in a transaction data file modifies a
matching case in the primary data file, or it adds a new case if no
matching case can be found.
</para></listitem></itemizedlist>
<para>These commands share the majority of their syntax, which is described
in the following section, followed by one section for each command
that describes its specific syntax and semantics.
</para>
<sect1 label="10.1" id="Combining-Files-Common-Syntax">
<title>Common Syntax</title>
<literallayout>Per input file:
/FILE={*,’<replaceable>file_name</replaceable>’}
[/RENAME=(<replaceable>src_names</replaceable>=<replaceable>target_names</replaceable>)…]
[/IN=<replaceable>var_name</replaceable>]
[/SORT]
Once per command:
/BY <replaceable>var_list</replaceable>[({D|A})] [<replaceable>var_list</replaceable>[({D|A}]]…
[/DROP=<replaceable>var_list</replaceable>]
[/KEEP=<replaceable>var_list</replaceable>]
[/FIRST=<replaceable>var_name</replaceable>]
[/LAST=<replaceable>var_name</replaceable>]
[/MAP]
</literallayout>
<para>This section describes the syntactical features in common among the
<literal>ADD FILES</literal>, <literal>MATCH FILES</literal>, and <literal>UPDATE</literal> commands. The
following sections describe details specific to each command.
</para>
<para>Each of these commands reads two or more input files and combines them.
The command’s output becomes the new active dataset.
None of the commands actually change the input files.
Therefore, if you want the changes to become permanent, you must explicitly
save them using an appropriate procedure or transformation (see <link linkend="System-and-Portable-File-IO">System and Portable File IO</link>).
</para>
<para>The syntax of each command begins with a specification of the files to
be read as input. For each input file, specify FILE with a system
file or portable file’s name as a string, a dataset (see <link linkend="Datasets">Datasets</link>)
or file handle name, (see <link linkend="File-Handles">File Handles</link>), or an asterisk (‘<literal>*</literal>’)
to use the active dataset as input. Use of portable files on <literal>FILE</literal> is a
PSPP extension.
</para>
<para>At least two <literal>FILE</literal> subcommands must be specified. If the active dataset
is used as an input source, then <literal>TEMPORARY</literal> must not be in
effect.
</para>
<para>Each <literal>FILE</literal> subcommand may be followed by any number of <literal>RENAME</literal>
subcommands that specify a parenthesized group or groups of variable
names as they appear in the input file, followed by those variables’
new names, separated by an equals sign (<literal>=</literal>),
<emphasis>e.g.</emphasis> <literal>/RENAME=(OLD1=NEW1)(OLD2=NEW2)</literal>. To rename a single
variable, the parentheses may be omitted: <literal>/RENAME=<replaceable>old</replaceable>=<replaceable>new</replaceable></literal>.
Within a parenthesized group, variables are renamed simultaneously, so
that <literal>/RENAME=(<replaceable>A</replaceable> <replaceable>B</replaceable>=<replaceable>B</replaceable> <replaceable>A</replaceable>)</literal> exchanges the
names of variables <replaceable>A</replaceable> and <replaceable>B</replaceable>.
Otherwise, renaming occurs in left-to-right order.
</para>
<para>Each <literal>FILE</literal> subcommand may optionally be followed by a single <literal>IN</literal>
subcommand, which creates a numeric variable with the specified name
and format F1.0. The IN variable takes value 1 in an output case if
the given input file contributed to that output case, and 0 otherwise.
The <literal>DROP</literal>, <literal>KEEP</literal>, and <literal>RENAME</literal> subcommands have no effect on IN variables.
</para>
<para>If <literal>BY</literal> is used (see below), the <literal>SORT</literal> keyword must be specified after a
<literal>FILE</literal> if that input file is not already sorted on the <literal>BY</literal> variables.
When <literal>SORT</literal> is specified, PSPP sorts the input file’s data on the <literal>BY</literal>
variables before it applies it to the command. When <literal>SORT</literal> is used, <literal>BY</literal>
is required. <literal>SORT</literal> is a PSPP extension.
</para>
<para>PSPP merges the dictionaries of all of the input files to form the
dictionary of the new active dataset, like so:
</para>
<itemizedlist><listitem><para>The variables in the new active dataset are the union of all the input files’
variables, matched based on their name. When a single input file
contains a variable with a given name, the output file will contain
exactly that variable. When more than one input file contains a
variable with a given name, those variables must be all string or all numeric.
If they are string variables, then the result will have the width of the longest
variable with that name, with narrower values padded on the right with spaces
to fill the width.
Variables are matched after renaming with the <literal>RENAME</literal> subcommand.
Thus, <literal>RENAME</literal> can be used to resolve conflicts.
Only variables in the output file can conflict, so <literal>DROP</literal> or
<literal>KEEP</literal>, as described below, can also resolve a conflict.
</para>
</listitem><listitem><para>The variable label for each output variable is taken from the first
specified input file that has a variable label for that variable, and
similarly for value labels and missing values.
</para>
</listitem><listitem><para>The file label of the new active dataset (see <link linkend="FILE-LABEL">FILE LABEL</link>) is that of the
first specified <literal>FILE</literal> that has a file label.
</para>
</listitem><listitem><para>The documents in the new active dataset (see <link linkend="DOCUMENT">DOCUMENT</link>) are the
concatenation of all the input files’ documents, in the order in which
the <literal>FILE</literal> subcommands are specified.
</para>
</listitem><listitem><para>If all of the input files are weighted on the same variable, then the
new active dataset is weighted on that variable. Otherwise, the new
active dataset is not weighted.
</para></listitem></itemizedlist>
<para>The remaining subcommands apply to the output file as a whole, rather
than to individual input files. They must be specified at the end of
the command specification, following all of the <literal>FILE</literal> and related
subcommands. The most important of these subcommands is <literal>BY</literal>, which
specifies a set of one or more variables that may be used to find
corresponding cases in each of the input files. The variables
specified on <literal>BY</literal> must be present in all of the input files.
Furthermore, if any of the input files are not sorted on the <literal>BY</literal>
variables, then <literal>SORT</literal> must be specified for those input files.
</para>
<para>The variables listed on <literal>BY</literal> may include (A) or (D) annotations to
specify ascending or descending sort order. See <link linkend="SORT-CASES">SORT CASES</link>, for
more details on this notation. Adding (A) or (D) to the <literal>BY</literal> subcommand
specification is a PSPP extension.
</para>
<para>The <literal>DROP</literal> subcommand can be used to specify a list of variables to
exclude from the output. By contrast, the <literal>KEEP</literal> subcommand can be used
to specify variables to include in the output; all variables not
listed are dropped. <literal>DROP</literal> and <literal>KEEP</literal> are executed in left-to-right order
and may be repeated any number of times. <literal>DROP</literal> and <literal>KEEP</literal> do not affect
variables created by the <literal>IN</literal>, <literal>FIRST</literal>, and <literal>LAST</literal> subcommands, which are
always included in the new active dataset, but they can be used to drop
<literal>BY</literal> variables.
</para>
<para>The <literal>FIRST</literal> and <literal>LAST</literal> subcommands are optional. They may only be
specified on <literal>MATCH FILES</literal> and <literal>ADD FILES</literal>, and only when <literal>BY</literal>
is used. <literal>FIRST</literal> and <literal>LIST</literal> each adds a numeric variable to the new
active dataset, with the name given as the subcommand’s argument and F1.0
print and write formats. The value of the <literal>FIRST</literal> variable is 1 in the
first output case with a given set of values for the <literal>BY</literal> variables, and
0 in other cases. Similarly, the <literal>LAST</literal> variable is 1 in the last case
with a given of <literal>BY</literal> values, and 0 in other cases.
</para>
<para>When any of these commands creates an output case, variables that are
only in files that are not present for the current case are set to the
system-missing value for numeric variables or spaces for string
variables.
</para>
<para>These commands may combine any number of files, limited only by the
machine’s memory.
</para>
</sect1>
<sect1 label="10.2" id="ADD-FILES">
<title>ADD FILES</title>
<indexterm role="vr"><primary>ADD FILES</primary></indexterm>
<literallayout>ADD FILES
Per input file:
/FILE={*,’<replaceable>file_name</replaceable>’}
[/RENAME=(<replaceable>src_names</replaceable>=<replaceable>target_names</replaceable>)…]
[/IN=<replaceable>var_name</replaceable>]
[/SORT]
Once per command:
[/BY <replaceable>var_list</replaceable>[({D|A})] [<replaceable>var_list</replaceable>[({D|A})]…]]
[/DROP=<replaceable>var_list</replaceable>]
[/KEEP=<replaceable>var_list</replaceable>]
[/FIRST=<replaceable>var_name</replaceable>]
[/LAST=<replaceable>var_name</replaceable>]
[/MAP]
</literallayout>
<para><literal>ADD FILES</literal> adds cases from multiple input files. The output,
which replaces the active dataset, consists all of the cases in all of
the input files.
</para>
<para><literal>ADD FILES</literal> shares the bulk of its syntax with other PSPP commands for
combining multiple data files. See <link linkend="Combining-Files-Common-Syntax">Combining Files Common Syntax</link>,
above, for an explanation of this common syntax.
</para>
<para>When <literal>BY</literal> is not used, the output of <literal>ADD FILES</literal> consists of all the cases
from the first input file specified, followed by all the cases from
the second file specified, and so on. When <literal>BY</literal> is used, the output is
additionally sorted on the <literal>BY</literal> variables.
</para>
<para>When <literal>ADD FILES</literal> creates an output case, variables that are not part of
the input file from which the case was drawn are set to the
system-missing value for numeric variables or spaces for string
variables.
</para>
</sect1>
<sect1 label="10.3" id="MATCH-FILES">
<title>MATCH FILES</title>
<indexterm role="vr"><primary>MATCH FILES</primary></indexterm>
<literallayout>MATCH FILES
Per input file:
/{FILE,TABLE}={*,’<replaceable>file_name</replaceable>’}
[/RENAME=(<replaceable>src_names</replaceable>=<replaceable>target_names</replaceable>)…]
[/IN=<replaceable>var_name</replaceable>]
[/SORT]
Once per command:
/BY <replaceable>var_list</replaceable>[({D|A}] [<replaceable>var_list</replaceable>[({D|A})]…]
[/DROP=<replaceable>var_list</replaceable>]
[/KEEP=<replaceable>var_list</replaceable>]
[/FIRST=<replaceable>var_name</replaceable>]
[/LAST=<replaceable>var_name</replaceable>]
[/MAP]
</literallayout>
<para><literal>MATCH FILES</literal> merges sets of corresponding cases in multiple
input files into single cases in the output, combining their data.
</para>
<para><literal>MATCH FILES</literal> shares the bulk of its syntax with other PSPP commands for
combining multiple data files. See <link linkend="Combining-Files-Common-Syntax">Combining Files Common Syntax</link>,
above, for an explanation of this common syntax.
</para>
<para>How <literal>MATCH FILES</literal> matches up cases from the input files depends on
whether <literal>BY</literal> is specified:
</para>
<itemizedlist><listitem><para>If <literal>BY</literal> is not used, <literal>MATCH FILES</literal> combines the first case from each input
file to produce the first output case, then the second case from each
input file for the second output case, and so on. If some input files
have fewer cases than others, then the shorter files do not contribute
to cases output after their input has been exhausted.
</para>
</listitem><listitem><para>If <literal>BY</literal> is used, <literal>MATCH FILES</literal> combines cases from each input file that
have identical values for the <literal>BY</literal> variables.
</para>
<para>When <literal>BY</literal> is used, <literal>TABLE</literal> subcommands may be used to introduce <firstterm>table
lookup file</firstterm>. <literal>TABLE</literal> has same syntax as <literal>FILE</literal>, and the <literal>RENAME</literal>, <literal>IN</literal>, and
<literal>SORT</literal> subcommands may follow a <literal>TABLE</literal> in the same way as <literal>FILE</literal>.
Regardless of the number of <literal>TABLE</literal>s, at least one <literal>FILE</literal> must specified.
Table lookup files are treated in the same way as other input files
for most purposes and, in particular, table lookup files must be
sorted on the <literal>BY</literal> variables or the <literal>SORT</literal> subcommand must be specified
for that <literal>TABLE</literal>.
</para>
<para>Cases in table lookup files are not consumed after they have been used
once. This means that data in table lookup files can correspond to
any number of cases in <literal>FILE</literal> input files. Table lookup files are
analogous to lookup tables in traditional relational database systems.
</para>
<para>If a table lookup file contains more than one case with a given set of
<literal>BY</literal> variables, only the first case is used.
</para></listitem></itemizedlist>
<para>When <literal>MATCH FILES</literal> creates an output case, variables that are only in
files that are not present for the current case are set to the
system-missing value for numeric variables or spaces for string
variables.
</para>
</sect1>
<sect1 label="10.4" id="UPDATE">
<title>UPDATE</title>
<indexterm role="vr"><primary>UPDATE</primary></indexterm>
<literallayout>UPDATE
Per input file:
/FILE={*,’<replaceable>file_name</replaceable>’}
[/RENAME=(<replaceable>src_names</replaceable>=<replaceable>target_names</replaceable>)…]
[/IN=<replaceable>var_name</replaceable>]
[/SORT]
Once per command:
/BY <replaceable>var_list</replaceable>[({D|A})] [<replaceable>var_list</replaceable>[({D|A})]]…
[/DROP=<replaceable>var_list</replaceable>]
[/KEEP=<replaceable>var_list</replaceable>]
[/MAP]
</literallayout>
<para><literal>UPDATE</literal> updates a <firstterm>master file</firstterm> by applying modifications
from one or more <firstterm>transaction files</firstterm>.
</para>
<para><literal>UPDATE</literal> shares the bulk of its syntax with other PSPP commands for
combining multiple data files. See <link linkend="Combining-Files-Common-Syntax">Combining Files Common Syntax</link>,
above, for an explanation of this common syntax.
</para>
<para>At least two <literal>FILE</literal> subcommands must be specified. The first <literal>FILE</literal>
subcommand names the master file, and the rest name transaction files.
Every input file must either be sorted on the variables named on the
<literal>BY</literal> subcommand, or the <literal>SORT</literal> subcommand must be used just after the <literal>FILE</literal>
subcommand for that input file.
</para>
<para><literal>UPDATE</literal> uses the variables specified on the <literal>BY</literal> subcommand, which is
required, to attempt to match each case in a transaction file with a
case in the master file:
</para>
<itemizedlist><listitem><para>When a match is found, then the values of the variables present in the
transaction file replace those variables’ values in the new active
file. If there are matching cases in more than more transaction file,
PSPP applies the replacements from the first transaction file, then
from the second transaction file, and so on. Similarly, if a single
transaction file has cases with duplicate <literal>BY</literal> values, then those are
applied in order to the master file.
</para>
<para>When a variable in a transaction file has a missing value or when a string
variable’s value is all blanks, that value is never used to update the
master file.
</para>
</listitem><listitem><para>If a case in the master file has no matching case in any transaction
file, then it is copied unchanged to the output.
</para>
</listitem><listitem><para>If a case in a transaction file has no matching case in the master
file, then it causes a new case to be added to the output, initialized
from the values in the transaction file.
</para></listitem></itemizedlist><!-- PSPP - a program for statistical analysis. -->
<!-- Copyright (C) 2017, 2020 Free Software Foundation, Inc. -->
<!-- Permission is granted to copy, distribute and/or modify this document -->
<!-- under the terms of the GNU Free Documentation License, Version 1.3 -->
<!-- or any later version published by the Free Software Foundation; -->
<!-- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -->
<!-- A copy of the license is included in the section entitled "GNU -->
<!-- Free Documentation License". -->
<!-- -->
</sect1>
</chapter>
<chapter label="11" id="Manipulating-Variables">
<title>Manipulating Variables</title>
<indexterm role="cp"><primary>Variables</primary></indexterm>
<para>Every value in a dataset is associated with a <firstterm>variable</firstterm>.
Variables describe what the values represent and properties of those values,
such as the format in which they should be displayed, whether they are numeric
or alphabetic and how missing values should be represented.
There are several utility commands for examining and adjusting variables.
</para>
<sect1 label="11.1" id="DISPLAY">
<title>DISPLAY</title>
<indexterm role="vr"><primary>DISPLAY</primary></indexterm>
<para>The <literal>DISPLAY</literal> command displays information about the variables in the active dataset.
A variety of different forms of information can be requested.
By default, all variables in the active dataset are displayed. However you can select
variables of interest using the <literal>/VARIABLES</literal> subcommand.
</para>
<literallayout>DISPLAY [SORTED] NAMES [[/VARIABLES=]<replaceable>var_list</replaceable>].
DISPLAY [SORTED] INDEX [[/VARIABLES=]<replaceable>var_list</replaceable>].
DISPLAY [SORTED] LABELS [[/VARIABLES=]<replaceable>var_list</replaceable>].
DISPLAY [SORTED] VARIABLES [[/VARIABLES=]<replaceable>var_list</replaceable>].
DISPLAY [SORTED] DICTIONARY [[/VARIABLES=]<replaceable>var_list</replaceable>].
DISPLAY [SORTED] SCRATCH [[/VARIABLES=]<replaceable>var_list</replaceable>].
DISPLAY [SORTED] ATTRIBUTES [[/VARIABLES=]<replaceable>var_list</replaceable>].
DISPLAY [SORTED] @ATTRIBUTES [[/VARIABLES=]<replaceable>var_list</replaceable>].
DISPLAY [SORTED] VECTORS.
</literallayout>
<para>The following keywords primarily cause information about variables to
be displayed. With these keywords, by default information is
displayed about all variable in the active dataset, in the order that
variables occur in the active dataset dictionary. The <literal>SORTED</literal> keyword
causes output to be sorted alphabetically by variable name.
</para>
<variablelist><varlistentry><term>NAMES
</term><listitem><para>The variables’ names are displayed.
</para>
</listitem></varlistentry><varlistentry><term>INDEX
</term><listitem><para>The variables’ names are displayed along with a value describing their
position within the active dataset dictionary.
</para>
</listitem></varlistentry><varlistentry><term>LABELS
</term><listitem><para>Variable names, positions, and variable labels are displayed.
</para>
</listitem></varlistentry><varlistentry><term>VARIABLES
</term><listitem><para>Variable names, positions, print and write formats, and missing values
are displayed.
</para>
</listitem></varlistentry><varlistentry><term>DICTIONARY
</term><listitem><para>Variable names, positions, print and write formats, missing values,
variable labels, and value labels are displayed.
</para>
</listitem></varlistentry><varlistentry><term>SCRATCH
</term><listitem><para>Variable names are displayed, for scratch variables only (see <link linkend="Scratch-Variables">Scratch
Variables</link>).
</para>
</listitem></varlistentry><varlistentry><term>ATTRIBUTES
</term><term>@ATTRIBUTES
</term><listitem><para>Datafile and variable attributes are displayed.
The first form of the command omits those attributes
whose names begin with <literal>@</literal> or <literal>$@</literal>.
In the second for, all datafile and variable attributes are displayed.
</para></listitem></varlistentry></variablelist>
<para>With the <literal>VECTOR</literal> keyword, <literal>DISPLAY</literal> lists all the currently
declared vectors. If the <literal>SORTED</literal> keyword is given, the vectors are
listed in alphabetical order; otherwise, they are listed in textual
order of definition within the PSPP syntax file.
</para>
<para>For related commands, see <link linkend="DISPLAY-DOCUMENTS">DISPLAY DOCUMENTS</link> and <link linkend="DISPLAY-FILE-LABEL">DISPLAY
FILE LABEL</link>.
</para>
</sect1>
<sect1 label="11.2" id="NUMERIC">
<title>NUMERIC</title>
<indexterm role="vr"><primary>NUMERIC</primary></indexterm>
<para><literal>NUMERIC</literal> explicitly declares new numeric variables, optionally
setting their output formats.
</para>
<literallayout>NUMERIC <replaceable>var_list</replaceable> [(<replaceable>fmt_spec</replaceable>)] [/<replaceable>var_list</replaceable> [(<replaceable>fmt_spec</replaceable>)]]…
</literallayout>
<para>Specify the names of the new numeric variables as <replaceable>var_list</replaceable>. If
you wish to set the variables’ output formats, follow their names by
an output format specification in parentheses (see <link linkend="Input-and-Output-Formats">Input and Output
Formats</link>); otherwise, the default is F8.2.
</para>
<para>Variables created with <literal>NUMERIC</literal> are initialized to the
system-missing value.
</para>
</sect1>
<sect1 label="11.3" id="STRING">
<title>STRING</title>
<indexterm role="vr"><primary>STRING</primary></indexterm>
<para><literal>STRING</literal> creates new string variables.
</para>
<literallayout>STRING <replaceable>var_list</replaceable> (<replaceable>fmt_spec</replaceable>) [/<replaceable>var_list</replaceable> (<replaceable>fmt_spec</replaceable>)] […].
</literallayout>
<para>Specify a list of names for the variable you want to create,
followed by the desired output format specification in
parentheses (see <link linkend="Input-and-Output-Formats">Input and Output Formats</link>).
Variable widths are
implicitly derived from the specified output formats.
The created variables will be initialized to spaces.
</para>
<para>If you want to create several variables with distinct
output formats, you can either use two or more separate <literal>STRING</literal> commands,
or you can specify further variable list and format specification pairs, each separated
from the previous by a slash (‘<literal>/</literal>’).
</para>
<para>The following example is one way to create three string variables; Two of the
variables have format A24 and the other A80:
</para><screen>STRING firstname lastname (A24) / address (A80).
</screen>
<para>Here is another way to achieve the same result:
</para><screen>STRING firstname lastname (A24).
STRING address (A80).
</screen>
<para>… and here is yet another way:
</para>
<screen>STRING firstname (A24).
STRING lastname (A24).
STRING address (A80).
</screen>
</sect1>
<sect1 label="11.4" id="RENAME-VARIABLES">
<title>RENAME VARIABLES</title>
<indexterm role="vr"><primary>RENAME VARIABLES</primary></indexterm>
<para><literal>RENAME VARIABLES</literal> changes the names of variables in the active
dataset.
</para>
<literallayout>RENAME VARIABLES (<replaceable>old_names</replaceable>=<replaceable>new_names</replaceable>)… .
</literallayout>
<para>Specify lists of the old variable names and new
variable names, separated by an equals sign (‘<literal>=</literal>’), within
parentheses. There must be the same number of old and new variable
names. Each old variable is renamed to the corresponding new variable
name. Multiple parenthesized groups of variables may be specified.
When the old and new variable names contain only a single variable name,
the parentheses are optional.
</para>
<para><literal>RENAME VARIABLES</literal> takes effect immediately. It does not cause the data
to be read.
</para>
<para><literal>RENAME VARIABLES</literal> may not be specified following <literal>TEMPORARY</literal>
(see <link linkend="TEMPORARY">TEMPORARY</link>).
</para>
</sect1>
<sect1 label="11.5" id="SORT-VARIABLES">
<title>SORT VARIABLES</title>
<indexterm role="vr"><primary>SORT VARIABLES</primary></indexterm>
<para><literal>SORT VARIABLES</literal> reorders the variables in the active dataset’s dictionary
according to a chosen sort key.
</para>
<literallayout>SORT VARIABLES [BY]
(NAME | TYPE | FORMAT | LABEL | VALUES | MISSING | MEASURE
| ROLE | COLUMNS | ALIGNMENT | ATTRIBUTE <replaceable>name</replaceable>)
[(D)].
</literallayout>
<para>The main specification is one of the following identifiers, which
determines how the variables are sorted:
</para>
<variablelist><varlistentry><term>NAME
</term><listitem><para>Sorts the variables according to their names, in a case-insensitive
fashion. However, when variable names differ only in a number at the
end, they are sorted numerically. For example, <literal>VAR5</literal> is sorted
before <literal>VAR400</literal> even though ‘<literal>4</literal>’ precedes ‘<literal>5</literal>’.
</para>
</listitem></varlistentry><varlistentry><term>TYPE
</term><listitem><para>Sorts numeric variables before string variables, and shorter string
variables before longer ones.
</para>
</listitem></varlistentry><varlistentry><term>FORMAT
</term><listitem><para>Groups variables by print format; within a format, sorts narrower
formats before wider ones; with the same format and width, sorts fewer
decimal places before more decimal places.
See <link linkend="FORMATS">FORMATS</link>.
</para>
</listitem></varlistentry><varlistentry><term>LABEL
</term><listitem><para>Sorts variables without a variable label before those with one.
See <link linkend="VARIABLE-LABELS">VARIABLE LABELS</link>.
</para>
</listitem></varlistentry><varlistentry><term>VALUES
</term><listitem><para>Sorts variables without value labels before those with some.
See <link linkend="VALUE-LABELS">VALUE LABELS</link>.
</para>
</listitem></varlistentry><varlistentry><term>MISSING
</term><listitem><para>Sorts variables without missing values before those with some.
See <link linkend="MISSING-VALUES">MISSING VALUES</link>.
</para>
</listitem></varlistentry><varlistentry><term>MEASURE
</term><listitem><para>Sorts nominal variables first, followed by ordinal variables, followed
by scale variables. See <link linkend="VARIABLE-LEVEL">VARIABLE LEVEL</link>.
</para>
</listitem></varlistentry><varlistentry><term>ROLE
</term><listitem><para>Groups variables according to their role. See <link linkend="VARIABLE-ROLE">VARIABLE ROLE</link>.
</para>
</listitem></varlistentry><varlistentry><term>COLUMNS
</term><listitem><para>Sorts variables in ascending display width. See <link linkend="VARIABLE-WIDTH">VARIABLE WIDTH</link>.
</para>
</listitem></varlistentry><varlistentry><term>ALIGNMENT
</term><listitem><para>Sorts variables according to their alignment, first left-aligned, then
right-aligned, then centered. See <link linkend="VARIABLE-ALIGNMENT">VARIABLE ALIGNMENT</link>.
</para>
</listitem></varlistentry><varlistentry><term>ATTRIBUTE <replaceable>name</replaceable>
</term><listitem><para>Sorts variables according to the first value of their <replaceable>name</replaceable>
attribute. Variables without attribute are sorted first.
See <link linkend="VARIABLE-ATTRIBUTE">VARIABLE ATTRIBUTE</link>.
</para></listitem></varlistentry></variablelist>
<para>Only one sort criterion can be specified. The sort is “stable,” so
to sort on multiple criteria one may perform multiple sorts. For
example, the following will sort primarily based on alignment, with
variables that have the same alignment ordered based on display width:
</para>
<screen>SORT VARIABLES BY COLUMNS.
SORT VARIABLES BY ALIGNMENT.
</screen>
<para>Specify <literal>(D)</literal> to reverse the sort order.
</para>
</sect1>
<sect1 label="11.6" id="DELETE-VARIABLES">
<title>DELETE VARIABLES</title>
<indexterm role="vr"><primary>DELETE VARIABLES</primary></indexterm>
<para><literal>DELETE VARIABLES</literal> deletes the specified variables from the dictionary.
</para>
<literallayout>DELETE VARIABLES <replaceable>var_list</replaceable>.
</literallayout>
<para><literal>DELETE VARIABLES</literal> should not be used after defining transformations
but before executing a procedure. If it is used in such a context, it
causes the data to be read. If it is used while <literal>TEMPORARY</literal> is in
effect, it causes the temporary transformations to become permanent.
</para>
<para><literal>DELETE VARIABLES</literal> may not be used to delete all variables from the
dictionary; use <literal>NEW FILE</literal> to do that (see <link linkend="NEW-FILE">NEW FILE</link>).
</para>
</sect1>
<sect1 label="11.7" id="VARIABLE-LABELS">
<title>VARIABLE LABELS</title>
<indexterm role="vr"><primary>VARIABLE LABELS</primary></indexterm>
<para>In addition to a variable’s name, each variable can have a
<firstterm>label</firstterm>. Whereas a variable name is a concise, easy-to-type
mnemonic for the variable, a label may be longer and more descriptive.
</para>
<literallayout>VARIABLE LABELS
<replaceable>variable</replaceable> ’<replaceable>label</replaceable>’
[<replaceable>variable</replaceable> ’<replaceable>label</replaceable>’]…
</literallayout>
<para><literal>VARIABLE LABELS</literal> associates explanatory names
with variables. This name, called a <firstterm>variable label</firstterm>, is displayed by
statistical procedures.
</para>
<para>Specify each variable followed by its label as a quoted string.
Variable-label pairs may be separated by an optional slash ‘<literal>/</literal>’.
</para>
<para>If a listed variable already has a label, the new one replaces it.
Specifying an empty string as the label, e.g.‘<literal>''</literal>’, removes a
label.
</para>
</sect1>
<sect1 label="11.8" id="PRINT-FORMATS">
<title>PRINT FORMATS</title>
<indexterm role="vr"><primary>PRINT FORMATS</primary></indexterm>
<literallayout>PRINT FORMATS <replaceable>var_list</replaceable> (<replaceable>fmt_spec</replaceable>) [<replaceable>var_list</replaceable> (<replaceable>fmt_spec</replaceable>)]….
</literallayout>
<para><literal>PRINT FORMATS</literal> sets the print formats for the specified
variables to the specified format specification.
</para>
<para>Its syntax is identical to that of <literal>FORMATS</literal> (see <link linkend="FORMATS">FORMATS</link>),
but <literal>PRINT FORMATS</literal> sets only print formats, not write formats.
</para>
</sect1>
<sect1 label="11.9" id="WRITE-FORMATS">
<title>WRITE FORMATS</title>
<indexterm role="vr"><primary>WRITE FORMATS</primary></indexterm>
<literallayout>WRITE FORMATS <replaceable>var_list</replaceable> (<replaceable>fmt_spec</replaceable>) [<replaceable>var_list</replaceable> (<replaceable>fmt_spec</replaceable>)]….
</literallayout>
<para><literal>WRITE FORMATS</literal> sets the write formats for the specified variables
to the specified format specification. Its syntax is identical to
that of <literal>FORMATS</literal> (see <link linkend="FORMATS">FORMATS</link>), but <literal>WRITE FORMATS</literal> sets only
write formats, not print formats.
</para>
</sect1>
<sect1 label="11.10" id="FORMATS">
<title>FORMATS</title>
<indexterm role="vr"><primary>FORMATS</primary></indexterm>
<literallayout>FORMATS <replaceable>var_list</replaceable> (<replaceable>fmt_spec</replaceable>) [<replaceable>var_list</replaceable> (<replaceable>fmt_spec</replaceable>)]….
</literallayout>
<para><literal>FORMATS</literal> set both print and write formats for the specified
variables to the specified format specification.
See <link linkend="Input-and-Output-Formats">Input and Output Formats</link>.
</para>
<para>Specify a list of variables followed by a format specification in
parentheses. The print and write formats of the specified variables
will be changed. All of the variables listed together must have
the same type and, for string variables, the same width.
</para>
<para>Additional lists of variables and formats may be included following
the first one.
</para>
<para><literal>FORMATS</literal> takes effect immediately. It is not affected by
conditional and looping structures such as <literal>DO IF</literal> or <literal>LOOP</literal>.
</para>
</sect1>
<sect1 label="11.11" id="VALUE-LABELS">
<title>VALUE LABELS</title>
<indexterm role="vr"><primary>VALUE LABELS</primary></indexterm>
<para>The values of a variable can be associated with an arbitrary text string.
In this way, a short value can stand for a longer, more descriptive label.
</para>
<para>Both numeric and string variables can be given labels. For string
variables, the values are case-sensitive, so that, for example, a
capitalized value and its lowercase variant would have to be labeled
separately if both are present in the data.
</para>
<literallayout>VALUE LABELS
/<replaceable>var_list</replaceable> <replaceable>value</replaceable> ’<replaceable>label</replaceable>’ [<replaceable>value</replaceable> ’<replaceable>label</replaceable>’]…
</literallayout>
<para><literal>VALUE LABELS</literal> allows values of variables to be associated with labels.
</para>
<para>To set up value labels for one or more variables, specify the
variable names after a slash (‘<literal>/</literal>’), followed by a list of values
and their associated labels, separated by spaces.
</para>
<para>Value labels in output are normally broken into lines automatically.
Put ‘<literal>\n</literal>’ in a label string to force a line break at that point.
The label may still be broken into lines at additional points.
</para>
<para>Before <literal>VALUE LABELS</literal> is executed, any existing value labels
are cleared from the variables specified. Use <literal>ADD VALUE LABELS</literal>
(see <link linkend="ADD-VALUE-LABELS">ADD VALUE LABELS</link>) to add value labels without clearing those
already present.
</para>
</sect1>
<sect1 label="11.12" id="ADD-VALUE-LABELS">
<title>ADD VALUE LABELS</title>
<indexterm role="vr"><primary>ADD VALUE LABELS</primary></indexterm>
<para><literal>ADD VALUE LABELS</literal> has the same syntax and purpose as <literal>VALUE
LABELS</literal> (see <link linkend="VALUE-LABELS">VALUE LABELS</link>), but it does not clear value
labels from the variables before adding the ones specified.
</para>
<literallayout>ADD VALUE LABELS
/<replaceable>var_list</replaceable> <replaceable>value</replaceable> ’<replaceable>label</replaceable>’ [<replaceable>value</replaceable> ’<replaceable>label</replaceable>’]…
</literallayout>
</sect1>
<sect1 label="11.13" id="MISSING-VALUES">
<title>MISSING VALUES</title>
<indexterm role="vr"><primary>MISSING VALUES</primary></indexterm>
<para>In many situations the data available for analysis is incomplete and a placeholder
must be used in place of a value to indicate that the value is unknown. One way
that missing values are represented is through the $SYSMIS variable
(see <link linkend="System-Variables">System Variables</link>). Another, more flexible way is through
<firstterm>user-missing values</firstterm> which are determined on a per variable basis.
</para>
<para>The <literal>MISSING VALUES</literal> command sets user-missing values for variables.
</para>
<literallayout>MISSING VALUES <replaceable>var_list</replaceable> (<replaceable>missing_values</replaceable>).
where <replaceable>missing_values</replaceable> takes one of the following forms:
<replaceable>num1</replaceable>
<replaceable>num1</replaceable>, <replaceable>num2</replaceable>
<replaceable>num1</replaceable>, <replaceable>num2</replaceable>, <replaceable>num3</replaceable>
<replaceable>num1</replaceable> THRU <replaceable>num2</replaceable>
<replaceable>num1</replaceable> THRU <replaceable>num2</replaceable>, <replaceable>num3</replaceable>
<replaceable>string1</replaceable>
<replaceable>string1</replaceable>, <replaceable>string2</replaceable>
<replaceable>string1</replaceable>, <replaceable>string2</replaceable>, <replaceable>string3</replaceable>
As part of a range, <literal>LO</literal> or <literal>LOWEST</literal> may take the place of <replaceable>num1</replaceable>;
<literal>HI</literal> or <literal>HIGHEST</literal> may take the place of <replaceable>num2</replaceable>.
</literallayout>
<para><literal>MISSING VALUES</literal> sets user-missing values for numeric and string
variables. Long string variables may have missing values, but
characters after the first 8 bytes of the missing value must be
spaces.
</para>
<para>Specify a list of variables, followed by a list of their user-missing
values in parentheses. Up to three discrete values may be given, or,
for numeric variables only, a range of values optionally accompanied by
a single discrete value. Ranges may be open-ended on one end, indicated
through the use of the
keyword <literal>LO</literal> or <literal>LOWEST</literal> or <literal>HI</literal> or <literal>HIGHEST</literal>.
</para>
<para>The <literal>MISSING VALUES</literal> command takes effect immediately. It is not
affected by conditional and looping constructs such as <literal>DO IF</literal> or
<literal>LOOP</literal>.
</para>
</sect1>
<sect1 label="11.14" id="VARIABLE-ATTRIBUTE">
<title>VARIABLE ATTRIBUTE</title>
<indexterm role="vr"><primary>VARIABLE ATTRIBUTE</primary></indexterm>
<para><literal>VARIABLE ATTRIBUTE</literal> adds, modifies, or removes user-defined
attributes associated with variables in the active dataset. Custom
variable attributes are not interpreted by PSPP, but they are saved as
part of system files and may be used by other software that reads
them.
</para>
<literallayout>VARIABLE ATTRIBUTE
VARIABLES=<replaceable>var_list</replaceable>
ATTRIBUTE=<replaceable>name</replaceable>(’<replaceable>value</replaceable>’) [<replaceable>name</replaceable>(’<replaceable>value</replaceable>’)]…
ATTRIBUTE=<replaceable>name</replaceable><emphasis role="bold">[</emphasis><replaceable>index</replaceable><emphasis role="bold">]</emphasis>(’<replaceable>value</replaceable>’) [<replaceable>name</replaceable><emphasis role="bold">[</emphasis><replaceable>index</replaceable><emphasis role="bold">]</emphasis>(’<replaceable>value</replaceable>’)]…
DELETE=<replaceable>name</replaceable> [<replaceable>name</replaceable>]…
DELETE=<replaceable>name</replaceable><emphasis role="bold">[</emphasis><replaceable>index</replaceable><emphasis role="bold">]</emphasis> [<replaceable>name</replaceable><emphasis role="bold">[</emphasis><replaceable>index</replaceable><emphasis role="bold">]</emphasis>]…
</literallayout>
<para>The required <literal>VARIABLES</literal> subcommand must come first. Specify the
variables to which the following <literal>ATTRIBUTE</literal> or <literal>DELETE</literal> subcommand
should apply.
</para>
<para>Use the <literal>ATTRIBUTE</literal> subcommand to add or modify custom variable
attributes. Specify the name of the attribute as an identifier
(see <link linkend="Tokens">Tokens</link>), followed by the desired value, in parentheses, as a
quoted string. The specified attributes are then added or modified in
the variables specified on <literal>VARIABLES</literal>. Attribute names that begin with
<literal>$</literal> are reserved for PSPP’s internal use, and attribute names
that begin with <literal>@</literal> or <literal>$@</literal> are not displayed by most PSPP
commands that display other attributes. Other attribute names are not
treated specially.
</para>
<para>Attributes may also be organized into arrays. To assign to an array
element, add an integer array index enclosed in square brackets
(<literal>[</literal> and <literal>]</literal>) between the attribute name and value. Array
indexes start at 1, not 0. An attribute array that has a single
element (number 1) is not distinguished from a non-array attribute.
</para>
<para>Use the <literal>DELETE</literal> subcommand to delete an attribute from the variable
specified on <literal>VARIABLES</literal>. Specify an attribute name by itself to delete
an entire attribute, including all array elements for attribute
arrays. Specify an attribute name followed by an array index in
square brackets to delete a single element of an attribute array. In
the latter case, all the array elements numbered higher than the
deleted element are shifted down, filling the vacated position.
</para>
<para>To associate custom attributes with the entire active dataset, instead of
with particular variables, use <literal>DATAFILE ATTRIBUTE</literal> (see <link linkend="DATAFILE-ATTRIBUTE">DATAFILE ATTRIBUTE</link>) instead.
</para>
<para><literal>VARIABLE ATTRIBUTE</literal> takes effect immediately. It is not affected
by conditional and looping structures such as <literal>DO IF</literal> or
<literal>LOOP</literal>.
</para>
</sect1>
<sect1 label="11.15" id="VARIABLE-ALIGNMENT">
<title>VARIABLE ALIGNMENT</title>
<indexterm role="vr"><primary>VARIABLE ALIGNMENT</primary></indexterm>
<para><literal>VARIABLE ALIGNMENT</literal> sets the alignment of variables for display editing
purposes. It does not affect the display of variables in the PSPP output.
</para>
<literallayout>VARIABLE ALIGNMENT
<replaceable>var_list</replaceable> ( LEFT | RIGHT | CENTER )
[ /<replaceable>var_list</replaceable> ( LEFT | RIGHT | CENTER ) ]
.
.
.
[ /<replaceable>var_list</replaceable> ( LEFT | RIGHT | CENTER ) ]
</literallayout>
</sect1>
<sect1 label="11.16" id="VARIABLE-WIDTH">
<title>VARIABLE WIDTH</title>
<indexterm role="vr"><primary>VARIABLE WIDTH</primary></indexterm>
<literallayout>VARIABLE WIDTH
<replaceable>var_list</replaceable> (width)
[ /<replaceable>var_list</replaceable> (width) ]
.
.
.
[ /<replaceable>var_list</replaceable> (width) ]
</literallayout>
<para><literal>VARIABLE WIDTH</literal> sets the column width of variables for display editing
purposes. It does not affect the display of variables in the PSPP output.
</para>
</sect1>
<sect1 label="11.17" id="VARIABLE-LEVEL">
<title>VARIABLE LEVEL</title>
<indexterm role="vr"><primary>VARIABLE LEVEL</primary></indexterm>
<literallayout><literal>VARIABLE LEVEL</literal> <emphasis>variables</emphasis> <literal>(</literal>{<literal>SCALE</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>NOMINAL</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>ORDINAL</literal>}<literal>)</literal>…
</literallayout>
<para><literal>VARIABLE LEVEL</literal> sets the measurement level of <replaceable>variables</replaceable> as
specified. See <link linkend="Attributes">Attributes</link>, for the definitions of the available
measurement levels.
</para>
</sect1>
<sect1 label="11.18" id="VARIABLE-ROLE">
<title>VARIABLE ROLE</title>
<indexterm role="vr"><primary>VARIABLE ROLE</primary></indexterm>
<literallayout>VARIABLE ROLE
/<replaceable>role</replaceable> <replaceable>var_list</replaceable>
[/<replaceable>role</replaceable> <replaceable>var_list</replaceable>]…
</literallayout>
<para><literal>VARIABLE ROLE</literal> sets the intended role of a variable for use in
dialog boxes in graphical user interfaces. Each <replaceable>role</replaceable> specifies
one of the following roles for the variables that follow it:
</para>
<variablelist><varlistentry><term><literal>INPUT</literal>
</term><listitem><para>An input variable, such as an independent variable.
</para>
</listitem></varlistentry><varlistentry><term><literal>TARGET</literal>
</term><listitem><para>An output variable, such as a dependent variable.
</para>
</listitem></varlistentry><varlistentry><term><literal>BOTH</literal>
</term><listitem><para>A variable used for input and output.
</para>
</listitem></varlistentry><varlistentry><term><literal>NONE</literal>
</term><listitem><para>No role assigned. (This is a variable’s default role.)
</para>
</listitem></varlistentry><varlistentry><term><literal>PARTITION</literal>
</term><listitem><para>Used to break the data into groups for testing.
</para>
</listitem></varlistentry><varlistentry><term><literal>SPLIT</literal>
</term><listitem><para>No meaning except for certain third party software. (This role’s
meaning is unrelated to <literal>SPLIT FILE</literal>.)
</para></listitem></varlistentry></variablelist>
<para>The PSPPIRE GUI does not yet use variable roles as intended.
</para>
</sect1>
<sect1 label="11.19" id="VECTOR">
<title>VECTOR</title>
<indexterm role="vr"><primary>VECTOR</primary></indexterm>
<literallayout>Two possible syntaxes:
VECTOR <replaceable>vec_name</replaceable>=<replaceable>var_list</replaceable>.
VECTOR <replaceable>vec_name_list</replaceable>(<replaceable>count</replaceable> [<replaceable>format</replaceable>]).
</literallayout>
<para><literal>VECTOR</literal> allows a group of variables to be accessed as if they
were consecutive members of an array with a vector(index) notation.
</para>
<para>To make a vector out of a set of existing variables, specify a name
for the vector followed by an equals sign (‘<literal>=</literal>’) and the variables
to put in the vector. The variables must be all numeric or all
string, and string variables must have the same width.
</para>
<para>To make a vector and create variables at the same time, specify one or
more vector names followed by a count in parentheses. This will
create variables named <literal><replaceable>vec</replaceable>1</literal> through
<literal><replaceable>vec</replaceable><replaceable>count</replaceable></literal>. By default, the new variables are
numeric with format F8.2, but an alternate format may be specified
inside the parentheses before or after the count and separated from it
by white space or a comma. With a string format such as A8, the
variables will be string variables; with a numeric format, they will
be numeric. Variable names including the suffixes may not exceed 64
characters in length, and none of the variables may exist prior to
<literal>VECTOR</literal>.
</para>
<para>Vectors created with <literal>VECTOR</literal> disappear after any procedure or
procedure-like command is executed. The variables contained in the
vectors remain, unless they are scratch variables (see <link linkend="Scratch-Variables">Scratch
Variables</link>).
</para>
<para>Variables within a vector may be referenced in expressions using
<literal>vector(index)</literal> syntax.
</para>
</sect1>
<sect1 label="11.20" id="MRSETS">
<title>MRSETS</title>
<indexterm role="vr"><primary>MRSETS</primary></indexterm>
<para><literal>MRSETS</literal> creates, modifies, deletes, and displays multiple
response sets. A multiple response set is a set of variables that
represent multiple responses to a survey question.
</para>
<para>Multiple responses are represented in one of the two following ways:
</para>
<itemizedlist><listitem><para>A <firstterm>multiple dichotomy set</firstterm> is analogous to a survey question with
a set of checkboxes. Each variable in the set is treated in a Boolean
fashion: one value (the "counted value") means that the box was
checked, and any other value means that it was not.
</para>
</listitem><listitem><para>A <firstterm>multiple category set</firstterm> represents a survey question where the
respondent is instructed to list up to <replaceable>n</replaceable> choices. Each variable
represents one of the responses.
</para></listitem></itemizedlist>
<literallayout>MRSETS
/MDGROUP NAME=<replaceable>name</replaceable> VARIABLES=<replaceable>var_list</replaceable> VALUE=<replaceable>value</replaceable>
[CATEGORYLABELS={VARLABELS,COUNTEDVALUES}]
[{LABEL=’<replaceable>label</replaceable>’,LABELSOURCE=VARLABEL}]
/MCGROUP NAME=<replaceable>name</replaceable> VARIABLES=<replaceable>var_list</replaceable> [LABEL=’<replaceable>label</replaceable>’]
/DELETE NAME={[<replaceable>names</replaceable>],ALL}
/DISPLAY NAME={[<replaceable>names</replaceable>],ALL}
</literallayout>
<para>Any number of subcommands may be specified in any order.
</para>
<para>The <literal>MDGROUP</literal> subcommand creates a new multiple dichotomy set or
replaces an existing multiple response set. The <literal>NAME</literal>,
<literal>VARIABLES</literal>, and
<literal>VALUE</literal> specifications are required. The others are optional:
</para>
<itemizedlist><listitem><para><replaceable>NAME</replaceable> specifies the name used in syntax for the new multiple dichotomy
set. The name must begin with ‘<literal>$</literal>’; it must otherwise follow the
rules for identifiers (see <link linkend="Tokens">Tokens</link>).
</para>
</listitem><listitem><para><literal>VARIABLES</literal> specifies the variables that belong to the set. At least
two variables must be specified. The variables must be all string or
all numeric.
</para>
</listitem><listitem><para><literal>VALUE</literal> specifies the counted value. If the variables are numeric, the
value must be an integer. If the variables are strings, then the
value must be a string that is no longer than the shortest of the
variables in the set (ignoring trailing spaces).
</para>
</listitem><listitem><para><literal>CATEGORYLABELS</literal> optionally specifies the source of the labels for each
category in the set:
</para>
<itemizedlist><listitem><para>− <literal>VARLABELS</literal>, the default, uses variable labels or, for variables without
variable labels, variable names. PSPP warns if two variables have the
same variable label, since these categories cannot be distinguished in
output.
</para>
</listitem><listitem><para>− <literal>COUNTEDVALUES</literal> instead uses each variable’s value label for the counted
value. PSPP warns if two variables have the same value label for the
counted value or if one of the variables lacks a value label, since
such categories cannot be distinguished in output.
</para></listitem></itemizedlist>
</listitem><listitem><para><literal>LABEL</literal> optionally specifies a label for the multiple response set. If
neither <literal>LABEL</literal> nor <literal>LABELSOURCE=VARLABEL</literal> is specified, the set is
unlabeled.
</para>
</listitem><listitem><para><literal>LABELSOURCE=VARLABEL</literal> draws the multiple response set’s label from the
first variable label among the variables in the set; if none of the
variables has a label, the name of the first variable is used.
<literal>LABELSOURCE=VARLABEL</literal> must be used with <literal>CATEGORYLABELS=COUNTEDVALUES</literal>.
It is mutually exclusive with <literal>LABEL</literal>.
</para></listitem></itemizedlist>
<para>The <literal>MCGROUP</literal> subcommand creates a new multiple category set or
replaces an existing multiple response set. The <literal>NAME</literal> and <literal>VARIABLES</literal>
specifications are required, and <literal>LABEL</literal> is optional. Their meanings
are as described above in <literal>MDGROUP</literal>. PSPP warns if two variables in the
set have different value labels for a single value, since each of the
variables in the set should have the same possible categories.
</para>
<para>The <literal>DELETE</literal> subcommand deletes multiple response groups. A list of
groups may be named within a set of required square brackets, or ALL
may be used to delete all groups.
</para>
<para>The <literal>DISPLAY</literal> subcommand displays information about defined multiple
response sets. Its syntax is the same as the <literal>DELETE</literal> subcommand.
</para>
<para>Multiple response sets are saved to and read from system files by,
<emphasis>e.g.</emphasis>, the <literal>SAVE</literal> and <literal>GET</literal> command. Otherwise, multiple
response sets are currently used only by third party software.
</para>
</sect1>
<sect1 label="11.21" id="LEAVE">
<title>LEAVE</title>
<indexterm role="vr"><primary>LEAVE</primary></indexterm>
<para><literal>LEAVE</literal> prevents the specified variables from being
reinitialized whenever a new case is processed.
</para>
<literallayout>LEAVE <replaceable>var_list</replaceable>.
</literallayout>
<para>Normally, when a data file is processed, every variable in the active
dataset is initialized to the system-missing value or spaces at the
beginning of processing for each case. When a variable has been
specified on <literal>LEAVE</literal>, this is not the case. Instead, that variable is
initialized to 0 (not system-missing) or spaces for the first case.
After that, it retains its value between cases.
</para>
<para>This becomes useful for counters. For instance, in the example below
the variable <literal>SUM</literal> maintains a running total of the values in the <literal>ITEM</literal>
variable.
</para>
<screen>DATA LIST /ITEM 1-3.
COMPUTE SUM=SUM+ITEM.
PRINT /ITEM SUM.
LEAVE SUM
BEGIN DATA.
123
404
555
999
END DATA.
</screen>
<para>Partial output from this example:
</para>
<screen>123 123.00
404 527.00
555 1082.00
999 2081.00
</screen>
<para>It is best to use <literal>LEAVE</literal> command immediately before invoking a
procedure command, because the left status of variables is reset by
certain transformations—for instance, <literal>COMPUTE</literal> and <literal>IF</literal>.
Left status is also reset by all procedure invocations.
</para>
<!-- PSPP - a program for statistical analysis. -->
<!-- Copyright (C) 2017, 2020 Free Software Foundation, Inc. -->
<!-- Permission is granted to copy, distribute and/or modify this document -->
<!-- under the terms of the GNU Free Documentation License, Version 1.3 -->
<!-- or any later version published by the Free Software Foundation; -->
<!-- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -->
<!-- A copy of the license is included in the section entitled "GNU -->
<!-- Free Documentation License". -->
<!-- -->
</sect1>
</chapter>
<chapter label="12" id="Data-Manipulation">
<title>Data transformations</title>
<indexterm role="cp"><primary>transformations</primary></indexterm>
<para>The PSPP procedures examined in this chapter manipulate data and
prepare the active dataset for later analyses. They do not produce output,
as a rule.
</para>
<sect1 label="12.1" id="AGGREGATE">
<title>AGGREGATE</title>
<indexterm role="vr"><primary>AGGREGATE</primary></indexterm>
<literallayout>AGGREGATE
[OUTFILE={*,’<replaceable>file_name</replaceable>’,<replaceable>file_handle</replaceable>} [MODE={REPLACE,ADDVARIABLES}]]
[/MISSING=COLUMNWISE]
[/PRESORTED]
[/DOCUMENT]
[/BREAK=<replaceable>var_list</replaceable>]
/<replaceable>dest_var</replaceable>[’<replaceable>label</replaceable>’]…=<replaceable>agr_func</replaceable>(<replaceable>src_vars</replaceable>[, <replaceable>args</replaceable>]…)…
</literallayout>
<para><literal>AGGREGATE</literal> summarizes groups of cases into single cases.
It divides cases into groups that have the same values for one or more
variables called <firstterm>break variables</firstterm>. Several functions are available
for summarizing case contents.
</para>
<para>The <literal>AGGREGATE</literal> syntax consists of subcommands to control its
behavior, all of which are optional, followed by one or more
destination variable assigments, each of which uses an aggregation
function to define how it is calculated.
</para>
<para>The <literal>OUTFILE</literal> subcommand, which must be first, names the
destination for <literal>AGGREGATE</literal> output. It may name a system file by
file name or file handle (see <link linkend="File-Handles">File Handles</link>), a dataset by its name
(see <link linkend="Datasets">Datasets</link>), or ‘<literal>*</literal>’ to replace the active dataset.
<literal>AGGREGATE</literal> writes its output to this file.
</para>
<para>With <literal>OUTFILE=*</literal> only, <literal>MODE</literal> may be specified immediately
afterward with the value <literal>ADDVARIABLES</literal> or <literal>REPLACE</literal>:
</para>
<itemizedlist><listitem><para>With <literal>REPLACE</literal>, the default, the active dataset is replaced by a new dataset
which contains just the break variables and the destination varibles.
The new file contains as many cases as there are
unique combinations of the break variables.
</para>
</listitem><listitem><para>With <literal>ADDVARIABLES</literal>, the destination variables are added to those in
the existing active dataset.
Cases that have the same combination of values in their break
variables receive identical values for the destination variables.
The number of cases in the active dataset remains unchanged.
The data must be
sorted on the break variables, that is, <literal>ADDVARIABLES</literal> implies <literal>PRESORTED</literal>
</para></listitem></itemizedlist>
<para>If <literal>OUTFILE</literal> is omitted, <literal>AGGREGATE</literal> acts as if
<literal>OUTFILE=* MODE=ADDVARIABLES</literal> were specified.
</para>
<para>By default, <literal>AGGREGATE</literal> first sorts the data on the break variables.
If the active dataset is already sorted
or grouped by the break variables, specify
<literal>PRESORTED</literal> to save time.
With <literal>MODE=ADDVARIABLES</literal>, the data must be pre-sorted.
</para>
<para>Specify <literal>DOCUMENT</literal> to copy the documents from the active dataset into the
aggregate file (see <link linkend="DOCUMENT">DOCUMENT</link>). Otherwise, the aggregate file does
not contain any documents, even if the aggregate file replaces the
active dataset.
</para>
<para>Normally, <literal>AGGREGATE</literal> produces a non-missing value whenever there
is enough non-missing data for the aggregation function in use, that
is, just one non-missing value or, for the <literal>SD</literal> and <literal>SD.</literal>
aggregation functions, two non-missing values. Specify
<literal>/MISSING=COLUMNWISE</literal> to make <literal>AGGREGATE</literal> output a missing
value when one or more of the input values are missing.
</para>
<para>The <literal>BREAK</literal> subcommand is optionally but usually present. On
<literal>BREAK</literal>, list the variables used to divide the active dataset
into groups to be summarized.
</para>
<para><literal>AGGREGATE</literal> is particular about the order of subcommands.
<literal>OUTFILE</literal> must be first, followed by <literal>MISSING</literal>.
<literal>PRESORTED</literal> and <literal>DOCUMENT</literal> follow <literal>MISSING</literal>, in
either order, followed by <literal>BREAK</literal>, then followed by aggregation
variable specifications.
</para>
<para>At least one set of aggregation variables is required. Each set
comprises a list of aggregation variables, an equals sign (‘<literal>=</literal>’),
the name of an aggregation function (see the list below), and a list
of source variables in parentheses. A few aggregation functions do
not accept source variables, and some aggregation functions expect
additional arguments after the source variable names.
</para>
<para><literal>AGGREGATE</literal> typically creates aggregation variables with no
variable label, value labels, or missing values. Their default print
and write formats depend on the aggregation function used, with
details given in the table below. A variable label for an aggregation
variable may be specified just after the variable’s name in the
aggregation variable list.
</para>
<para>Each set must have exactly as many source variables as aggregation
variables. Each aggregation variable receives the results of applying
the specified aggregation function to the corresponding source
variable.
</para>
<para>The following aggregation functions may be applied only to numeric
variables:
</para>
<variablelist><varlistentry><term><literal>MEAN(<replaceable>var_name</replaceable>…)</literal>
</term><listitem><para>Arithmetic mean. Limited to numeric values. The default format is
F8.2.
</para>
</listitem></varlistentry><varlistentry><term><literal>MEDIAN(<replaceable>var_name</replaceable>…)</literal>
</term><listitem><para>The median value. Limited to numeric values. The default format is F8.2.
</para>
</listitem></varlistentry><varlistentry><term><literal>SD(<replaceable>var_name</replaceable>…)</literal>
</term><listitem><para>Standard deviation of the mean. Limited to numeric values. The
default format is F8.2.
</para>
</listitem></varlistentry><varlistentry><term><literal>SUM(<replaceable>var_name</replaceable>…)</literal>
</term><listitem><para>Sum. Limited to numeric values. The default format is F8.2.
</para></listitem></varlistentry></variablelist>
<para>These aggregation functions may be applied to numeric and string variables:
</para>
<variablelist><varlistentry><term><literal>CGT(<replaceable>var_name</replaceable>…, <replaceable>value</replaceable>)</literal>
</term><term><literal>CLT(<replaceable>var_name</replaceable>…, <replaceable>value</replaceable>)</literal>
</term><term><literal>CIN(<replaceable>var_name</replaceable>…, <replaceable>low</replaceable>, <replaceable>high</replaceable>)</literal>
</term><term><literal>COUT(<replaceable>var_name</replaceable>…, <replaceable>low</replaceable>, <replaceable>high</replaceable>)</literal>
</term><listitem><para>Total weight of cases greater than or less than <replaceable>value</replaceable> or inside
or outside the closed range [<replaceable>low</replaceable>,<replaceable>high</replaceable>], respectively. The
default format is F5.3.
</para>
</listitem></varlistentry><varlistentry><term><literal>FGT(<replaceable>var_name</replaceable>…, <replaceable>value</replaceable>)</literal>
</term><term><literal>FLT(<replaceable>var_name</replaceable>…, <replaceable>value</replaceable>)</literal>
</term><term><literal>FIN(<replaceable>var_name</replaceable>…, <replaceable>low</replaceable>, <replaceable>high</replaceable>)</literal>
</term><term><literal>FOUT(<replaceable>var_name</replaceable>…, <replaceable>low</replaceable>, <replaceable>high</replaceable>)</literal>
</term><listitem><para>Fraction of values greater than or less than <replaceable>value</replaceable> or inside or
outside the closed range [<replaceable>low</replaceable>,<replaceable>high</replaceable>], respectively. The
default format is F5.3.
</para>
</listitem></varlistentry><varlistentry><term><literal>FIRST(<replaceable>var_name</replaceable>…)</literal>
</term><term><literal>LAST(<replaceable>var_name</replaceable>…)</literal>
</term><listitem><para>First or last non-missing value, respectively, in break group. The
aggregation variable
receives the complete dictionary information from the source variable.
The sort performed by <literal>AGGREGATE</literal> (and by <literal>SORT CASES</literal>) is stable.
This means that
the first (or last) case with particular values for the break variables before
sorting is also the first (or last) case in that break group after sorting.
</para>
</listitem></varlistentry><varlistentry><term><literal>MIN(<replaceable>var_name</replaceable>…)</literal>
</term><term><literal>MAX(<replaceable>var_name</replaceable>…)</literal>
</term><listitem><para>Minimum or maximum value, respectively. The aggregation variable
receives the complete dictionary information from the source variable.
</para>
</listitem></varlistentry><varlistentry><term><literal>N(<replaceable>var_name</replaceable>…)</literal>
</term><term><literal>NMISS(<replaceable>var_name</replaceable>…)</literal>
</term><listitem><para>Total weight of non-missing or missing values, respectively. The
default format is F7.0 if weighting is not enabled, F8.2 if it is
(see <link linkend="WEIGHT">WEIGHT</link>).
</para>
</listitem></varlistentry><varlistentry><term><literal>NU(<replaceable>var_name</replaceable>…)</literal>
</term><term><literal>NUMISS(<replaceable>var_name</replaceable>…)</literal>
</term><listitem><para>Count of non-missing or missing values, respectively, ignoring case
weights. The default format is F7.0.
</para>
</listitem></varlistentry><varlistentry><term><literal>PGT(<replaceable>var_name</replaceable>…, <replaceable>value</replaceable>)</literal>
</term><term><literal>PLT(<replaceable>var_name</replaceable>…, <replaceable>value</replaceable>)</literal>
</term><term><literal>PIN(<replaceable>var_name</replaceable>…, <replaceable>low</replaceable>, <replaceable>high</replaceable>)</literal>
</term><term><literal>POUT(<replaceable>var_name</replaceable>…, <replaceable>low</replaceable>, <replaceable>high</replaceable>)</literal>
</term><listitem><para>Percentage between 0 and 100 of values greater than or less than
<replaceable>VALUE</replaceable> or inside or outside the closed range
[<replaceable>low</replaceable>,<replaceable>high</replaceable>], respectively. The default format is F5.1.
</para></listitem></varlistentry></variablelist>
<para>These aggregation functions do not accept source variables:
</para>
<variablelist><varlistentry><term><literal>N</literal>
</term><listitem><para>Total weight of cases aggregated to form this group. The default
format is F7.0 if weighting is not enabled, F8.2 if it is
(see <link linkend="WEIGHT">WEIGHT</link>).
</para>
</listitem></varlistentry><varlistentry><term><literal>NU</literal>
</term><listitem><para>Count of cases aggregated to form this group, ignoring case weights.
The default format is F7.0.
</para></listitem></varlistentry></variablelist>
<para>Aggregation functions compare string values in terms of internal
character codes.
On most modern computers, this is <acronym>ASCII</acronym> or a superset thereof.
</para>
<para>The aggregation functions listed above exclude all user-missing values
from calculations. To include user-missing values, insert a period
(‘<literal>.</literal>’) at the end of the function name. (<emphasis>e.g.</emphasis> ‘<literal>SUM.</literal>’).
(Be aware that specifying such a function as the last token on a line
causes the period to be interpreted as the end of the command.)
</para>
<para><literal>AGGREGATE</literal> both ignores and cancels the current <literal>SPLIT FILE</literal>
settings (see <link linkend="SPLIT-FILE">SPLIT FILE</link>).
</para>
<sect2 label="12.1.1">
<title>Aggregate Example</title>
<para>The <filename>personnel.sav</filename> dataset provides the occupations and salaries of
many individuals. For many purposes however such detailed information is
not interesting, but often the aggregated statistics of each occupation are
of interest. In <link linkend="aggregate_003aex">aggregate:ex</link> the <literal>AGGREGATE</literal> command is used
to calculate the mean, the median and the standard deviation of each
occupation.
</para>
<anchor id="aggregate_003aex"/>
<sidebar><screen>GET FILE="personnel.sav".
AGGREGATE OUTFILE=* MODE=REPLACE
/BREAK=occupation
/occ_mean_salary=MEAN(salary)
/occ_median_salary=MEDIAN(salary)
/occ_std_dev_salary=SD(salary).
LIST.
</screen></sidebar>
<para>Since we chose the ‘<literal>MODE=REPLACE</literal>’ option, in <link linkend="aggregate_003ares">aggregate:res</link> cases
for the individual persons are no longer present. They have each been replaced
by a single case per aggregated value.
</para>
<anchor id="aggregate_003ares"/>
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Data List
+------------------+---------------+-----------------+------------------+
| occupation |occ_mean_salary|occ_median_salary|occ_std_dev_salary|
+------------------+---------------+-----------------+------------------+
|Artist | 37836.18| 34712.50| 7631.48|
|Baker | 45075.20| 45075.20| 4411.21|
|Barrister | 39504.00| 39504.00| .|
|Carpenter | 39349.11| 36190.04| 7453.40|
|Cleaner | 41142.50| 39647.49| 14378.98|
|Cook | 40357.79| 43194.00| 11064.51|
|Manager | 46452.14| 45657.56| 6901.69|
|Mathematician | 34531.06| 34763.06| 5267.68|
|Painter | 45063.55| 45063.55| 15159.67|
|Payload Specialist| 34355.72| 34355.72| .|
|Plumber | 40413.91| 40410.00| 4726.05|
|Scientist | 36687.07| 36803.83| 10873.54|
|Scrientist | 42530.65| 42530.65| .|
|Tailor | 34586.79| 34586.79| 3728.98|
+------------------+---------------+-----------------+------------------+
</screen>
<para>Note that some values for the standard deviation are blank.
This is because there is only one case with the respective
occupation.
</para>
</sect2>
</sect1>
<sect1 label="12.2" id="AUTORECODE">
<title>AUTORECODE</title>
<indexterm role="vr"><primary>AUTORECODE</primary></indexterm>
<literallayout>AUTORECODE VARIABLES=<replaceable>src_vars</replaceable> INTO <replaceable>dest_vars</replaceable>
[ /DESCENDING ]
[ /PRINT ]
[ /GROUP ]
[ /BLANK = {VALID, MISSING} ]
</literallayout>
<para>The <literal>AUTORECODE</literal> procedure considers the <replaceable>n</replaceable> values that a variable
takes on and maps them onto values 1…<replaceable>n</replaceable> on a new numeric
variable.
</para>
<para>Subcommand <literal>VARIABLES</literal> is the only required subcommand and must come
first. Specify <literal>VARIABLES</literal>, an equals sign (‘<literal>=</literal>’), a list of source
variables, <literal>INTO</literal>, and a list of target variables. There must the same
number of source and target variables. The target variables must not
already exist.
</para>
<para><literal>AUTORECODE</literal> ordinarily assigns each increasing non-missing value
of a source variable (for a string, this is based on character code
comparisons) to consecutive values of its target variable. For
example, the smallest non-missing value of the source variable is
recoded to value 1, the next smallest to 2, and so on. If the source
variable has user-missing values, they are recoded to
consecutive values just above the non-missing values. For example, if
a source variables has seven distinct non-missing values, then the
smallest missing value would be recoded to 8, the next smallest to 9,
and so on.
</para>
<para>Use <literal>DESCENDING</literal> to reverse the sort order for non-missing
values, so that the largest non-missing value is recoded to 1, the
second-largest to 2, and so on. Even with <literal>DESCENDING</literal>,
user-missing values are still recoded in ascending order just above
the non-missing values.
</para>
<para>The system-missing value is always recoded into the system-missing
variable in target variables.
</para>
<para>If a source value has a value label, then that value label is retained
for the new value in the target variable. Otherwise, the source value
itself becomes each new value’s label.
</para>
<para>Variable labels are copied from the source to target variables.
</para>
<para><literal>PRINT</literal> is currently ignored.
</para>
<para>The <literal>GROUP</literal> subcommand is relevant only if more than one variable is to be
recoded. It causes a single mapping between source and target values to
be used, instead of one map per variable. With <literal>GROUP</literal>,
user-missing values are taken from the first source variable that has
any user-missing values.
</para>
<para>If <literal>/BLANK=MISSING</literal> is given, then string variables which contain only
whitespace are recoded as SYSMIS. If <literal>/BLANK=VALID</literal> is specified then they
are allocated a value like any other. <literal>/BLANK</literal> is not relevant
to numeric values. <literal>/BLANK=VALID</literal> is the default.
</para>
<para><literal>AUTORECODE</literal> is a procedure. It causes the data to be read. It
ignores <literal>TEMPORARY</literal> (see <link linkend="TEMPORARY">TEMPORARY</link>), so that “temporary”
transformations become permanent.
</para>
<sect2 label="12.2.1">
<title>Autorecode Example</title>
<para>In the file <filename>personnel.sav</filename>, the variable <emphasis role="bold">occupation</emphasis> is a string
variable. Except for data of a purely commentary nature, string variables
are generally a bad idea. One reason is that data entry errors are easily
overlooked. This has happened in <filename>personnel.sav</filename>; one entry which should
read “Scientist” has been mistyped as “Scrientist”. In <link linkend="autorecode_003aex">autorecode:ex</link>
first, this error is corrected by the <literal>DO IF</literal> clause,
<footnote><para>One must use care when correcting such data input errors rather than
msimply marking them as missing. For example, if an occupation has been entered
“Barister”, did the person mean “Barrister” or did she mean “Barista”?</para></footnote>
then we use <literal>AUTORECODE</literal> to
create a new numeric variable which takes recoded values of <emphasis role="bold">occupation</emphasis>.
Finally, we remove the old variable and rename the new variable to
the name of the old variable.
</para>
<anchor id="autorecode_003aex"/>
<sidebar><screen>get file='personnel.sav'.
* Correct a typing error in the original file.
do if occupation = "Scrientist".
compute occupation = "Scientist".
end if.
autorecode
variables = occupation into occ
/blank = missing.
* Delete the old variable.
delete variables occupation.
* Rename the new variable to the old variable's name.
rename variables (occ = occupation).
* Inspect the new variable.
display dictionary /variables=occupation.
</screen></sidebar>
<anchor id="autorecode_003ascr"/>
<sidebar></sidebar>
<para>Notice in <link linkend="autorecode_003ares">autorecode:res</link>, how the new variable has been automatically
allocated value labels which correspond to the strings of the old variable.
This means that in future analyses the descriptive strings are reported instead
of the numeric values.
</para>
<anchor id="autorecode_003ares"/>
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Variables
+----------+--------+--------------+-----+-----+---------+----------+---------+
| | | Measurement | | | | Print | Write |
|Name |Position| Level | Role|Width|Alignment| Format | Format |
+----------+--------+--------------+-----+-----+---------+----------+---------+
|occupation| 6|Unknown |Input| 8|Right |F2.0 |F2.0 |
+----------+--------+--------------+-----+-----+---------+----------+---------+
Value Labels
+---------------+------------------+
|Variable Value | Label |
+---------------+------------------+
|occupation 1 |Artist |
| 2 |Baker |
| 3 |Barrister |
| 4 |Carpenter |
| 5 |Cleaner |
| 6 |Cook |
| 7 |Manager |
| 8 |Mathematician |
| 9 |Painter |
| 10 |Payload Specialist|
| 11 |Plumber |
| 12 |Scientist |
| 13 |Tailor |
+---------------+------------------+
</screen>
</sect2>
</sect1>
<sect1 label="12.3" id="COMPUTE">
<title>COMPUTE</title>
<indexterm role="vr"><primary>COMPUTE</primary></indexterm>
<literallayout>COMPUTE <replaceable>variable</replaceable> = <replaceable>expression</replaceable>.
</literallayout><para>or
</para><literallayout>COMPUTE vector(<replaceable>index</replaceable>) = <replaceable>expression</replaceable>.
</literallayout>
<para><literal>COMPUTE</literal> assigns the value of an expression to a target
variable. For each case, the expression is evaluated and its value
assigned to the target variable. Numeric and string
variables may be assigned. When a string expression’s width differs
from the target variable’s width, the string result of the expression
is truncated or padded with spaces on the right as necessary. The
expression and variable types must match.
</para>
<para>For numeric variables only, the target variable need not already
exist. Numeric variables created by <literal>COMPUTE</literal> are assigned an
<literal>F8.2</literal> output format. String variables must be declared before
they can be used as targets for <literal>COMPUTE</literal>.
</para>
<para>The target variable may be specified as an element of a vector
(see <link linkend="VECTOR">VECTOR</link>). In this case, an expression <replaceable>index</replaceable> must be
specified in parentheses following the vector name. The expression <replaceable>index</replaceable>
must evaluate to a numeric value that, after rounding down
to the nearest integer, is a valid index for the named vector.
</para>
<para>Using <literal>COMPUTE</literal> to assign to a variable specified on <literal>LEAVE</literal>
(see <link linkend="LEAVE">LEAVE</link>) resets the variable’s left state. Therefore,
<literal>LEAVE</literal> should be specified following <literal>COMPUTE</literal>, not before.
</para>
<para><literal>COMPUTE</literal> is a transformation. It does not cause the active dataset to be
read.
</para>
<para>When <literal>COMPUTE</literal> is specified following <literal>TEMPORARY</literal>
(see <link linkend="TEMPORARY">TEMPORARY</link>), the <literal>LAG</literal> function may not be used
(see <link linkend="LAG">LAG</link>).
</para>
<sect2 label="12.3.1">
<title>Compute Examples</title>
<para>The dataset <filename>physiology.sav</filename> contains the height and weight of persons.
For some purposes, neither height nor weight alone is of interest.
Epidemiologists are often more interested in the <firstterm>body mass index</firstterm> which
can sometimes be used as a predictor for clinical conditions.
The body mass index is defined as the weight of the person in kilograms divided
by the square of the person’s height in metres.
<footnote><para>Since BMI is a quantity with a ratio scale and has units, the term “index”
is a misnomer, but that is what it is called.</para></footnote>
</para>
<anchor id="bmi_003aex"/>
<sidebar><screen>get file='physiology.sav'.
* height is in mm so we must divide by 1000 to get metres.
compute bmi = weight / (height/1000)**2.
variable label bmi "Body Mass Index".
descriptives /weight height bmi.
</screen></sidebar>
<para><link linkend="bmi_003aex">bmi:ex</link> shows how you can use <literal>COMPUTE</literal> to generate a new variable called
<emphasis role="bold">bmi</emphasis> and have every case’s value calculated from the existing values of
<emphasis role="bold">weight</emphasis> and <emphasis role="bold">height</emphasis>.
It also shows how you can add a label to this new variable (see <link linkend="VARIABLE-LABELS">VARIABLE LABELS</link>),
so that a more descriptive label appears in subsequent analyses, and this can be seen
in the ouput from the <literal>DESCRIPTIVES</literal> command in <link linkend="bmi_003ares">bmi:res</link>.
</para>
<anchor id="bmi_003ascr"/>
<sidebar></sidebar>
<para>The expression which follows the ‘<literal>=</literal>’ sign can be as complicated as necessary.
See <link linkend="Expressions">Expressions</link> for a precise description of the language accepted.
Normally it is easiest to enter the code directly, however there is a dialog box
available if desired. This is illustrated in <link linkend="bmi_003ascr">bmi:scr</link>.
One advantage is that it offers a list of mathematical
functions which can be selected and pasted into the expression.
</para>
<anchor id="bmi_003ares"/>
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Descriptive Statistics
+---------------------+--+-------+-------+-------+-------+
| | N| Mean |Std Dev|Minimum|Maximum|
+---------------------+--+-------+-------+-------+-------+
|Weight in kilograms |40| 72.12| 26.70| -55.6| 92.1|
|Height in millimeters|40|1677.12| 262.87| 179| 1903|
|Body Mass Index |40| 67.46| 274.08| -21.62|1756.82|
|Valid N (listwise) |40| | | | |
|Missing N (listwise) | 0| | | | |
+---------------------+--+-------+-------+-------+-------+
</screen>
</sect2>
</sect1>
<sect1 label="12.4" id="COUNT">
<title>COUNT</title>
<indexterm role="vr"><primary>COUNT</primary></indexterm>
<literallayout>COUNT <replaceable>var_name</replaceable> = <replaceable>var</replaceable>… (<replaceable>value</replaceable>…)
[/<replaceable>var_name</replaceable> = <replaceable>var</replaceable>… (<replaceable>value</replaceable>…)]…
Each <replaceable>value</replaceable> takes one of the following forms:
<replaceable>number</replaceable>
<replaceable>string</replaceable>
<replaceable>num1</replaceable> THRU <replaceable>num2</replaceable>
MISSING
SYSMIS
where <replaceable>num1</replaceable> is a numeric expression or the words <literal>LO</literal> or <literal>LOWEST</literal>
and <replaceable>num2</replaceable> is a numeric expression or <literal>HI</literal> or <literal>HIGHEST</literal>.
</literallayout>
<para><literal>COUNT</literal> creates or replaces a numeric <firstterm>target</firstterm> variable that
counts the occurrence of a <firstterm>criterion</firstterm> value or set of values over
one or more <firstterm>test</firstterm> variables for each case.
</para>
<para>The target variable values are always nonnegative integers. They are
never missing. The target variable is assigned an F8.2 output format.
See <link linkend="Input-and-Output-Formats">Input and Output Formats</link>. Any variables, including
string variables, may be test variables.
</para>
<para>User-missing values of test variables are treated just like any other
values. They are <emphasis role="bold">not</emphasis> treated as system-missing values.
User-missing values that are criterion values or inside ranges of
criterion values are counted as any other values. However (for numeric
variables), keyword <literal>MISSING</literal> may be used to refer to all system-
and user-missing values.
</para>
<para><literal>COUNT</literal> target variables are assigned values in the order
specified. In the command <literal>COUNT <replaceable>A</replaceable>=<replaceable>A</replaceable> <replaceable>B</replaceable>(1) /<replaceable>B</replaceable>=<replaceable>A</replaceable> <replaceable>B</replaceable>(2).</literal>, the
following actions occur:
</para>
<itemizedlist><listitem><para>− The number of occurrences of 1 between <replaceable>A</replaceable> and <replaceable>B</replaceable> is counted.
</para>
</listitem><listitem><para>− <replaceable>A</replaceable> is assigned this value.
</para>
</listitem><listitem><para>− The number of occurrences of 1 between <replaceable>B</replaceable> and the <emphasis role="bold">new</emphasis>
value of <replaceable>A</replaceable> is counted.
</para>
</listitem><listitem><para>− <replaceable>B</replaceable> is assigned this value.
</para></listitem></itemizedlist>
<para>Despite this ordering, all <literal>COUNT</literal> criterion variables must exist
before the procedure is executed—they may not be created as target
variables earlier in the command! Break such a command into two
separate commands.
</para>
<sect2 label="12.4.1">
<title>Count Examples</title>
<para>In the survey results in dataset <filename>hotel.sav</filename> a manager wishes
to know how many respondents answered with low valued answers to questions
<emphasis role="bold">v1</emphasis>, <emphasis role="bold">v2</emphasis> and <emphasis role="bold">v3</emphasis>. This can be found using the code
in <link linkend="count_003aex">count:ex</link>. Specifically, this code creates a new variable, and
populates it with the number of values in <emphasis role="bold">v1</emphasis>–<emphasis role="bold">v2</emphasis> which
are 2 or lower.
</para>
<anchor id="count_003aex"/>
<sidebar><screen>get file="hotel.sav".
count low_counts = v1 v2 v3 (low thru 2).
list /variables v1 v2 v3 low_counts.</screen></sidebar>
<para>In <link linkend="count_003aex">count:ex</link> the <literal>COUNT</literal> transformation creates a new variable, <emphasis role="bold">low_counts</emphasis> and
its values are shown using the <literal>LIST</literal> command.
</para>
<para>If using the graphic user interface, a two step process must be used to set
up the <literal>COUNT</literal> transformation. The first dialog box (<link linkend="count_003ascr">count:scr</link>) provides for the
variables to be chosen.
Then, one must click on the button marked “Define Values...” to reveal
the dialog box for selecting the values to count.
</para>
<anchor id="count_003ascr"/>
<sidebar></sidebar>
<para>In this dialog box, you must select the values you wish to count
— in this case all values up to and including 2 — as shown in <link linkend="count_002ddefine_003ascr">count-define:scr</link>
and click “Add”. As many ranges or may be added as you desire.
When all desired ranges have been added click “Continue”.
</para>
<anchor id="count_002ddefine_003ascr"/>
<sidebar></sidebar>
<para>In <link linkend="count_003ares">count:res</link> we can see the values of <emphasis role="bold">low_counts</emphasis> after the <literal>COUNT</literal>
transformation has completed. The first value is 1, because there is only one
variable amoung <emphasis role="bold">v1</emphasis>, <emphasis role="bold">v2</emphasis> and <emphasis role="bold">3</emphasis> which has a value of 2 or less.
The second value is 2, because both <emphasis role="bold">v1</emphasis> and <emphasis role="bold">v2</emphasis> are 2 or less.
</para>
<anchor id="count_003ares"/>
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Data List
+--+--+--+----------+
|v1|v2|v3|low_counts|
+--+--+--+----------+
| 4| 2| 3| 1.00|
| 1| 1| 4| 2.00|
| 4| 2| 2| 2.00|
| 3| 1| 3| 1.00|
| 5| 3| 1| 1.00|
| 2| 2| 5| 2.00|
| 3| 2| 4| 1.00|
| 1| 4| 5| 1.00|
| 3| 2| 3| 1.00|
| 2| 5| 4| 1.00|
| 4| 2| 2| 2.00|
| 2| 1| 4| 2.00|
| 1| 2| 5| 2.00|
| 2| 3| 3| 1.00|
| 4| 1| 1| 2.00|
| 1| 1| 5| 2.00|
| 1| 5| 5| 1.00|
+--+--+--+----------+
</screen>
</sect2>
</sect1>
<sect1 label="12.5" id="FLIP">
<title>FLIP</title>
<indexterm role="vr"><primary>FLIP</primary></indexterm>
<literallayout>FLIP /VARIABLES=<replaceable>var_list</replaceable> /NEWNAMES=<replaceable>var_name</replaceable>.
</literallayout>
<para><literal>FLIP</literal> transposes rows and columns in the active dataset. It
causes cases to be swapped with variables, and vice versa.
</para>
<para>All variables in the transposed active dataset are numeric. String
variables take on the system-missing value in the transposed file.
</para>
<para><literal>N</literal> subcommands are required. If specified, the <literal>VARIABLES</literal> subcommand
selects variables to be transformed into cases, and variables not
specified are discarded. If the <literal>VARIABLES</literal> subcommand is omitted, all
variables are selected for transposition.
</para>
<para>The variables specified by <literal>NEWNAMES</literal>, which must be a
string variable, is
used to give names to the variables created by <literal>FLIP</literal>. Only the
first 8 characters of the variable are used. If
<literal>NEWNAMES</literal> is not
specified then the default is a variable named <emphasis role="bold">CASE_LBL</emphasis>, if it exists.
If it does not then the variables created by <literal>FLIP</literal> are named VAR000
through VAR999, then VAR1000, VAR1001, and so on.
</para>
<para>When a <literal>NEWNAMES</literal> variable is available, the names must be canonicalized
before becoming variable names. Invalid characters are replaced by
letter ‘<literal>V</literal>’ in the first position, or by ‘<literal>_</literal>’ in subsequent
positions. If the name thus generated is not unique, then numeric
extensions are added, starting with 1, until a unique name is found or
there are no remaining possibilities. If the latter occurs then the
<literal>FLIP</literal> operation aborts.
</para>
<para>The resultant dictionary contains a <emphasis role="bold">CASE_LBL</emphasis> variable, a string
variable of width 8, which stores the names of the variables in the
dictionary before the transposition. Variables names longer than 8
characters are truncated. If <literal>FLIP</literal> is called again on
this dataset, the <emphasis role="bold">CASE_LBL</emphasis> variable can be passed to the <literal>NEWNAMES</literal>
subcommand to recreate the original variable names.
</para>
<para><literal>FLIP</literal> honors <literal>N OF CASES</literal> (see <link linkend="N-OF-CASES">N OF CASES</link>). It ignores
<literal>TEMPORARY</literal> (see <link linkend="TEMPORARY">TEMPORARY</link>), so that “temporary”
transformations become permanent.
</para>
<sect2 label="12.5.1">
<title>Flip Examples</title>
<para>In <link linkend="flip_003aex">flip:ex</link>, data has been entered using <literal>DATA LIST</literal> (see <link linkend="DATA-LIST">DATA LIST</link>)
such that the first variable in the dataset is a string variable containing
a description of the other data for the case.
Clearly this is not a convenient arrangement for performing statistical analyses,
so it would have been better to think a little more carefully about how the data
should have been arranged.
However often the data is provided by some third party source, and you have
no control over the form.
Fortunately, we can use <literal>FLIP</literal> to exchange the variables
and cases in the active dataset.
</para>
<anchor id="flip_003aex"/>
<sidebar><screen>data list notable list /heading (a16) v1 v2 v3 v4 v5 v6
begin data.
date-of-birth 1970 1989 2001 1966 1976 1982
sex 1 0 0 1 0 1
score 10 10 9 3 8 9
end data.
echo 'Before FLIP:'.
display variables.
list.
flip /variables = all /newnames = heading.
echo 'After FLIP:'.
display variables.
list.</screen></sidebar>
<para>As you can see in <link linkend="flip_003ares">flip:res</link> before the <literal>FLIP</literal> command has run there
are seven variables (six containing data and one for the heading) and three cases.
Afterwards there are four variables (one per case, plus the <emphasis role="bold">CASE_LBL</emphasis> variable)
and six cases.
You can delete the <emphasis role="bold">CASE_LBL</emphasis> variable (see <link linkend="DELETE-VARIABLES">DELETE VARIABLES</link>) if you don’t need it.
</para>
<anchor id="flip_003ares"/>
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen>Before FLIP:
Variables
+-------+--------+------------+------------+
|Name |Position|Print Format|Write Format|
+-------+--------+------------+------------+
|heading| 1|A16 |A16 |
|v1 | 2|F8.2 |F8.2 |
|v2 | 3|F8.2 |F8.2 |
|v3 | 4|F8.2 |F8.2 |
|v4 | 5|F8.2 |F8.2 |
|v5 | 6|F8.2 |F8.2 |
|v6 | 7|F8.2 |F8.2 |
+-------+--------+------------+------------+
Data List
+-------------+-------+-------+-------+-------+-------+-------+
| heading | v1 | v2 | v3 | v4 | v5 | v6 |
+-------------+-------+-------+-------+-------+-------+-------+
|date-of-birth|1970.00|1989.00|2001.00|1966.00|1976.00|1982.00|
|sex | 1.00| .00| .00| 1.00| .00| 1.00|
|score | 10.00| 10.00| 9.00| 3.00| 8.00| 9.00|
+-------------+-------+-------+-------+-------+-------+-------+
After FLIP:
Variables
+-------------+--------+------------+------------+
|Name |Position|Print Format|Write Format|
+-------------+--------+------------+------------+
|CASE_LBL | 1|A8 |A8 |
|date_of_birth| 2|F8.2 |F8.2 |
|sex | 3|F8.2 |F8.2 |
|score | 4|F8.2 |F8.2 |
+-------------+--------+------------+------------+
Data List
+--------+-------------+----+-----+
|CASE_LBL|date_of_birth| sex|score|
+--------+-------------+----+-----+
|v1 | 1970.00|1.00|10.00|
|v2 | 1989.00| .00|10.00|
|v3 | 2001.00| .00| 9.00|
|v4 | 1966.00|1.00| 3.00|
|v5 | 1976.00| .00| 8.00|
|v6 | 1982.00|1.00| 9.00|
+--------+-------------+----+-----+
</screen>
</sect2>
</sect1>
<sect1 label="12.6" id="IF">
<title>IF</title>
<indexterm role="vr"><primary>IF</primary></indexterm>
<literallayout>IF <replaceable>condition</replaceable> <replaceable>variable</replaceable>=<replaceable>expression</replaceable>.
</literallayout><para>or
</para><literallayout>IF <replaceable>condition</replaceable> vector(<replaceable>index</replaceable>)=<replaceable>expression</replaceable>.
</literallayout>
<para>The <literal>IF</literal> transformation conditionally assigns the value of a target
expression to a target variable, based on the truth of a test
expression.
</para>
<para>Specify a boolean-valued expression (see <link linkend="Expressions">Expressions</link>) to be tested
following the <literal>IF</literal> keyword. This expression is evaluated for each case.
If the value is true, then the value of the expression is computed and
assigned to the specified variable. If the value is false or missing,
nothing is done. Numeric and string variables may be
assigned. When a string expression’s width differs from the target
variable’s width, the string result of the expression is truncated or
padded with spaces on the right as necessary. The expression and
variable types must match.
</para>
<para>The target variable may be specified as an element of a vector
(see <link linkend="VECTOR">VECTOR</link>). In this case, a vector index expression must be
specified in parentheses following the vector name. The index
expression must evaluate to a numeric value that, after rounding down
to the nearest integer, is a valid index for the named vector.
</para>
<para>Using <literal>IF</literal> to assign to a variable specified on <literal>LEAVE</literal>
(see <link linkend="LEAVE">LEAVE</link>) resets the variable’s left state. Therefore,
<literal>LEAVE</literal> should be specified following <literal>IF</literal>, not before.
</para>
<para>When <literal>IF</literal> is specified following <literal>TEMPORARY</literal>
(see <link linkend="TEMPORARY">TEMPORARY</link>), the <literal>LAG</literal> function may not be used
(see <link linkend="LAG">LAG</link>).
</para>
</sect1>
<sect1 label="12.7" id="RECODE">
<title>RECODE</title>
<indexterm role="vr"><primary>RECODE</primary></indexterm>
<para>The <literal>RECODE</literal> command is used to transform existing values into other,
user specified values.
The general form is:
</para>
<literallayout>RECODE <replaceable>src_vars</replaceable>
(<replaceable>src_value</replaceable> <replaceable>src_value</replaceable> … = <replaceable>dest_value</replaceable>)
(<replaceable>src_value</replaceable> <replaceable>src_value</replaceable> … = <replaceable>dest_value</replaceable>)
(<replaceable>src_value</replaceable> <replaceable>src_value</replaceable> … = <replaceable>dest_value</replaceable>) …
[INTO <replaceable>dest_vars</replaceable>].
</literallayout>
<para>Following the <literal>RECODE</literal> keyword itself comes <replaceable>src_vars</replaceable> which is a list
of variables whose values are to be transformed.
These variables may be string variables or they may be numeric.
However the list must be homogeneous; you may not mix string variables and
numeric variables in the same recoding.
</para>
<para>After the list of source variables, there should be one or more <firstterm>mappings</firstterm>.
Each mapping is enclosed in parentheses, and contains the source values and
a destination value separated by a single ‘<literal>=</literal>’.
The source values are used to specify the values in the dataset which
need to change, and the destination value specifies the new value
to which they should be changed.
Each <replaceable>src_value</replaceable> may take one of the following forms:
</para><variablelist><varlistentry><term><replaceable>number</replaceable>
</term><listitem><para>If the source variables are numeric then <replaceable>src_value</replaceable> may be a literal
number.
</para></listitem></varlistentry><varlistentry><term><replaceable>string</replaceable>
</term><listitem><para>If the source variables are string variables then <replaceable>src_value</replaceable> may be a
literal string (like all strings, enclosed in single or double quotes).
</para></listitem></varlistentry><varlistentry><term><replaceable>num1</replaceable> THRU <replaceable>num2</replaceable>
</term><listitem><para>This form is valid only when the source variables are numeric.
It specifies all values in the range between <replaceable>num1</replaceable> and <replaceable>num2</replaceable>,
including both endpoints of the range. By convention, <replaceable>num1</replaceable>
should be less than <replaceable>num2</replaceable>.
Open-ended ranges may be specified using ‘<literal>LO</literal>’ or ‘<literal>LOWEST</literal>’
for <replaceable>num1</replaceable>
or ‘<literal>HI</literal>’ or ‘<literal>HIGHEST</literal>’ for <replaceable>num2</replaceable>.
</para></listitem></varlistentry><varlistentry><term>‘<literal>MISSING</literal>’
</term><listitem><para>The literal keyword ‘<literal>MISSING</literal>’ matches both system missing and user
missing values.
It is valid for both numeric and string variables.
</para></listitem></varlistentry><varlistentry><term>‘<literal>SYSMIS</literal>’
</term><listitem><para>The literal keyword ‘<literal>SYSMIS</literal>’ matches system missing
values.
It is valid for both numeric variables only.
</para></listitem></varlistentry><varlistentry><term>‘<literal>ELSE</literal>’
</term><listitem><para>The ‘<literal>ELSE</literal>’ keyword may be used to match any values which are
not matched by any other <replaceable>src_value</replaceable> appearing in the command.
If this keyword appears, it should be used in the last mapping of the
command.
</para></listitem></varlistentry></variablelist>
<para>After the source variables comes an ‘<literal>=</literal>’ and then the <replaceable>dest_value</replaceable>.
The <replaceable>dest_value</replaceable> may take any of the following forms:
</para><variablelist><varlistentry><term><replaceable>number</replaceable>
</term><listitem><para>A literal numeric value to which the source values should be changed.
This implies the destination variable must be numeric.
</para></listitem></varlistentry><varlistentry><term><replaceable>string</replaceable>
</term><listitem><para>A literal string value (enclosed in quotation marks) to which the source
values should be changed.
This implies the destination variable must be a string variable.
</para></listitem></varlistentry><varlistentry><term>‘<literal>SYSMIS</literal>’
</term><listitem><para>The keyword ‘<literal>SYSMIS</literal>’ changes the value to the system missing value.
This implies the destination variable must be numeric.
</para></listitem></varlistentry><varlistentry><term>‘<literal>COPY</literal>’
</term><listitem><para>The special keyword ‘<literal>COPY</literal>’ means that the source value should not be
modified, but
copied directly to the destination value.
This is meaningful only if ‘<literal>INTO <replaceable>dest_vars</replaceable></literal>’ is specified.
</para></listitem></varlistentry></variablelist>
<para>Mappings are considered from left to right.
Therefore, if a value is matched by a <replaceable>src_value</replaceable> from more than
one mapping, the first (leftmost) mapping which matches is considered.
Any subsequent matches are ignored.
</para>
<para>The clause ‘<literal>INTO <replaceable>dest_vars</replaceable></literal>’ is optional.
The behaviour of the command is slightly different depending on whether it
appears or not.
</para>
<para>If ‘<literal>INTO <replaceable>dest_vars</replaceable></literal>’ does not appear, then values are recoded
“in place”.
This means that the recoded values are written back to the
source variables from whence the original values came.
In this case, the <replaceable>dest_value</replaceable> for every mapping must imply a value which
has the same type as the <replaceable>src_value</replaceable>.
For example, if the source value is a string value, it is not permissible for
<replaceable>dest_value</replaceable> to be ‘<literal>SYSMIS</literal>’ or another forms which implies a numeric
result.
It is also not permissible for <replaceable>dest_value</replaceable> to be longer than the width
of the source variable.
</para>
<para>The following example two numeric variables <replaceable>x</replaceable> and <replaceable>y</replaceable> are recoded
in place.
Zero is recoded to 99, the values 1 to 10 inclusive are unchanged,
values 1000 and higher are recoded to the system-missing value and all other
values are changed to 999:
</para><screen>recode <replaceable>x</replaceable> <replaceable>y</replaceable>
(0 = 99)
(1 THRU 10 = COPY)
(1000 THRU HIGHEST = SYSMIS)
(ELSE = 999).
</screen>
<para>If ‘<literal>INTO <replaceable>dest_vars</replaceable></literal>’ is given, then recoded values are written
into the variables specified in <replaceable>dest_vars</replaceable>, which must therefore
contain a list of valid variable names.
The number of variables in <replaceable>dest_vars</replaceable> must be the same as the number
of variables in <replaceable>src_vars</replaceable>
and the respective order of the variables in <replaceable>dest_vars</replaceable> corresponds to
the order of <replaceable>src_vars</replaceable>.
That is to say, the recoded value whose
original value came from the <replaceable>n</replaceable>th variable in <replaceable>src_vars</replaceable> is
placed into the <replaceable>n</replaceable>th variable in <replaceable>dest_vars</replaceable>.
The source variables are unchanged.
If any mapping implies a string as its destination value, then the respective
destination variable must already exist, or
have been declared using <literal>STRING</literal> or another transformation.
Numeric variables however are automatically created if they don’t already
exist.
The following example deals with two source variables, <replaceable>a</replaceable> and <replaceable>b</replaceable>
which contain string values. Hence there are two destination variables
<replaceable>v1</replaceable> and <replaceable>v2</replaceable>.
Any cases where <replaceable>a</replaceable> or <replaceable>b</replaceable> contain the values ‘<literal>apple</literal>’,
‘<literal>pear</literal>’ or ‘<literal>pomegranate</literal>’ result in <replaceable>v1</replaceable> or <replaceable>v2</replaceable> being
filled with the string ‘<literal>fruit</literal>’ whilst cases with
‘<literal>tomato</literal>’, ‘<literal>lettuce</literal>’ or ‘<literal>carrot</literal>’ result in ‘<literal>vegetable</literal>’.
Any other values produce the result ‘<literal>unknown</literal>’:
</para><screen>string <replaceable>v1</replaceable> (a20).
string <replaceable>v2</replaceable> (a20).
recode <replaceable>a</replaceable> <replaceable>b</replaceable>
("apple" "pear" "pomegranate" = "fruit")
("tomato" "lettuce" "carrot" = "vegetable")
(ELSE = "unknown")
into <replaceable>v1</replaceable> <replaceable>v2</replaceable>.
</screen>
<para>There is one very special mapping, not mentioned above.
If the source variable is a string variable
then a mapping may be specified as ‘<literal>(CONVERT)</literal>’.
This mapping, if it appears must be the last mapping given and
the ‘<literal>INTO <replaceable>dest_vars</replaceable></literal>’ clause must also be given and
must not refer to a string variable.
‘<literal>CONVERT</literal>’ causes a number specified as a string to
be converted to a numeric value.
For example it converts the string ‘<literal>"3"</literal>’ into the numeric
value 3 (note that it does not convert ‘<literal>three</literal>’ into 3).
If the string cannot be parsed as a number, then the system-missing value
is assigned instead.
In the following example, cases where the value of <replaceable>x</replaceable> (a string variable)
is the empty string, are recoded to 999 and all others are converted to the
numeric equivalent of the input value. The results are placed into the
numeric variable <replaceable>y</replaceable>:
</para><screen>recode <replaceable>x</replaceable>
("" = 999)
(convert)
into <replaceable>y</replaceable>.
</screen>
<para>It is possible to specify multiple recodings on a single command.
Introduce additional recodings with a slash (‘<literal>/</literal>’) to
separate them from the previous recodings:
</para><screen>recode
<replaceable>a</replaceable> (2 = 22) (else = 99)
/<replaceable>b</replaceable> (1 = 3) into <replaceable>z</replaceable>
.
</screen><para>Here we have two recodings. The first affects the source variable
<replaceable>a</replaceable> and recodes in-place the value 2 into 22 and all other values to 99.
The second recoding copies the values of <replaceable>b</replaceable> into the variable <replaceable>z</replaceable>,
changing any instances of 1 into 3.
</para>
</sect1>
<sect1 label="12.8" id="SORT-CASES">
<title>SORT CASES</title>
<indexterm role="vr"><primary>SORT CASES</primary></indexterm>
<literallayout>SORT CASES BY <replaceable>var_list</replaceable>[({D|A}] [ <replaceable>var_list</replaceable>[({D|A}] ] ...
</literallayout>
<para><literal>SORT CASES</literal> sorts the active dataset by the values of one or more
variables.
</para>
<para>Specify <literal>BY</literal> and a list of variables to sort by. By default, variables
are sorted in ascending order. To override sort order, specify <literal>(D)</literal> or
<literal>(DOWN)</literal> after a list of variables to get descending order, or <literal>(A)</literal>
or <literal>(UP)</literal>
for ascending order. These apply to all the listed variables
up until the preceding <literal>(A)</literal>, <literal>(D)</literal>, <literal>(UP)</literal> or <literal>(DOWN)</literal>.
</para>
<para>The sort algorithms used by <literal>SORT CASES</literal> are stable. This means
records which have equal values of the sort variables have the
same relative order before and after sorting. Thus,
re-sorting an already sorted file does not affect the ordering of
cases.
</para>
<para><literal>SORT CASES</literal> is a procedure. It causes the data to be read.
</para>
<para><literal>SORT CASES</literal> attempts to sort the entire active dataset in main memory.
If workspace is exhausted, it falls back to a merge sort algorithm which
creates numerous temporary files.
</para>
<para><literal>SORT CASES</literal> may not be specified following <literal>TEMPORARY</literal>.
</para>
<sect2 label="12.8.1">
<title>Sorting Example</title>
<para>In <link linkend="sort_002dcases_003aex">sort-cases:ex</link> the data from the file <filename>physiology.sav</filename> is sorted
by two variables, <emphasis>viz</emphasis> <emphasis role="bold">sex</emphasis> in descending order and <emphasis role="bold">temperature</emphasis> in
ascending order.
</para>
<anchor id="sort_002dcases_003aex"/>
<sidebar><screen>get file='physiology.sav'.
sort cases by sex (D) temperature(A).
list.
</screen></sidebar>
<para>In <link linkend="sort_002dcases_003ares">sort-cases:res</link> you can see that all the cases with a <emphasis role="bold">sex</emphasis> of
‘<literal>1</literal>’ (female) appear before those with a sex of ‘<literal>0</literal>’ (male).
This is because they have been sorted in descending order.
Within each sex, the data is sorted on the <emphasis role="bold">temperature</emphasis> variable,
this time in ascending order.
</para>
<anchor id="sort_002dcases_003ares"/>
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Data List
+---+------+------+-----------+
|sex|height|weight|temperature|
+---+------+------+-----------+
| 1| 1606| 56.1| 34.56|
| 1| 179| 56.3| 35.15|
| 1| 1609| 55.4| 35.46|
| 1| 1606| 56.0| 36.06|
| 1| 1607| 56.3| 36.26|
| 1| 1604| 56.0| 36.57|
| 1| 1604| 56.6| 36.81|
| 1| 1606| 56.3| 36.88|
| 1| 1604| 57.8| 37.32|
| 1| 1598| 55.6| 37.37|
| 1| 1607| 55.9| 37.84|
| 1| 1605| 54.5| 37.86|
| 1| 1603| 56.1| 38.80|
| 1| 1604| 58.1| 38.85|
| 1| 1605| 57.7| 38.98|
| 1| 1709| 55.6| 39.45|
| 1| 1604| -55.6| 39.72|
| 1| 1601| 55.9| 39.90|
| 0| 1799| 90.3| 32.59|
| 0| 1799| 89.0| 33.61|
| 0| 1799| 90.6| 34.04|
| 0| 1801| 90.5| 34.42|
| 0| 1802| 87.7| 35.03|
| 0| 1793| 90.1| 35.11|
| 0| 1801| 92.1| 35.98|
| 0| 1800| 89.5| 36.10|
| 0| 1645| 92.1| 36.68|
| 0| 1698| 90.2| 36.94|
| 0| 1800| 89.6| 37.02|
| 0| 1800| 88.9| 37.03|
| 0| 1801| 88.9| 37.12|
| 0| 1799| 90.4| 37.33|
| 0| 1903| 91.5| 37.52|
| 0| 1799| 90.9| 37.53|
| 0| 1800| 91.0| 37.60|
| 0| 1799| 90.4| 37.68|
| 0| 1801| 91.7| 38.98|
| 0| 1801| 90.9| 39.03|
| 0| 1799| 89.3| 39.77|
| 0| 1884| 88.6| 39.97|
+---+------+------+-----------+
</screen>
<para>Note that <literal>SORT CASES</literal>, like all other transformations, affects only the active file.
It does not have any effect upon the <filename>physiology.sav</filename> file itself. For that, you
would have to rewrite the file using the <literal>SAVE</literal> command (see <link linkend="SAVE">SAVE</link>).
</para>
<para>When using the graphic user interface, it is often simpler to perform a sort
directly from the data view.
To do this, switch to the data view. Select the column corresponding to the
variable by which you want to sort and click button 1 and then click button 3.
A popup menu will appear like that shown in <link linkend="sort_002dsimple_003ascr">sort-simple:scr</link>. Select
either “Sort Ascending” or “Sort Descending” from this menu.
</para>
<anchor id="sort_002dsimple_003ascr"/>
<sidebar></sidebar>
<para>However, sometimes you will want to sort on two or more variables, and that is
not possible using this method. In this case, you must either use some code or
the “Sort Cases” dialog from the Data menu. <link linkend="sort_003ascr">sort:scr</link> shows the dialog
box set up to perform a sort on both <emphasis role="bold">sex</emphasis> and <emphasis role="bold">height</emphasis>.
Note that the order in which you enter the variables is important. In this case,
the data will be first sorted on <emphasis role="bold">sex</emphasis>, and then all cases for which <emphasis role="bold">sex</emphasis>
is the same will then be sorted by <emphasis role="bold">height</emphasis>.
</para>
<anchor id="sort_003ascr"/>
<sidebar></sidebar><!-- PSPP - a program for statistical analysis. -->
<!-- Copyright (C) 2017, 2020 Free Software Foundation, Inc. -->
<!-- Permission is granted to copy, distribute and/or modify this document -->
<!-- under the terms of the GNU Free Documentation License, Version 1.3 -->
<!-- or any later version published by the Free Software Foundation; -->
<!-- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -->
<!-- A copy of the license is included in the section entitled "GNU -->
<!-- Free Documentation License". -->
<!-- -->
</sect2>
</sect1>
</chapter>
<chapter label="13" id="Data-Selection">
<title>Selecting data for analysis</title>
<para>This chapter documents PSPP commands that temporarily or permanently
select data records from the active dataset for analysis.
</para>
<sect1 label="13.1" id="FILTER">
<title>FILTER</title>
<indexterm role="vr"><primary>FILTER</primary></indexterm>
<literallayout>FILTER BY <replaceable>var_name</replaceable>.
FILTER OFF.
</literallayout>
<para><literal>FILTER</literal> allows a boolean-valued variable to be used to select
cases from the data stream for processing.
</para>
<para>To set up filtering, specify <literal>BY</literal> and a variable name. Keyword
BY is optional but recommended. Cases which have a zero or system- or
user-missing value are excluded from analysis, but not deleted from the
data stream. Cases with other values are analyzed.
To filter based on a different condition, use
transformations such as <literal>COMPUTE</literal> or <literal>RECODE</literal> to compute a
filter variable of the required form, then specify that variable on
<literal>FILTER</literal>.
</para>
<para><literal>FILTER OFF</literal> turns off case filtering.
</para>
<para>Filtering takes place immediately before cases pass to a procedure for
analysis. Only one filter variable may be active at a time. Normally,
case filtering continues until it is explicitly turned off with <literal>FILTER
OFF</literal>. However, if <literal>FILTER</literal> is placed after <literal>TEMPORARY</literal>, it filters only
the next procedure or procedure-like command.
</para>
</sect1>
<sect1 label="13.2" id="N-OF-CASES">
<title>N OF CASES</title>
<indexterm role="vr"><primary>N OF CASES</primary></indexterm>
<literallayout>N [OF CASES] <replaceable>num_of_cases</replaceable> [ESTIMATED].
</literallayout>
<para><literal>N OF CASES</literal> limits the number of cases processed by any
procedures that follow it in the command stream. <literal>N OF CASES
100</literal>, for example, tells PSPP to disregard all cases after the first
100.
</para>
<para>When <literal>N OF CASES</literal> is specified after <literal>TEMPORARY</literal>, it affects
only the next procedure (see <link linkend="TEMPORARY">TEMPORARY</link>). Otherwise, cases beyond
the limit specified are not processed by any later procedure.
</para>
<para>If the limit specified on <literal>N OF CASES</literal> is greater than the number
of cases in the active dataset, it has no effect.
</para>
<para>When <literal>N OF CASES</literal> is used along with <literal>SAMPLE</literal> or <literal>SELECT
IF</literal>, the case limit is applied to the cases obtained after sampling or
case selection, regardless of how <literal>N OF CASES</literal> is placed relative
to <literal>SAMPLE</literal> or <literal>SELECT IF</literal> in the command file. Thus, the
commands <literal>N OF CASES 100</literal> and <literal>SAMPLE .5</literal> both randomly
sample approximately half of the active dataset’s cases, then select the
first 100 of those sampled, regardless of their order in the command
file.
</para>
<para><literal>N OF CASES</literal> with the <literal>ESTIMATED</literal> keyword gives an estimated
number of cases before <literal>DATA LIST</literal> or another command to read in
data. <literal>ESTIMATED</literal> never limits the number of cases processed by
procedures. PSPP currently does not make use of case count estimates.
</para>
</sect1>
<sect1 label="13.3" id="SAMPLE">
<title>SAMPLE</title>
<indexterm role="vr"><primary>SAMPLE</primary></indexterm>
<literallayout>SAMPLE <replaceable>num1</replaceable> [FROM <replaceable>num2</replaceable>].
</literallayout>
<para><literal>SAMPLE</literal> randomly samples a proportion of the cases in the active
file. Unless it follows <literal>TEMPORARY</literal>, it operates as a
transformation, permanently removing cases from the active dataset.
</para>
<para>The proportion to sample can be expressed as a single number between 0
and 1. If <replaceable>k</replaceable> is the number specified, and <replaceable>N</replaceable> is the number
of currently-selected cases in the active dataset, then after
<literal>SAMPLE <replaceable>k</replaceable>.</literal>, approximately <replaceable>k</replaceable>*<replaceable>N</replaceable> cases are
selected.
</para>
<para>The proportion to sample can also be specified in the style <literal>SAMPLE
<replaceable>m</replaceable> FROM <replaceable>N</replaceable></literal>. With this style, cases are selected as follows:
</para>
<orderedlist numeration="arabic"><listitem><para>If <replaceable>N</replaceable> is equal to the number of currently-selected cases in the
active dataset, exactly <replaceable>m</replaceable> cases are selected.
</para>
</listitem><listitem><para>If <replaceable>N</replaceable> is greater than the number of currently-selected cases in the
active dataset, an equivalent proportion of cases are selected.
</para>
</listitem><listitem><para>If <replaceable>N</replaceable> is less than the number of currently-selected cases in the
active, exactly <replaceable>m</replaceable> cases are selected <emphasis>from the first
<replaceable>N</replaceable> cases in the active dataset.</emphasis>
</para></listitem></orderedlist>
<para><literal>SAMPLE</literal> and <literal>SELECT IF</literal> are performed in
the order specified by the syntax file.
</para>
<para><literal>SAMPLE</literal> is always performed before <literal>N OF CASES</literal>, regardless
of ordering in the syntax file (see <link linkend="N-OF-CASES">N OF CASES</link>).
</para>
<para>The same values for <literal>SAMPLE</literal> may result in different samples. To
obtain the same sample, use the <literal>SET</literal> command to set the random
number seed to the same value before each <literal>SAMPLE</literal>. Different
samples may still result when the file is processed on systems with
differing endianness or floating-point formats. By default, the
random number seed is based on the system time.
</para>
</sect1>
<sect1 label="13.4" id="SELECT-IF">
<title>SELECT IF</title>
<indexterm role="vr"><primary>SELECT IF</primary></indexterm>
<literallayout>SELECT IF <replaceable>expression</replaceable>.
</literallayout>
<para><literal>SELECT IF</literal> selects cases for analysis based on the value of
<replaceable>expression</replaceable>. Cases not selected are permanently eliminated
from the active dataset, unless <literal>TEMPORARY</literal> is in effect
(see <link linkend="TEMPORARY">TEMPORARY</link>).
</para>
<para>Specify a boolean expression (see <link linkend="Expressions">Expressions</link>). If the value of the
expression is true for a particular case, the case is analyzed. If
the expression has a false or missing value, then the case is
deleted from the data stream.
</para>
<para>Place <literal>SELECT IF</literal> as early in the command file as
possible. Cases that are deleted early can be processed more
efficiently in time and space.
Once cases have been deleted from the active dataset using <literal>SELECT IF</literal> they
cannot be re-instated.
If you want to be able to re-instate cases, then use <literal>FILTER</literal> (see <link linkend="FILTER">FILTER</link>)
instead.
</para>
<para>When <literal>SELECT IF</literal> is specified following <literal>TEMPORARY</literal>
(see <link linkend="TEMPORARY">TEMPORARY</link>), the <literal>LAG</literal> function may not be used
(see <link linkend="LAG">LAG</link>).
</para>
<sect2 label="13.4.1">
<title>Example Select-If</title>
<para>A shop steward is interested in the salaries of younger personnel in a firm.
The file <filename>personnel.sav</filename> provides the salaries of all the workers and their
dates of birth. The syntax in <link linkend="select_002dif_003aex">select-if:ex</link> shows how <literal>SELECT IF</literal> can
be used to limit analysis only to those persons born after December 31, 1999.
</para>
<anchor id="select_002dif_003aex"/>
<sidebar><screen>get file = 'personnel.sav'.
echo 'Salaries of all personnel'.
descriptives salary.
echo 'Salaries of personnel born after December 31 1999'.
select if dob > date.dmy (31,12,1999).
descriptives salary.
</screen></sidebar>
<para>From <link linkend="select_002dif_003ares">select-if:res</link> one can see that there are 56 persons listed in the dataset,
and 17 of them were born after December 31, 1999.
</para>
<anchor id="select_002dif_003ares"/>
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen>Salaries of all personnel
Descriptive Statistics
+------------------------+--+--------+-------+-------+-------+
| | N| Mean |Std Dev|Minimum|Maximum|
+------------------------+--+--------+-------+-------+-------+
|Annual salary before tax|56|40028.97|8721.17|$23,451|$57,044|
|Valid N (listwise) |56| | | | |
|Missing N (listwise) | 0| | | | |
+------------------------+--+--------+-------+-------+-------+
Salaries of personnel born after December 31 1999
Descriptive Statistics
+------------------------+--+--------+-------+-------+-------+
| | N| Mean |Std Dev|Minimum|Maximum|
+------------------------+--+--------+-------+-------+-------+
|Annual salary before tax|17|31828.59|4454.80|$23,451|$39,504|
|Valid N (listwise) |17| | | | |
|Missing N (listwise) | 0| | | | |
+------------------------+--+--------+-------+-------+-------+
</screen>
<para>Note that the <filename>personnel.sav</filename> file from which the data were read is unaffected.
The transformation affects only the active file.
</para>
</sect2>
</sect1>
<sect1 label="13.5" id="SPLIT-FILE">
<title>SPLIT FILE</title>
<indexterm role="vr"><primary>SPLIT FILE</primary></indexterm>
<literallayout>SPLIT FILE [{LAYERED, SEPARATE}] BY <replaceable>var_list</replaceable>.
SPLIT FILE OFF.
</literallayout>
<para><literal>SPLIT FILE</literal> allows multiple sets of data present in one data
file to be analyzed separately using single statistical procedure
commands.
</para>
<para>Specify a list of variable names to analyze multiple sets of
data separately. Groups of adjacent cases having the same values for these
variables are analyzed by statistical procedure commands as one group.
An independent analysis is carried out for each group of cases, and the
variable values for the group are printed along with the analysis.
</para>
<para>When a list of variable names is specified, one of the keywords
<literal>LAYERED</literal> or <literal>SEPARATE</literal> may also be specified. With
<literal>LAYERED</literal>, which is the default, the separate analyses for each
group are presented together in a single table. With
<literal>SEPARATE</literal>, each analysis is presented in a separate table.
Not all procedures honor the distinction.
</para>
<para>Groups are formed only by <emphasis>adjacent</emphasis> cases. To create a split
using a variable where like values are not adjacent in the working file,
first sort the data by that variable (see <link linkend="SORT-CASES">SORT CASES</link>).
</para>
<para>Specify <literal>OFF</literal> to disable <literal>SPLIT FILE</literal> and resume analysis of the
entire active dataset as a single group of data.
</para>
<para>When <literal>SPLIT FILE</literal> is specified after <literal>TEMPORARY</literal>, it affects only
the next procedure (see <link linkend="TEMPORARY">TEMPORARY</link>).
</para>
<sect2 label="13.5.1">
<title>Example Split</title>
<para>The file <filename>horticulture.sav</filename> contains data describing the <emphasis role="bold">yield</emphasis>
of a number of horticultural specimens which have been subjected to
various <emphasis role="bold">treatment</emphasis>s. If we wanted to investigate linear statistics
of the <emphasis role="bold">yeild</emphasis>, one way to do this is using the <literal>DESCRIPTIVES</literal> (see <link linkend="DESCRIPTIVES">DESCRIPTIVES</link>).
However, it is reasonable to expect the mean to be different depending
on the <emphasis role="bold">treatment</emphasis>. So we might want to perform three separate
procedures — one for each treatment.
<footnote><para>There are other, possibly better, ways to achieve a similar result
using the <literal>MEANS</literal> or <literal>EXAMINE</literal> commands.</para></footnote>
<link linkend="split_003aex">split:ex</link> shows how this can be done automatically using
the <literal>SPLIT FILE</literal> command.
</para>
<anchor id="split_003aex"/>
<sidebar><screen>get file='horticulture.sav'.
* Ensure cases are sorted before splitting.
sort cases by treatment.
split file by treatment.
* Run descriptives on the yield variable
descriptives /variable = yield.
</screen></sidebar>
<para>In <link linkend="split_003ares">split:res</link> you can see that the table of descriptive statistics
appears 3 times — once for each value of <emphasis role="bold">treatment</emphasis>.
In this example ‘<literal>N</literal>’, the number of observations are identical in
all splits. This is because that experiment was deliberately designed
that way. However in general one can expect a different ‘<literal>N</literal>’ for each
split.
</para>
<anchor id="split_003ares"/>
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Split Values
+---------+-------+
|Variable | Value |
+---------+-------+
|treatment|control|
+---------+-------+
Descriptive Statistics
+--------------------+--+-----+-------+-------+-------+
| | N| Mean|Std Dev|Minimum|Maximum|
+--------------------+--+-----+-------+-------+-------+
|yield |30|51.23| 8.28| 37.86| 68.59|
|Valid N (listwise) |30| | | | |
|Missing N (listwise)| 0| | | | |
+--------------------+--+-----+-------+-------+-------+
Split Values
+---------+------------+
|Variable | Value |
+---------+------------+
|treatment|conventional|
+---------+------------+
Descriptive Statistics
+--------------------+--+-----+-------+-------+-------+
| | N| Mean|Std Dev|Minimum|Maximum|
+--------------------+--+-----+-------+-------+-------+
|yield |30|53.57| 8.92| 36.30| 70.66|
|Valid N (listwise) |30| | | | |
|Missing N (listwise)| 0| | | | |
+--------------------+--+-----+-------+-------+-------+
Split Values
+---------+-----------+
|Variable | Value |
+---------+-----------+
|treatment|traditional|
+---------+-----------+
Descriptive Statistics
+--------------------+--+-----+-------+-------+-------+
| | N| Mean|Std Dev|Minimum|Maximum|
+--------------------+--+-----+-------+-------+-------+
|yield |30|56.87| 8.88| 39.08| 75.93|
|Valid N (listwise) |30| | | | |
|Missing N (listwise)| 0| | | | |
+--------------------+--+-----+-------+-------+-------+
</screen>
<para>Unless <literal>TEMPORARY</literal> was used, after a split has been defined for
a dataset it remains active until explicitly disabled.
In the graphical user interface, the active split variable (if any) is
displayed in the status bar (see <link linkend="split_002dstatus_002dbar_003ascr">split-status-bar:scr</link>.
If a dataset is saved to a system file (see <link linkend="SAVE">SAVE</link>) whilst a split
is active, the split stastus is stored in the file and will be
automatically loaded when that file is loaded.
</para>
<anchor id="split_002dstatus_002dbar_003ascr"/>
<sidebar></sidebar>
</sect2>
</sect1>
<sect1 label="13.6" id="TEMPORARY">
<title>TEMPORARY</title>
<indexterm role="vr"><primary>TEMPORARY</primary></indexterm>
<literallayout>TEMPORARY.
</literallayout>
<para><literal>TEMPORARY</literal> is used to make the effects of transformations
following its execution temporary. These transformations
affect only the execution of the next procedure or procedure-like
command. Their effects are not be saved to the active dataset.
</para>
<para>The only specification on <literal>TEMPORARY</literal> is the command name.
</para>
<para><literal>TEMPORARY</literal> may not appear within a <literal>DO IF</literal> or <literal>LOOP</literal>
construct. It may appear only once between procedures and
procedure-like commands.
</para>
<para>Scratch variables cannot be used following <literal>TEMPORARY</literal>.
</para>
<sect2 label="13.6.1">
<title>Example Temporary</title>
<para>In <link linkend="temporary_003aex">temporary:ex</link> there are two <literal>COMPUTE</literal> transformation. One
of them immediatly follows a <literal>TEMPORARY</literal> command, and therefore has
effect only for the next procedure, which in this case is the first
<literal>DESCRIPTIVES</literal> command.
</para>
<anchor id="temporary_003aex"/>
<sidebar><screen>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.
</screen></sidebar>
<para>The data read by the first <literal>DESCRIPTIVES</literal> procedure are 4, 5, 8,
10.5, 13, 15. The data read by the second <literal>DESCRIPTIVES</literal> procedure are 1, 2,
5, 7.5, 10, 12. This is because the second <literal>COMPUTE</literal> transformation
has no effect on the second <literal>DESCRIPTIVES</literal> procedure. You can check these
figures in <link linkend="temporary_003ares">temporary:res</link>.
</para>
<anchor id="temporary_003ares"/>
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Descriptive Statistics
+--------------------+-+----+-------+-------+-------+
| |N|Mean|Std Dev|Minimum|Maximum|
+--------------------+-+----+-------+-------+-------+
|x |6|9.25| 4.38| 4| 15|
|Valid N (listwise) |6| | | | |
|Missing N (listwise)|0| | | | |
+--------------------+-+----+-------+-------+-------+
Descriptive Statistics
+--------------------+-+----+-------+-------+-------+
| |N|Mean|Std Dev|Minimum|Maximum|
+--------------------+-+----+-------+-------+-------+
|x |6|6.25| 4.38| 1| 12|
|Valid N (listwise) |6| | | | |
|Missing N (listwise)|0| | | | |
+--------------------+-+----+-------+-------+-------+
</screen>
</sect2>
</sect1>
<sect1 label="13.7" id="WEIGHT">
<title>WEIGHT</title>
<indexterm role="vr"><primary>WEIGHT</primary></indexterm>
<literallayout>WEIGHT BY <replaceable>var_name</replaceable>.
WEIGHT OFF.
</literallayout>
<para><literal>WEIGHT</literal> assigns cases varying weights,
changing the frequency distribution of the active dataset. Execution of
<literal>WEIGHT</literal> is delayed until data have been read.
</para>
<para>If a variable name is specified, <literal>WEIGHT</literal> causes the values of that
variable to be used as weighting factors for subsequent statistical
procedures. Use of keyword <literal>BY</literal> is optional but recommended. Weighting
variables must be numeric. Scratch variables may not be used for
weighting (see <link linkend="Scratch-Variables">Scratch Variables</link>).
</para>
<para>When <literal>OFF</literal> is specified, subsequent statistical procedures weight all
cases equally.
</para>
<para>A positive integer weighting factor <replaceable>w</replaceable> on a case yields the
same statistical output as would replicating the case <replaceable>w</replaceable> times.
A weighting factor of 0 is treated for statistical purposes as if the
case did not exist in the input. Weighting values need not be
integers, but negative and system-missing values for the weighting
variable are interpreted as weighting factors of 0. User-missing
values are not treated specially.
</para>
<para>When <literal>WEIGHT</literal> is specified after <literal>TEMPORARY</literal>, it affects only
the next procedure (see <link linkend="TEMPORARY">TEMPORARY</link>).
</para>
<para><literal>WEIGHT</literal> does not cause cases in the active dataset to be
replicated in memory.
</para>
<sect2 label="13.7.1">
<title>Example Weights</title>
<para>One could define a dataset containing an inventory of stock items.
It would be reasonable to use a string variable for a description of the
item, and a numeric variable for the number in stock, like in <link linkend="weight_003aex">weight:ex</link>.
</para>
<anchor id="weight_003aex"/>
<sidebar><screen>data list notable list /item (a16) quantity (f8.0).
begin data
nuts 345
screws 10034
washers 32012
bolts 876
end data.
echo 'Unweighted frequency table'.
frequencies /variables = item /format=dfreq.
weight by quantity.
echo 'Weighted frequency table'.
frequencies /variables = item /format=dfreq.
</screen></sidebar>
<para>One analysis which most surely would be of interest is
the relative amounts or each item in stock.
However without setting a weight variable, <literal>FREQUENCIES</literal>
(see <link linkend="FREQUENCIES">FREQUENCIES</link>) does not tell us what we want to know, since
there is only one case for each stock item. <link linkend="weight_003ares">weight:res</link> shows the
difference between the weighted and unweighted frequency tables.
</para>
<anchor id="weight_003ares"/>
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen>Unweighted frequency table
item
+-------------+---------+-------+-------------+------------------+
| |Frequency|Percent|Valid Percent|Cumulative Percent|
+-------------+---------+-------+-------------+------------------+
|Valid bolts | 1| 25.0%| 25.0%| 25.0%|
| nuts | 1| 25.0%| 25.0%| 50.0%|
| screws | 1| 25.0%| 25.0%| 75.0%|
| washers| 1| 25.0%| 25.0%| 100.0%|
+-------------+---------+-------+-------------+------------------+
|Total | 4| 100.0%| | |
+-------------+---------+-------+-------------+------------------+
Weighted frequency table
item
+-------------+---------+-------+-------------+------------------+
| |Frequency|Percent|Valid Percent|Cumulative Percent|
+-------------+---------+-------+-------------+------------------+
|Valid washers| 32012| 74.0%| 74.0%| 74.0%|
| screws | 10034| 23.2%| 23.2%| 97.2%|
| bolts | 876| 2.0%| 2.0%| 99.2%|
| nuts | 345| .8%| .8%| 100.0%|
+-------------+---------+-------+-------------+------------------+
|Total | 43267| 100.0%| | |
+-------------+---------+-------+-------------+------------------+
</screen><!-- PSPP - a program for statistical analysis. -->
<!-- Copyright (C) 2017, 2020 Free Software Foundation, Inc. -->
<!-- Permission is granted to copy, distribute and/or modify this document -->
<!-- under the terms of the GNU Free Documentation License, Version 1.3 -->
<!-- or any later version published by the Free Software Foundation; -->
<!-- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -->
<!-- A copy of the license is included in the section entitled "GNU -->
<!-- Free Documentation License". -->
<!-- -->
</sect2>
</sect1>
</chapter>
<chapter label="14" id="Conditionals-and-Looping">
<title>Conditional and Looping Constructs</title>
<indexterm role="cp"><primary>conditionals</primary></indexterm>
<indexterm role="cp"><primary>loops</primary></indexterm>
<indexterm role="cp"><primary>flow of control</primary></indexterm>
<indexterm role="cp"><primary>control flow</primary></indexterm>
<para>This chapter documents PSPP commands used for conditional execution,
looping, and flow of control.
</para>
<sect1 label="14.1" id="BREAK">
<title>BREAK</title>
<indexterm role="vr"><primary>BREAK</primary></indexterm>
<literallayout>BREAK.
</literallayout>
<para><literal>BREAK</literal> terminates execution of the innermost currently executing
<literal>LOOP</literal> construct.
</para>
<para><literal>BREAK</literal> is allowed only inside <literal>LOOP</literal>…<literal>END LOOP</literal>.
See <link linkend="LOOP">LOOP</link>, for more details.
</para>
</sect1>
<sect1 label="14.2" id="DEFINE">
<title>DEFINE</title>
<indexterm role="vr"><primary>DEFINE</primary></indexterm>
<indexterm role="cp"><primary>macro</primary></indexterm>
<sect2 label="14.2.1" id="Macro-Overview">
<title>Overview</title>
<literallayout><literal>DEFINE</literal> <emphasis>macro_name</emphasis><literal>(</literal>[<emphasis>argument</emphasis>[<literal>/</literal><emphasis>argument</emphasis>]…]<literal>)</literal>
…<emphasis>body</emphasis>…
<literal>!ENDDEFINE.</literal>
</literallayout>
<para>Each <emphasis>argument</emphasis> takes the following form:
</para><literallayout>{<emphasis>!arg_name</emphasis><literal>=</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>!POSITIONAL</literal>}
[<literal>!DEFAULT(</literal><emphasis>default</emphasis><literal>)</literal>]
[<literal>!NOEXPAND</literal>]
{<literal>!TOKENS(</literal><emphasis>count</emphasis><literal>)</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>!CHAREND('</literal><emphasis>token</emphasis><literal>')</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>!ENCLOSE('</literal><emphasis>start</emphasis><literal>' <inlineequation><mathphrase>|</mathphrase></inlineequation> '</literal><emphasis>end</emphasis><literal>')</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>!CMDEND</literal>}
</literallayout>
<para>The following directives may be used within <emphasis>body</emphasis>:
</para><screen>!OFFEXPAND
!ONEXPAND
</screen>
<para>The following functions may be used within the body:
</para><literallayout><literal>!BLANKS(</literal><emphasis>count</emphasis><literal>)</literal>
<literal>!CONCAT(</literal><emphasis>arg</emphasis>…<literal>)</literal>
<literal>!EVAL(</literal><emphasis>arg</emphasis><literal>)</literal>
<literal>!HEAD(</literal><emphasis>arg</emphasis><literal>)</literal>
<literal>!INDEX(</literal><emphasis>haystack</emphasis><literal>,</literal> <emphasis>needle</emphasis><literal>)</literal>
<literal>!LENGTH(</literal><emphasis>arg</emphasis><literal>)</literal>
<literal>!NULL</literal>
<literal>!QUOTE(</literal><emphasis>arg</emphasis><literal>)</literal>
<literal>!SUBSTR(</literal><emphasis>arg</emphasis><literal>,</literal> <emphasis>start</emphasis>[<literal>,</literal> <emphasis>count</emphasis>]<literal>)</literal>
<literal>!TAIL(</literal><emphasis>arg</emphasis><literal>)</literal>
<literal>!UNQUOTE(</literal><emphasis>arg</emphasis><literal>)</literal>
<literal>!UPCASE(</literal><emphasis>arg</emphasis><literal>)</literal>
</literallayout>
<para>The body may also include the following constructs:
</para><literallayout><literal>!IF (</literal><emphasis>condition</emphasis><literal>) !THEN</literal> <emphasis>true-expansion</emphasis> <literal>!ENDIF</literal>
<literal>!IF (</literal><emphasis>condition</emphasis><literal>) !THEN</literal> <emphasis>true-expansion</emphasis> <literal>!ELSE</literal> <emphasis>false-expansion</emphasis> <literal>!ENDIF</literal>
<literal>!DO</literal> <emphasis>!var</emphasis> <literal>=</literal> <emphasis>start</emphasis> <literal>!TO</literal> <emphasis>end</emphasis> [<literal>!BY</literal> <emphasis>step</emphasis>]
<emphasis>body</emphasis>
<literal>!DOEND</literal>
<literal>!DO</literal> <emphasis>!var</emphasis> <literal>!IN</literal> <literal>(</literal><emphasis>expression</emphasis><literal>)</literal>
<emphasis>body</emphasis>
<literal>!DOEND</literal>
<literal>!LET</literal> <emphasis>!var</emphasis> <literal>=</literal> <emphasis>expression</emphasis>
</literallayout>
</sect2>
<sect2 label="14.2.2" id="Macro-Introduction">
<title>Introduction</title>
<para>The DEFINE command creates a <firstterm>macro</firstterm>, which is a name for a
fragment of PSPP syntax called the macro’s <firstterm>body</firstterm>. Following the
DEFINE command, syntax may <firstterm>call</firstterm> the macro by name any number of
times. Each call substitutes, or <firstterm>expands</firstterm>, the macro’s body in
place of the call, as if the body had been written in its place.
</para>
<para>The following syntax defines a macro named <literal>!vars</literal> that expands
to the variable names <literal>v1 v2 v3</literal>. The macro’s name begins with
‘<literal>!</literal>’, which is optional for macro names. The <literal>()</literal> following
the macro name are required:
</para>
<screen>DEFINE !vars()
v1 v2 v3
!ENDDEFINE.
</screen>
<para>Here are two ways that <literal>!vars</literal> might be called given the
preceding definition:
</para>
<screen>DESCRIPTIVES !vars.
FREQUENCIES /VARIABLES=!vars.
</screen>
<para>With macro expansion, the above calls are equivalent to the following:
</para>
<screen>DESCRIPTIVES v1 v2 v3.
FREQUENCIES /VARIABLES=v1 v2 v3.
</screen>
<para>The <literal>!vars</literal> macro expands to a fixed body. Macros may have more
sophisticated contents:
</para>
<itemizedlist><listitem><para>Macro <firstterm>arguments</firstterm> that are substituted into the body whenever they
are named. The values of a macro’s arguments are specified each time
it is called. See <link linkend="Macro-Arguments">Macro Arguments</link>.
</para>
</listitem><listitem><para>Macro <firstterm>functions</firstterm>, expanded when the macro is called. See <link linkend="Macro-Functions">Macro
Functions</link>.
</para>
</listitem><listitem><para><literal>!IF</literal> constructs, for conditional expansion. See <link linkend="Macro-Conditional-Expansion">Macro
Conditional Expansion</link>.
</para>
</listitem><listitem><para>Two forms of <literal>!DO</literal> construct, for looping over a numerical range
or a collection of tokens. See <link linkend="Macro-Loops">Macro Loops</link>.
</para>
</listitem><listitem><para><literal>!LET</literal> constructs, for assigning to macro variables. See <link linkend="Macro-Variable-Assignment">Macro
Variable Assignment</link>.
</para></listitem></itemizedlist>
<para>Many identifiers associated with macros begin with ‘<literal>!</literal>’, a
character not normally allowed in identifiers. These identifiers are
reserved only for use with macros, which helps keep them from being
confused with other kinds of identifiers.
</para>
<para>The following sections provide more details on macro syntax and
semantics.
</para>
</sect2>
<sect2 label="14.2.3" id="Macro-Bodies">
<title>Macro Bodies</title>
<para>As previously shown, a macro body may contain a fragment of a PSPP
command (such as a variable name). A macro body may also contain full
PSPP commands. In the latter case, the macro body should also contain
the command terminators.
</para>
<para>Most PSPP commands may occur within a macro. The <literal>DEFINE</literal>
command itself is one exception, because the inner <literal>!ENDDEFINE</literal>
ends the outer macro definition. For compatibility, <literal>BEGIN
DATA</literal>…<literal>END DATA.</literal> should not be used within a macro.
</para>
<para>The body of a macro may call another macro. The following shows one
way that could work:
</para>
<screen>DEFINE !commands()
DESCRIPTIVES !vars.
FREQUENCIES /VARIABLES=!vars.
!ENDDEFINE.
* Initially define the 'vars' macro to analyze v1...v3.
DEFINE !vars() v1 v2 v3 !ENDDEFINE.
!commands
* Redefine 'vars' macro to analyze different variables.
DEFINE !vars() v4 v5 !ENDDEFINE.
!commands
</screen>
<para>The <literal>!commands</literal> macro would be easier to use if it took the
variables to analyze as an argument rather than through another macro.
The following section shows how to do that.
</para>
</sect2>
<sect2 label="14.2.4" id="Macro-Arguments">
<title>Macro Arguments</title>
<para>This section explains how to use macro arguments. As an initial
example, the following syntax defines a macro named <literal>!analyze</literal>
that takes all the syntax up to the first command terminator as an
argument:
</para>
<screen>DEFINE !analyze(!POSITIONAL !CMDEND)
DESCRIPTIVES !1.
FREQUENCIES /VARIABLES=!1.
!ENDDEFINE.
</screen>
<para>When <literal>!analyze</literal> is called, it expands to a pair of analysis
commands with each <literal>!1</literal> in the body replaced by the argument.
That is, these calls:
</para>
<screen>!analyze v1 v2 v3.
!analyze v4 v5.
</screen>
<para>act like the following:
</para>
<screen>DESCRIPTIVES v1 v2 v3.
FREQUENCIES /VARIABLES=v1 v2 v3.
DESCRIPTIVES v4 v5.
FREQUENCIES /VARIABLES=v4 v5.
</screen>
<para>Macros may take any number of arguments, described within the
parentheses in the DEFINE command. Arguments come in two varieties
based on how their values are specified when the macro is called:
</para>
<itemizedlist><listitem><para>A <firstterm>positional</firstterm> argument has a required value that follows the
macro’s name. Use the <literal>!POSITIONAL</literal> keyword to declare a
positional argument.
</para>
<para>When a macro is called, the positional argument values appear in the
same order as their definitions, before any keyword argument values.
</para>
<para>References to a positional argument in a macro body are numbered:
<literal>!1</literal> is the first positional argument, <literal>!2</literal> the second, and
so on. In addition, <literal>!*</literal> expands to all of the positional
arguments’ values, separated by spaces.
</para>
<para>The following example uses a positional argument:
</para>
<screen>DEFINE !analyze(!POSITIONAL !CMDEND)
DESCRIPTIVES !1.
FREQUENCIES /VARIABLES=!1.
!ENDDEFINE.
!analyze v1 v2 v3.
!analyze v4 v5.
</screen>
</listitem><listitem><para>A <firstterm>keyword</firstterm> argument has a name. In the macro call, its value is
specified with the syntax <literal><emphasis>name</emphasis>=<emphasis>value</emphasis></literal>. The names allow
keyword argument values to take any order in the call.
</para>
<para>In declaration and calls, a keyword argument’s name may not begin with
‘<literal>!</literal>’, but references to it in the macro body do start with a
leading ‘<literal>!</literal>’.
</para>
<para>The following example uses a keyword argument that defaults to ALL if
the argument is not assigned a value:
</para>
<screen>DEFINE !analyze_kw(vars=!DEFAULT(ALL) !CMDEND)
DESCRIPTIVES !vars.
FREQUENCIES /VARIABLES=!vars.
!ENDDEFINE.
!analyze_kw vars=v1 v2 v3. /* Analyze specified variables.
!analyze_kw. /* Analyze all variables.
</screen></listitem></itemizedlist>
<para>If a macro has both positional and keyword arguments, then the
positional arguments must come first in the DEFINE command, and their
values also come first in macro calls. A keyword argument may be
omitted by leaving its keyword out of the call, and a positional
argument may be omitted by putting a command terminator where it would
appear. (The latter case also omits any following positional
arguments and all keyword arguments, if there are any.) When an
argument is omitted, a default value is used: either the value
specified in <literal>!DEFAULT(<emphasis>value</emphasis>)</literal>, or an empty value otherwise.
</para>
<para>Each argument declaration specifies the form of its value:
</para>
<variablelist><varlistentry><term><literal>!TOKENS(<emphasis>count</emphasis>)</literal>
</term><listitem><para>Exactly <replaceable>count</replaceable> tokens, e.g. <literal>!TOKENS(1)</literal> for a single
token. Each identifier, number, quoted string, operator, or
punctuator is a token. See <link linkend="Tokens">Tokens</link>, for a complete definition.
</para>
<para>The following variant of <literal>!analyze_kw</literal> accepts only a single
variable name (or <literal>ALL</literal>) as its argument:
</para>
<screen>DEFINE !analyze_one_var(!POSITIONAL !TOKENS(1))
DESCRIPTIVES !1.
FREQUENCIES /VARIABLES=!1.
!ENDDEFINE.
!analyze_one_var v1.
</screen>
</listitem></varlistentry><varlistentry><term><literal>!CHAREND('<replaceable>token</replaceable>')</literal>
</term><listitem><para>Any number of tokens up to <replaceable>token</replaceable>, which should be an operator or
punctuator token such as ‘<literal>/</literal>’ or ‘<literal>+</literal>’. The <replaceable>token</replaceable> does
not become part of the value.
</para>
<para>With the following variant of <literal>!analyze_kw</literal>, the variables must
be following by ‘<literal>/</literal>’:
</para>
<screen>DEFINE !analyze_parens(vars=!CHARNED('/'))
DESCRIPTIVES !vars.
FREQUENCIES /VARIABLES=!vars.
!ENDDEFINE.
!analyze_parens vars=v1 v2 v3/.
</screen>
</listitem></varlistentry><varlistentry><term><literal>!ENCLOSE('<replaceable>start</replaceable>','<replaceable>end</replaceable>')</literal>
</term><listitem><para>Any number of tokens enclosed between <replaceable>start</replaceable> and <replaceable>end</replaceable>, which
should each be operator or punctuator tokens. For example, use
<literal>!ENCLOSE('(',')')</literal> for a value enclosed within parentheses.
(Such a value could never have right parentheses inside it, even
paired with left parentheses.) The start and end tokens are not part
of the value.
</para>
<para>With the following variant of <literal>!analyze_kw</literal>, the variables must
be specified within parentheses:
</para>
<screen>DEFINE !analyze_parens(vars=!ENCLOSE('(',')'))
DESCRIPTIVES !vars.
FREQUENCIES /VARIABLES=!vars.
!ENDDEFINE.
!analyze_parens vars=(v1 v2 v3).
</screen>
</listitem></varlistentry><varlistentry><term><literal>!CMDEND</literal>
</term><listitem><para>Any number of tokens up to the end of the command. This should be
used only for the last positional parameter, since it consumes all of
the tokens in the command calling the macro.
</para>
<para>The following variant of <literal>!analyze_kw</literal> takes all the variable
names up to the end of the command as its argument:
</para>
<screen>DEFINE !analyze_kw(vars=!CMDEND)
DESCRIPTIVES !vars.
FREQUENCIES /VARIABLES=!vars.
!ENDDEFINE.
!analyze_kw vars=v1 v2 v3.
</screen></listitem></varlistentry></variablelist>
<para>By default, when an argument’s value contains a macro call, the call
is expanded each time the argument appears in the macro’s body. The
<literal>!NOEXPAND</literal> keyword in an argument declaration suppresses this
expansion. See <link linkend="Controlling-Macro-Expansion">Controlling Macro Expansion</link>.
</para>
</sect2>
<sect2 label="14.2.5" id="Controlling-Macro-Expansion">
<title>Controlling Macro Expansion</title>
<para>Multiple factors control whether macro calls are expanded in different
situations. At the highest level, <literal>SET MEXPAND</literal> controls whether
macro calls are expanded. By default, it is enabled. See <link linkend="SET-MEXPAND">SET
MEXPAND</link>, for details.
</para>
<para>A macro body may contain macro calls. By default, these are expanded.
If a macro body contains <literal>!OFFEXPAND</literal> or <literal>!ONEXPAND</literal>
directives, then <literal>!OFFEXPAND</literal> disables expansion of macro calls
until the following <literal>!ONEXPAND</literal>.
</para>
<para>A macro argument’s value may contain a macro call. These macro calls
are expanded, unless the argument was declared with the
<literal>!NOEXPAND</literal> keyword.
</para>
<para>The argument to a macro function is a special context that does not
expand macro calls. For example, if <literal>!vars</literal> is the name of a
macro, then <literal>!LENGTH(!vars)</literal> expands to 5, as does
<literal>!LENGTH(!1)</literal> if positional argument 1 has value <literal>!vars</literal>.
To expand macros in these cases, use the <literal>!EVAL</literal> macro function,
e.g. <literal>!LENGTH(!EVAL(!vars))</literal> or <literal>!LENGTH(!EVAL(!1))</literal>.
See <link linkend="Macro-Functions">Macro Functions</link>, for details.
</para>
<para>These rules apply to macro calls, not to uses within a macro body of
macro functions, macro arguments, and macro variables created by
<literal>!DO</literal> or <literal>!LET</literal>, which are always expanded.
</para>
<para><literal>SET MEXPAND</literal> may appear within the body of a macro, but it will
not affect expansion of the macro that it appears in. Use
<literal>!OFFEXPAND</literal> and <literal>!ONEXPAND</literal> instead.
</para>
</sect2>
<sect2 label="14.2.6" id="Macro-Functions">
<title>Macro Functions</title>
<para>Macro bodies may manipulate syntax using macro functions. Macro
functions accept tokens as arguments and expand to sequences of
characters.
</para>
<para>The arguments to macro functions have a restricted form. They may
only be a single token (such as an identifier or a string), a macro
argument, or a call to a macro function. Thus, the following are
valid macro arguments:
</para><screen>x 5.0 x !1 "5 + 6" !CONCAT(x,y)
</screen><para>and the following are not:
</para><screen>x y 5+6
</screen>
<para>Macro functions expand to sequences of characters. When these
character strings are processed further as character strings, e.g.
with <literal>!LENGTH</literal>, any character string is valid. When they are
interpreted as PSPP syntax, e.g. when the expansion becomes part of
a command, they need to be valid for that purpose. For example,
<literal>!UNQUOTE("It's")</literal> will yield an error if the expansion
<literal>It's</literal> becomes part of a PSPP command, because it contains
unbalanced single quotes, but <literal>!LENGTH(!UNQUOTE("It's"))</literal> expands
to 4.
</para>
<para>The following macro functions are available. Each function’s
documentation includes examples in the form <literal><replaceable>call</replaceable>
↦ <replaceable>expansion</replaceable></literal>.
</para>
<synopsis><indexterm role="fn"><primary>!BLANKS</primary></indexterm><phrase role="category"><emphasis role="bold">Macro Function</emphasis>:</phrase> <function>!BLANKS</function> (<emphasis role="arg">count</emphasis>)</synopsis>
<blockquote><para>Expands to <replaceable>count</replaceable> unquoted spaces, where <replaceable>count</replaceable> is a
nonnegative integer. Outside quotes, any positive number of spaces
are equivalent; for a quoted string of spaces, use
<literal>!QUOTE(!BLANKS(<replaceable>count</replaceable>))</literal>.
</para>
<para>In the examples below, ‘<literal>_</literal>’ stands in for a space to make the
results visible.
</para>
<!-- Keep these examples in sync with the test for !BLANKS in -->
<!-- tests/language/commands/define.at: -->
<screen>!BLANKS(0) ↦ empty
!BLANKS(1) ↦ _
!BLANKS(2) ↦ __
!QUOTE(!BLANKS(5)) ↦ '_____'
</screen></blockquote>
<synopsis><indexterm role="fn"><primary>!CONCAT</primary></indexterm><phrase role="category"><emphasis role="bold">Macro Function</emphasis>:</phrase> <function>!CONCAT</function> (<emphasis role="arg">arg</emphasis><emphasis role="arg">…</emphasis>)</synopsis>
<blockquote><para>Expands to the concatenation of all of the arguments. Before
concatenation, each quoted string argument is unquoted, as if
<literal>!UNQUOTE</literal> were applied. This allows for “token pasting”,
combining two (or more) tokens into a single one:
</para>
<!-- Keep these examples in sync with the test for !CONCAT in -->
<!-- tests/language/commands/define.at: -->
<screen>!CONCAT(x, y) ↦ xy
!CONCAT('x', 'y') ↦ xy
!CONCAT(12, 34) ↦ 1234
!CONCAT(!NULL, 123) ↦ 123
</screen>
<para><literal>!CONCAT</literal> is often used for constructing a series of similar
variable names from a prefix followed by a number and perhaps a
suffix. For example:
</para>
<!-- Keep these examples in sync with the test for !CONCAT in -->
<!-- tests/language/commands/define.at: -->
<screen>!CONCAT(x, 0) ↦ x0
!CONCAT(x, 0, y) ↦ x0y
</screen>
<para>An identifier token must begin with a letter (or ‘<literal>#</literal>’ or
‘<literal>@</literal>’), which means that attempting to use a number as the first
part of an identifier will produce a pair of distinct tokens rather
than a single one. For example:
</para>
<!-- Keep these examples in sync with the test for !CONCAT in -->
<!-- tests/language/commands/define.at: -->
<screen>!CONCAT(0, x) ↦ 0 x
!CONCAT(0, x, y) ↦ 0 xy
</screen></blockquote>
<synopsis><indexterm role="fn"><primary>!EVAL</primary></indexterm><phrase role="category"><emphasis role="bold">Macro Function</emphasis>:</phrase> <function>!EVAL</function> (<emphasis role="arg">arg</emphasis>)</synopsis>
<blockquote><para>Expands macro calls in <replaceable>arg</replaceable>. This is especially useful if
<replaceable>arg</replaceable> is the name of a macro or a macro argument that expands to
one, because arguments to macro functions are not expanded by default
(see <link linkend="Controlling-Macro-Expansion">Controlling Macro Expansion</link>).
</para>
<para>The following examples assume that <literal>!vars</literal> is a macro that
expands to <literal>a b c</literal>:
</para>
<screen>!vars ↦ a b c
!QUOTE(!vars) ↦ '!vars'
!EVAL(!vars) ↦ a b c
!QUOTE(!EVAL(!vars)) ↦ 'a b c'
</screen>
<para>These examples additionally assume that argument <literal>!1</literal> has value
<literal>!vars</literal>:
</para>
<screen>!1 ↦ a b c
!QUOTE(!1) ↦ '!vars'
!EVAL(!1) ↦ a b c
!QUOTE(!EVAL(!1)) ↦ 'a b c'
</screen></blockquote>
<synopsis><indexterm role="fn"><primary>!HEAD</primary></indexterm><phrase role="category"><emphasis role="bold">Macro Function</emphasis>:</phrase> <function>!HEAD</function> (<emphasis role="arg">arg</emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>!TAIL</primary></indexterm><phrase role="category"><emphasis role="bold">Macro Function</emphasis>:</phrase> <function>!TAIL</function> (<emphasis role="arg">arg</emphasis>)</synopsis>
<blockquote><para><literal>!HEAD</literal> expands to just the first token in an unquoted version of
<replaceable>arg</replaceable>, and <literal>!TAIL</literal> to all the tokens after the first.
</para>
<screen>!HEAD('a b c') ↦ a
!HEAD('a') ↦ a
!HEAD(!NULL) ↦ empty
!HEAD('') ↦ empty
!TAIL('a b c') ↦ b c
!TAIL('a') ↦ empty
!TAIL(!NULL) ↦ empty
!TAIL('') ↦ empty
</screen></blockquote>
<synopsis><indexterm role="fn"><primary>!INDEX</primary></indexterm><phrase role="category"><emphasis role="bold">Macro Function</emphasis>:</phrase> <function>!INDEX</function> (<emphasis role="arg">haystack</emphasis>, <emphasis role="arg">needle</emphasis>)</synopsis>
<blockquote><para>Looks for <replaceable>needle</replaceable> in <replaceable>haystack</replaceable>. If it is present, expands
to the 1-based index of its first occurrence; if not, expands to 0.
</para>
<screen>!INDEX(banana, an) ↦ 2
!INDEX(banana, nan) ↦ 3
!INDEX(banana, apple) ↦ 0
!INDEX("banana", nan) ↦ 4
!INDEX("banana", "nan") ↦ 0
!INDEX(!UNQUOTE("banana"), !UNQUOTE("nan")) ↦ 3
</screen></blockquote>
<synopsis><indexterm role="fn"><primary>!LENGTH</primary></indexterm><phrase role="category"><emphasis role="bold">Macro Function</emphasis>:</phrase> <function>!LENGTH</function> (<emphasis role="arg">arg</emphasis>)</synopsis>
<blockquote><para>Expands to a number token representing the number of characters in
<replaceable>arg</replaceable>.
</para>
<screen>!LENGTH(123) ↦ 3
!LENGTH(123.00) ↦ 6
!LENGTH( 123 ) ↦ 3
!LENGTH("123") ↦ 5
!LENGTH(xyzzy) ↦ 5
!LENGTH("xyzzy") ↦ 7
!LENGTH("xy""zzy") ↦ 9
!LENGTH(!UNQUOTE("xyzzy")) ↦ 5
!LENGTH(!UNQUOTE("xy""zzy")) ↦ 6
!LENGTH(!1) ↦ 5 if <literal>!1</literal> is <literal>a b c</literal>
!LENGTH(!1) ↦ 0 if <literal>!1</literal> is empty
!LENGTH(!NULL) ↦ 0
</screen></blockquote>
<synopsis><indexterm role="fn"><primary>!NULL</primary></indexterm><phrase role="category"><emphasis role="bold">Macro Function</emphasis>:</phrase> <function>!NULL</function></synopsis>
<blockquote><para>Expands to an empty character sequence.
</para>
<!-- Keep these examples in sync with the test for !NULL in -->
<!-- tests/language/commands/define.at: -->
<screen>!NULL ↦ empty
!QUOTE(!NULL) ↦ ''
</screen></blockquote>
<synopsis><indexterm role="fn"><primary>!QUOTE</primary></indexterm><phrase role="category"><emphasis role="bold">Macro Function</emphasis>:</phrase> <function>!QUOTE</function> (<emphasis role="arg">arg</emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>!UNQUOTE</primary></indexterm><phrase role="category"><emphasis role="bold">Macro Function</emphasis>:</phrase> <function>!UNQUOTE</function> (<emphasis role="arg">arg</emphasis>)</synopsis>
<blockquote><para>The <literal>!QUOTE</literal> function expands to its argument surrounded by
apostrophes, doubling any apostrophes inside the argument to make sure
that it is valid PSPP syntax for a string. If the argument was
already a quoted string, <literal>!QUOTE</literal> expands to it unchanged.
</para>
<para>Given a quoted string argument, the <literal>!UNQUOTED</literal> function expands
to the string’s contents, with the quotes removed and any doubled
quote marks reduced to singletons. If the argument was not a quoted
string, <literal>!UNQUOTE</literal> expands to the argument unchanged.
</para>
<!-- Keep these examples in sync with the test for !QUOTE and !UNQUOTE in -->
<!-- tests/language/commands/define.at: -->
<screen>!QUOTE(123.0) ↦ '123.0'
!QUOTE( 123 ) ↦ '123'
!QUOTE('a b c') ↦ 'a b c'
!QUOTE("a b c") ↦ "a b c"
!QUOTE(!1) ↦ 'a ''b'' c' if <literal>!1</literal> is <literal>a 'b' c</literal>
!UNQUOTE(123.0) ↦ 123.0
!UNQUOTE( 123 ) ↦ 123
!UNQUOTE('a b c') ↦ a b c
!UNQUOTE("a b c") ↦ a b c
!UNQUOTE(!1) ↦ a 'b' c if <literal>!1</literal> is <literal>a 'b' c</literal>
!QUOTE(!UNQUOTE(123.0)) ↦ '123.0'
!QUOTE(!UNQUOTE( 123 )) ↦ '123'
!QUOTE(!UNQUOTE('a b c')) ↦ 'a b c'
!QUOTE(!UNQUOTE("a b c")) ↦ 'a b c'
!QUOTE(!UNQUOTE(!1)) ↦ 'a ''b'' c' if <literal>!1</literal> is <literal>a 'b' c</literal>
</screen></blockquote>
<synopsis><indexterm role="fn"><primary>!SUBSTR</primary></indexterm><phrase role="category"><emphasis role="bold">Macro Function</emphasis>:</phrase> <function>!SUBSTR</function> (<emphasis role="arg">arg</emphasis>, <emphasis role="arg">start</emphasis>[, <emphasis role="arg">count</emphasis>])</synopsis>
<blockquote><para>Expands to a substring of <replaceable>arg</replaceable> starting from 1-based position
<replaceable>start</replaceable>. If <replaceable>count</replaceable> is given, it limits the number of
characters in the expansion; if it is omitted, then the expansion
extends to the end of <replaceable>arg</replaceable>.
</para>
<screen>!SUBSTR(banana, 3) ↦ nana
!SUBSTR(banana, 3, 3) ↦ nan
!SUBSTR("banana", 1, 3) ↦ error (<literal>"ba</literal> is not a valid token)
!SUBSTR(!UNQUOTE("banana"), 3) ↦ nana
!SUBSTR("banana", 3, 3) ↦ ana
!SUBSTR(banana, 3, 0) ↦ empty
!SUBSTR(banana, 3, 10) ↦ nana
!SUBSTR(banana, 10, 3) ↦ empty
</screen></blockquote>
<synopsis><indexterm role="fn"><primary>!UPCASE</primary></indexterm><phrase role="category"><emphasis role="bold">Macro Function</emphasis>:</phrase> <function>!UPCASE</function> (<emphasis role="arg">arg</emphasis>)</synopsis>
<blockquote><para>Expands to an unquoted version of <replaceable>arg</replaceable> with all letters converted
to uppercase.
</para>
<screen>!UPCASE(freckle) ↦ FRECKLE
!UPCASE('freckle') ↦ FRECKLE
!UPCASE('a b c') ↦ A B C
!UPCASE('A B C') ↦ A B C
</screen></blockquote>
</sect2>
<sect2 label="14.2.7" id="Macro-Expressions">
<title>Macro Expressions</title>
<para>Macro expressions are used in conditional expansion and loops, which
are described in the following sections. A macro expression may use
the following operators, listed in descending order of operator
precedence:
</para>
<variablelist><varlistentry><term><literal>()</literal>
</term><listitem><para>Parentheses override the default operator precedence.
</para>
</listitem></varlistentry><varlistentry><term><literal>!EQ !NE !GT !LT !GE !LE = ~= <> > < >= <=</literal>
</term><listitem><para>Relational operators compare their operands and yield a Boolean
result, either ‘<literal>0</literal>’ for false or ‘<literal>1</literal>’ for true.
</para>
<para>These operators always compare their operands as strings. This can be
surprising when the strings are numbers because, e.g., <literal>1 <
1.0</literal> and <literal>10 < 2</literal> both evaluate to ‘<literal>1</literal>’ (true).
</para>
<para>Comparisons are case sensitive, so that <literal>a = A</literal> evaluates to
‘<literal>0</literal>’ (false).
</para>
</listitem></varlistentry><varlistentry><term><literal>!NOT ~</literal>
</term><term><literal>!AND &</literal>
</term><term><literal>!OR |</literal>
</term><listitem><para>Logical operators interpret their operands as Boolean values, where
quoted or unquoted ‘<literal>0</literal>’ is false and anything else is true, and
yield a Boolean result, either ‘<literal>0</literal>’ for false or ‘<literal>1</literal>’ for
true.
</para></listitem></varlistentry></variablelist>
<para>Macro expressions do not include any arithmetic operators.
</para>
<para>An operand in an expression may be a single token (including a macro
argument name) or a macro function invocation. Either way, the
expression evaluator unquotes the operand, so that <literal>1 = '1'</literal> is
true.
</para>
</sect2>
<sect2 label="14.2.8" id="Macro-Conditional-Expansion">
<title>Macro Conditional Expansion</title>
<para>The <literal>!IF</literal> construct may be used inside a macro body to allow for
conditional expansion. It takes the following forms:
</para>
<screen>!IF (<replaceable>expression</replaceable>) !THEN <replaceable>true-expansion</replaceable> !IFEND
!IF (<replaceable>expression</replaceable>) !THEN <replaceable>true-expansion</replaceable> !ELSE <replaceable>false-expansion</replaceable> !IFEND
</screen>
<para>When <replaceable>expression</replaceable> evaluates to true, the macro processor expands
<replaceable>true-expansion</replaceable>; otherwise, it expands <replaceable>false-expansion</replaceable>, if
it is present. The macro processor considers quoted or unquoted
‘<literal>0</literal>’ to be false, and anything else to be true.
</para>
</sect2>
<sect2 label="14.2.9" id="Macro-Loops">
<title>Macro Loops</title>
<para>The body of a macro may include two forms of loops: loops over
numerical ranges and loops over tokens. Both forms expand a <firstterm>loop
body</firstterm> multiple times, each time setting a named <firstterm>loop variable</firstterm> to
a different value. The loop body typically expands the loop variable
at least once.
</para>
<para>The MITERATE setting (see <link linkend="SET-MITERATE">SET MITERATE</link>) limits the number of
iterations in a loop. This is a safety measure to ensure that macro
expansion terminates. PSPP issues a warning when the MITERATE limit
is exceeded.
</para>
<bridgehead renderas="sect3">Loops Over Ranges</bridgehead>
<screen>!DO <replaceable>!var</replaceable> = <replaceable>start</replaceable> !TO <replaceable>end</replaceable> [!BY <replaceable>step</replaceable>]
<replaceable>body</replaceable>
!DOEND
</screen>
<para>A loop over a numerical range has the form shown above. <replaceable>start</replaceable>,
<replaceable>end</replaceable>, and <replaceable>step</replaceable> (if included) must be expressions with
numeric values. The macro processor accepts both integers and real
numbers. The macro processor expands <replaceable>body</replaceable> for each numeric
value from <replaceable>start</replaceable> to <replaceable>end</replaceable>, inclusive.
</para>
<para>The default value for <replaceable>step</replaceable> is 1. If <replaceable>step</replaceable> is positive and
<inlineequation><mathphrase><replaceable>first</replaceable> > <replaceable>last</replaceable></mathphrase></inlineequation>, or if <replaceable>step</replaceable> is negative and
<inlineequation><mathphrase><replaceable>first</replaceable> < <replaceable>last</replaceable></mathphrase></inlineequation>, then the macro processor doesn’t
expand the body at all. <replaceable>step</replaceable> may not be zero.
</para>
<bridgehead renderas="sect3">Loops Over Tokens</bridgehead>
<screen>!DO <replaceable>!var</replaceable> !IN (<replaceable>expression</replaceable>)
<replaceable>body</replaceable>
!DOEND
</screen>
<para>A loop over tokens takes the form shown above. The macro processor
evaluates <replaceable>expression</replaceable> and expands <replaceable>body</replaceable> once per token in
the result, substituting the token for <replaceable>!var</replaceable> each time it
appears.
</para>
</sect2>
<sect2 label="14.2.10" id="Macro-Variable-Assignment">
<title>Macro Variable Assignment</title>
<para>The <literal>!LET</literal> construct evaluates an expression and assigns the
result to a macro variable. It may create a new macro variable or
change the value of one created by a previous <literal>!LET</literal> or
<literal>!DO</literal>, but it may not change the value of a macro argument.
<literal>!LET</literal> has the following form:
</para>
<screen>!LET <replaceable>!var</replaceable> = <replaceable>expression</replaceable>
</screen>
<para>If <replaceable>expression</replaceable> is more than one token, it must be enclosed in
parentheses.
</para>
</sect2>
<sect2 label="14.2.11" id="Macro-Settings">
<title>Macro Settings</title>
<para>Some macro behavior is controlled through the SET command
(see <link linkend="SET">SET</link>). This section describes these settings.
</para>
<para>Any SET command that changes these settings within a macro body only
takes effect following the macro. This is because PSPP expands a
macro’s entire body at once, so that the SET command inside the body
only executes afterwards.
</para>
<para>The MEXPAND setting (see <link linkend="SET-MEXPAND">SET MEXPAND</link>) controls whether macros will
be expanded at all. By default, macro expansion is on. To avoid
expansion of macros called within a macro body, use <literal>!OFFEXPAND</literal>
and <literal>!ONEXPAND</literal> (see <link linkend="Controlling-Macro-Expansion">Controlling Macro Expansion</link>).
</para>
<para>When MPRINT (see <link linkend="SET-MPRINT">SET MPRINT</link>) is turned on, PSPP outputs an
expansion of each macro called. This feature can be useful for
debugging macro definitions. For reading the expanded version, note
that macro expansion removes comments and standardizes white space.
</para>
<para>MNEST (see <link linkend="SET-MNEST">SET MNEST</link>) limits the depth of expansion of macro
calls, that is, the nesting level of macro expansion. The default is
50. This is mainly useful to avoid infinite expansion in the case of
a macro that calls itself.
</para>
<para>MITERATE (see <link linkend="SET-MITERATE">SET MITERATE</link>) limits the number of iterations in a
<literal>!DO</literal> construct. The default is 1000.
</para>
</sect2>
<sect2 label="14.2.12" id="Macro-Notes">
<title>Additional Notes</title>
<sect3 label="14.2.12.1">
<title>Calling Macros from Macros</title>
<para>If the body of macro A includes a call to macro B, the call can use
macro arguments (including <literal>!*</literal>) and macro variables as part of
arguments to B. For <literal>!TOKENS</literal> arguments, the argument or
variable name counts as one token regardless of the number that it
expands into; for <literal>!CHAREND</literal> and <literal>!ENCLOSE</literal> arguments, the
delimiters come only from the call, not the expansions; and
<literal>!CMDEND</literal> ends at the calling command, not any end of command
within an argument or variable.
</para>
<para>Macro functions are not supported as part of the arguments in a macro
call. To get the same effect, use <literal>!LET</literal> to define a macro
variable, then pass the macro variable to the macro.
</para>
<para>When macro A calls macro B, the order of their <literal>DEFINE</literal> commands
doesn’t matter, as long as macro B has been defined when A is called.
</para>
</sect3>
<sect3 label="14.2.12.2">
<title>Command Terminators</title>
<para>Macros and command terminators require care. Macros honor the syntax
differences between interactive and batch syntax (see <link linkend="Syntax-Variants">Syntax
Variants</link>), which means that the interpretation of a macro can vary
depending on the syntax mode in use. We assume here that interactive
mode is in use, in which ‘<literal>.</literal>’ at the end of a line is the
primary way to end a command.
</para>
<para>The <literal>DEFINE</literal> command needs to end with ‘<literal>.</literal>’ following the
<literal>!ENDDEFINE</literal>. The macro body may contain ‘<literal>.</literal>’ if it is
intended to expand to whole commands, but using ‘<literal>.</literal>’ within a
macro body that expands to just syntax fragments (such as a list of
variables) will cause syntax errors.
</para>
<para>Macro directives such as <literal>!IF</literal> and <literal>!DO</literal> do not end with
‘<literal>.</literal>’.
</para>
</sect3>
<sect3 label="14.2.12.3">
<title>Expansion Contexts</title>
<para>Macros do not expand within comments, whether introduced within a line
by <literal>/*</literal> or as a separate COMMENT or ‘<literal>*</literal>’ commands
(see <link linkend="COMMENT">COMMENT</link>). (SPSS does expand macros in COMMENT and ‘<literal>*</literal>’.)
</para>
<para>Macros do not expand within quoted strings.
</para>
<para>Macros are expanded in the <literal>TITLE</literal> and <literal>SUBTITLE</literal> commands
as long as their arguments are not quoted strings.
</para>
</sect3>
<sect3 label="14.2.12.4">
<title>PRESERVE and RESTORE</title>
<para>Some macro bodies might use the SET command to change certain
settings. When this is the case, consider using the PRESERVE and
RESTORE commands to save and then restore these settings.
See <link linkend="PRESERVE-and-RESTORE">PRESERVE and RESTORE</link>.
</para>
</sect3>
</sect2>
</sect1>
<sect1 label="14.3" id="DO-IF">
<title>DO IF</title>
<indexterm role="vr"><primary>DO IF</primary></indexterm>
<literallayout>DO IF condition.
…
[ELSE IF condition.
…
]…
[ELSE.
…]
END IF.
</literallayout>
<para><literal>DO IF</literal> allows one of several sets of transformations to be
executed, depending on user-specified conditions.
</para>
<para>If the specified boolean expression evaluates as true, then the block
of code following <literal>DO IF</literal> is executed. If it evaluates as
missing, then
none of the code blocks is executed. If it is false, then
the boolean expression on the first <literal>ELSE IF</literal>, if present, is tested in
turn, with the same rules applied. If all expressions evaluate to
false, then the <literal>ELSE</literal> code block is executed, if it is present.
</para>
<para>When <literal>DO IF</literal> or <literal>ELSE IF</literal> is specified following <literal>TEMPORARY</literal>
(see <link linkend="TEMPORARY">TEMPORARY</link>), the <literal>LAG</literal> function may not be used
(see <link linkend="LAG">LAG</link>).
</para>
</sect1>
<sect1 label="14.4" id="DO-REPEAT">
<title>DO REPEAT</title>
<indexterm role="vr"><primary>DO REPEAT</primary></indexterm>
<literallayout>DO REPEAT dummy_name=expansion….
…
END REPEAT [PRINT].
expansion takes one of the following forms:
var_list
num_or_range…
’string’…
ALL
num_or_range takes one of the following forms:
number
num1 TO num2
</literallayout>
<para><literal>DO REPEAT</literal> repeats a block of code, textually substituting
different variables, numbers, or strings into the block with each
repetition.
</para>
<para>Specify a dummy variable name followed by an equals sign (‘<literal>=</literal>’)
and the list of replacements. Replacements can be a list of existing
or new variables, numbers, strings, or <literal>ALL</literal> to specify all
existing variables. When numbers are specified, runs of increasing
integers may be indicated as <literal><replaceable>num1</replaceable> TO <replaceable>num2</replaceable></literal>, so that
‘<literal>1 TO 5</literal>’ is short for ‘<literal>1 2 3 4 5</literal>’.
</para>
<para>Multiple dummy variables can be specified. Each
variable must have the same number of replacements.
</para>
<para>The code within <literal>DO REPEAT</literal> is repeated as many times as there are
replacements for each variable. The first time, the first value for
each dummy variable is substituted; the second time, the second value
for each dummy variable is substituted; and so on.
</para>
<para>Dummy variable substitutions work like macros. They take place
anywhere in a line that the dummy variable name occurs. This includes
command and subcommand names, so command and subcommand names that
appear in the code block should not be used as dummy variable
identifiers. Dummy variable substitutions do not occur inside quoted
strings, comments, unquoted strings (such as the text on the
<literal>TITLE</literal> or <literal>DOCUMENT</literal> command), or inside <literal>BEGIN
DATA</literal>…<literal>END DATA</literal>.
</para>
<para>Substitution occurs only on whole words, so that, for example, a dummy
variable PRINT would not be substituted into the word PRINTOUT.
</para>
<para>New variable names used as replacements are not automatically created
as variables, but only if used in the code block in a context that
would create them, <emphasis>e.g.</emphasis> on a <literal>NUMERIC</literal> or <literal>STRING</literal> command
or on the left side of a <literal>COMPUTE</literal> assignment.
</para>
<para>Any command may appear within <literal>DO REPEAT</literal>, including nested <literal>DO REPEAT</literal>
commands. If <literal>INCLUDE</literal> or <literal>INSERT</literal> appears within <literal>DO REPEAT</literal>,
the substitutions do not apply to the included file.
</para>
<para>If <literal>PRINT</literal> is specified on <literal>END REPEAT</literal>, the commands after
substitutions are made should be printed to the listing file, prefixed
by a plus sign (‘<literal>+</literal>’). This feature is not yet implemented.
</para>
</sect1>
<sect1 label="14.5" id="LOOP">
<title>LOOP</title>
<indexterm role="vr"><primary>LOOP</primary></indexterm>
<literallayout>LOOP [<replaceable>index_var</replaceable>=<replaceable>start</replaceable> TO <replaceable>end</replaceable> [BY <replaceable>incr</replaceable>]] [IF <replaceable>condition</replaceable>].
…
END LOOP [IF <replaceable>condition</replaceable>].
</literallayout>
<para><literal>LOOP</literal> iterates a group of commands. A number of
termination options are offered.
</para>
<para>Specify index_var to make that variable count from one value to
another by a particular increment. <replaceable>index_var</replaceable> must be a pre-existing
numeric variable. <replaceable>start</replaceable>, <replaceable>end</replaceable>, and <replaceable>incr</replaceable> are numeric expressions
(see <link linkend="Expressions">Expressions</link>.)
</para>
<para>During the first iteration, <replaceable>index_var</replaceable> is set to the value of <replaceable>start</replaceable>.
During each successive iteration, <replaceable>index_var</replaceable> is increased by the value of
<replaceable>incr</replaceable>. If <replaceable>end</replaceable> > <replaceable>start</replaceable>, then the loop terminates
when <replaceable>index_var</replaceable> > <replaceable>end</replaceable>;
otherwise it terminates when <replaceable>index_var</replaceable> < <replaceable>end</replaceable>. If <replaceable>incr</replaceable> is not specified
then it defaults to +1 or -1 as appropriate.
</para>
<para>If <replaceable>end</replaceable> > <replaceable>start</replaceable> and <replaceable>incr</replaceable> < 0, or if <replaceable>end</replaceable> < <replaceable>start</replaceable> and
<replaceable>incr</replaceable> > 0, then the
loop is never executed. <replaceable>index_var</replaceable> is nevertheless set to the value of
start.
</para>
<para>Modifying <replaceable>index_var</replaceable> within the loop is allowed, but it has no effect on
the value of <replaceable>index_var</replaceable> in the next iteration.
</para>
<para>Specify a boolean expression for the condition on <literal>LOOP</literal> to
cause the loop to be executed only if the condition is true. If the
condition is false or missing before the loop contents are executed the
first time, the loop contents are not executed at all.
</para>
<para>If index and condition clauses are both present on <literal>LOOP</literal>, the
index variable is always set before the condition is evaluated. Thus,
a condition that makes use of the index variable will always see the
index value to be used in the next execution of the body.
</para>
<para>Specify a boolean expression for the condition on <literal>END LOOP</literal> to cause
the loop to terminate if the condition is true after the enclosed
code block is executed. The condition is evaluated at the end of the
loop, not at the beginning, so that the body of a loop with only a
condition on <literal>END LOOP</literal> will always execute at least once.
</para>
<para>If the index clause is not present, then the global <literal>MXLOOPS</literal>
setting, which defaults to 40, limits the number of iterations
(see <link linkend="SET-MXLOOPS">SET MXLOOPS</link>).
</para>
<para><literal>BREAK</literal> also terminates <literal>LOOP</literal> execution (see <link linkend="BREAK">BREAK</link>).
</para>
<para>Loop index variables are by default reset to system-missing from one
case to another, not left, unless a scratch variable is used as index.
When loops are nested, this is usually undesired behavior, which can
be corrected with <literal>LEAVE</literal> (see <link linkend="LEAVE">LEAVE</link>) or by using a scratch
variable as the loop index.
</para>
<para>When <literal>LOOP</literal> or <literal>END LOOP</literal> is specified following <literal>TEMPORARY</literal>
(see <link linkend="TEMPORARY">TEMPORARY</link>), the <literal>LAG</literal> function may not be used
(see <link linkend="LAG">LAG</link>).
<!-- PSPP - a program for statistical analysis. -->
<!-- Copyright (C) 2017, 2020 Free Software Foundation, Inc. -->
<!-- Permission is granted to copy, distribute and/or modify this document -->
<!-- under the terms of the GNU Free Documentation License, Version 1.3 -->
<!-- or any later version published by the Free Software Foundation; -->
<!-- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -->
<!-- A copy of the license is included in the section entitled "GNU -->
<!-- Free Documentation License". -->
<!-- -->
</para></sect1>
</chapter>
<chapter label="15" id="Statistics">
<title>Statistics</title>
<para>This chapter documents the statistical procedures that PSPP supports so
far.
</para>
<sect1 label="15.1" id="DESCRIPTIVES">
<title>DESCRIPTIVES</title>
<indexterm role="vr"><primary>DESCRIPTIVES</primary></indexterm>
<literallayout>DESCRIPTIVES
/VARIABLES=<replaceable>var_list</replaceable>
/MISSING={VARIABLE,LISTWISE} {INCLUDE,NOINCLUDE}
/FORMAT={LABELS,NOLABELS} {NOINDEX,INDEX} {LINE,SERIAL}
/SAVE
/STATISTICS={ALL,MEAN,SEMEAN,STDDEV,VARIANCE,KURTOSIS,
SKEWNESS,RANGE,MINIMUM,MAXIMUM,SUM,DEFAULT,
SESKEWNESS,SEKURTOSIS}
/SORT={NONE,MEAN,SEMEAN,STDDEV,VARIANCE,KURTOSIS,SKEWNESS,
RANGE,MINIMUM,MAXIMUM,SUM,SESKEWNESS,SEKURTOSIS,NAME}
{A,D}
</literallayout>
<para>The <literal>DESCRIPTIVES</literal> procedure reads the active dataset and outputs
linear descriptive statistics requested by the user. In addition, it can optionally
compute Z-scores.
</para>
<para>The <literal>VARIABLES</literal> subcommand, which is required, specifies the list of
variables to be analyzed. Keyword <literal>VARIABLES</literal> is optional.
</para>
<para>All other subcommands are optional:
</para>
<para>The <literal>MISSING</literal> subcommand determines the handling of missing variables. If
<literal>INCLUDE</literal> is set, then user-missing values are included in the
calculations. If <literal>NOINCLUDE</literal> is set, which is the default, user-missing
values are excluded. If <literal>VARIABLE</literal> is set, then missing values are
excluded on a variable by variable basis; if <literal>LISTWISE</literal> is set, then
the entire case is excluded whenever any value in that case has a
system-missing or, if <literal>INCLUDE</literal> is set, user-missing value.
</para>
<para>The <literal>FORMAT</literal> subcommand has no effect. It is accepted for
backward compatibility.
</para>
<para>The <literal>SAVE</literal> subcommand causes <literal>DESCRIPTIVES</literal> to calculate Z scores for all
the specified variables. The Z scores are saved to new variables.
Variable names are generated by trying first the original variable name
with Z prepended and truncated to a maximum of 8 characters, then the
names ZSC000 through ZSC999, STDZ00 through STDZ09, ZZZZ00 through
ZZZZ09, ZQZQ00 through ZQZQ09, in that sequence. In addition, Z score
variable names can be specified explicitly on <literal>VARIABLES</literal> in the variable
list by enclosing them in parentheses after each variable.
When Z scores are calculated, PSPP ignores <literal>TEMPORARY</literal>,
treating temporary transformations as permanent.
</para>
<para>The <literal>STATISTICS</literal> subcommand specifies the statistics to be displayed:
</para>
<variablelist><varlistentry><term><literal><literal>ALL</literal></literal>
</term><listitem><para>All of the statistics below.
</para></listitem></varlistentry><varlistentry><term><literal><literal>MEAN</literal></literal>
</term><listitem><para>Arithmetic mean.
</para></listitem></varlistentry><varlistentry><term><literal><literal>SEMEAN</literal></literal>
</term><listitem><para>Standard error of the mean.
</para></listitem></varlistentry><varlistentry><term><literal><literal>STDDEV</literal></literal>
</term><listitem><para>Standard deviation.
</para></listitem></varlistentry><varlistentry><term><literal><literal>VARIANCE</literal></literal>
</term><listitem><para>Variance.
</para></listitem></varlistentry><varlistentry><term><literal><literal>KURTOSIS</literal></literal>
</term><listitem><para>Kurtosis and standard error of the kurtosis.
</para></listitem></varlistentry><varlistentry><term><literal><literal>SKEWNESS</literal></literal>
</term><listitem><para>Skewness and standard error of the skewness.
</para></listitem></varlistentry><varlistentry><term><literal><literal>RANGE</literal></literal>
</term><listitem><para>Range.
</para></listitem></varlistentry><varlistentry><term><literal>MINIMUM</literal>
</term><listitem><para>Minimum value.
</para></listitem></varlistentry><varlistentry><term><literal>MAXIMUM</literal>
</term><listitem><para>Maximum value.
</para></listitem></varlistentry><varlistentry><term><literal>SUM</literal>
</term><listitem><para>Sum.
</para></listitem></varlistentry><varlistentry><term><literal>DEFAULT</literal>
</term><listitem><para>Mean, standard deviation of the mean, minimum, maximum.
</para></listitem></varlistentry><varlistentry><term><literal>SEKURTOSIS</literal>
</term><listitem><para>Standard error of the kurtosis.
</para></listitem></varlistentry><varlistentry><term><literal>SESKEWNESS</literal>
</term><listitem><para>Standard error of the skewness.
</para></listitem></varlistentry></variablelist>
<para>The <literal>SORT</literal> subcommand specifies how the statistics should be sorted. Most
of the possible values should be self-explanatory. <literal>NAME</literal> causes the
statistics to be sorted by name. By default, the statistics are listed
in the order that they are specified on the <literal>VARIABLES</literal> subcommand.
The <literal>A</literal> and <literal>D</literal> settings request an ascending or descending
sort order, respectively.
</para>
<sect2 label="15.1.1">
<title>Descriptives Example</title>
<para>The <filename>physiology.sav</filename> file contains various physiological data for a sample
of persons. Running the <literal>DESCRIPTIVES</literal> command on the variables <emphasis role="bold">height</emphasis>
and <emphasis role="bold">temperature</emphasis> with the default options allows one to see simple linear
statistics for these two variables. In <link linkend="descriptives_003aex">descriptives:ex</link>, these variables
are specfied on the <literal>VARIABLES</literal> subcommand and the <literal>SAVE</literal> option
has been used, to request that Z scores be calculated.
</para>
<para>After the command has completed, this example runs <literal>DESCRIPTIVES</literal> again, this
time on the <emphasis role="bold">zheight</emphasis> and <emphasis role="bold">ztemperature</emphasis> variables,
which are the two normalized (Z-score) variables generated by the
first <literal>DESCRIPTIVES</literal> command.
</para>
<anchor id="descriptives_003aex"/>
<sidebar><screen>get file='physiology.sav'.
descriptives
/variables = height temperature
/save.
descriptives
/variables = zheight ztemperature.
</screen></sidebar>
<anchor id="descriptives_003ascr"/>
<sidebar></sidebar>
<para>In <link linkend="descriptives_003ares">descriptives:res</link>, we can see that there are 40 valid data for each of the variables
and no missing values. The mean average of the height and temperature is 16677.12
and 37.02 respectively. The descriptive statistics for temperature seem reasonable.
However there is a very high standard deviation for <emphasis role="bold">height</emphasis> and a suspiciously
low minimum. This is due to a data entry error in the
data (see <link linkend="Identifying-incorrect-data">Identifying incorrect data</link>).
</para>
<para>In the second Descriptive Statistics command, one can see that the mean and standard
deviation of both Z score variables is 0 and 1 respectively. All Z score statistics
should have these properties since they are normalized versions of the original scores.
</para>
<anchor id="descriptives_003ares"/>
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Mapping of Variables to Z-scores
+--------------------------------------------+------------+
| Source | Target |
+--------------------------------------------+------------+
|Height in millimeters |Zheight |
|Internal body temperature in degrees Celcius|Ztemperature|
+--------------------------------------------+------------+
Descriptive Statistics
+------------------------------------------+--+-------+-------+-------+-------+
| | N| Mean |Std Dev|Minimum|Maximum|
+------------------------------------------+--+-------+-------+-------+-------+
|Height in millimeters |40|1677.12| 262.87| 179| 1903|
|Internal body temperature in degrees |40| 37.02| 1.82| 32.59| 39.97|
|Celcius | | | | | |
|Valid N (listwise) |40| | | | |
|Missing N (listwise) | 0| | | | |
+------------------------------------------+--+-------+-------+-------+-------+
Descriptive Statistics
+-----------------------------------------+--+---------+------+-------+-------+
| | | | Std | | |
| | N| Mean | Dev |Minimum|Maximum|
+-----------------------------------------+--+---------+------+-------+-------+
|Z-score of Height in millimeters |40|1.93E-015| 1.00| -5.70| .86|
|Z-score of Internal body temperature in |40|1.37E-015| 1.00| -2.44| 1.62|
|degrees Celcius | | | | | |
|Valid N (listwise) |40| | | | |
|Missing N (listwise) | 0| | | | |
+-----------------------------------------+--+---------+------+-------+-------+
</screen>
</sect2>
</sect1>
<sect1 label="15.2" id="FREQUENCIES">
<title>FREQUENCIES</title>
<indexterm role="vr"><primary>FREQUENCIES</primary></indexterm>
<literallayout>FREQUENCIES
/VARIABLES=<replaceable>var_list</replaceable>
/FORMAT={TABLE,NOTABLE,LIMIT(<replaceable>limit</replaceable>)}
{AVALUE,DVALUE,AFREQ,DFREQ}
/MISSING={EXCLUDE,INCLUDE}
/STATISTICS={DEFAULT,MEAN,SEMEAN,MEDIAN,MODE,STDDEV,VARIANCE,
KURTOSIS,SKEWNESS,RANGE,MINIMUM,MAXIMUM,SUM,
SESKEWNESS,SEKURTOSIS,ALL,NONE}
/NTILES=<replaceable>ntiles</replaceable>
/PERCENTILES=percent…
/HISTOGRAM=[MINIMUM(<replaceable>x_min</replaceable>)] [MAXIMUM(<replaceable>x_max</replaceable>)]
[{FREQ[(<replaceable>y_max</replaceable>)],PERCENT[(<replaceable>y_max</replaceable>)]}] [{NONORMAL,NORMAL}]
/PIECHART=[MINIMUM(<replaceable>x_min</replaceable>)] [MAXIMUM(<replaceable>x_max</replaceable>)]
[{FREQ,PERCENT}] [{NOMISSING,MISSING}]
/BARCHART=[MINIMUM(<replaceable>x_min</replaceable>)] [MAXIMUM(<replaceable>x_max</replaceable>)]
[{FREQ,PERCENT}]
/ORDER={ANALYSIS,VARIABLE}
(These options are not currently implemented.)
/HBAR=…
/GROUPED=…
</literallayout>
<para>The <literal>FREQUENCIES</literal> procedure outputs frequency tables for specified
variables.
<literal>FREQUENCIES</literal> can also calculate and display descriptive statistics
(including median and mode) and percentiles, and various graphical representations
of the frequency distribution.
</para>
<para>The <literal>VARIABLES</literal> subcommand is the only required subcommand. Specify the
variables to be analyzed.
</para>
<para>The <literal>FORMAT</literal> subcommand controls the output format. It has several
possible settings:
</para>
<itemizedlist><listitem><para><literal></literal> <literal>TABLE</literal>, the default, causes a frequency table to be output for every
variable specified. <literal>NOTABLE</literal> prevents them from being output. <literal>LIMIT</literal>
with a numeric argument causes them to be output except when there are
more than the specified number of values in the table.
</para>
</listitem><listitem><para><literal></literal> Normally frequency tables are sorted in ascending order by value. This
is <literal>AVALUE</literal>. <literal>DVALUE</literal> tables are sorted in descending order by value.
<literal>AFREQ</literal> and <literal>DFREQ</literal> tables are sorted in ascending and descending order,
respectively, by frequency count.
</para></listitem></itemizedlist>
<para>The <literal>MISSING</literal> subcommand controls the handling of user-missing values.
When <literal>EXCLUDE</literal>, the default, is set, user-missing values are not included
in frequency tables or statistics. When <literal>INCLUDE</literal> is set, user-missing
are included. System-missing values are never included in statistics,
but are listed in frequency tables.
</para>
<para>The available <literal>STATISTICS</literal> are the same as available
in <literal>DESCRIPTIVES</literal> (see <link linkend="DESCRIPTIVES">DESCRIPTIVES</link>), with the addition
of <literal>MEDIAN</literal>, the data’s median
value, and MODE, the mode. (If there are multiple modes, the smallest
value is reported.) By default, the mean, standard deviation of the
mean, minimum, and maximum are reported for each variable.
</para>
<indexterm role="cp"><primary>percentiles</primary></indexterm>
<para><literal>PERCENTILES</literal> causes the specified percentiles to be reported.
The percentiles should be presented at a list of numbers between 0
and 100 inclusive.
The <literal>NTILES</literal> subcommand causes the percentiles to be reported at the
boundaries of the data set divided into the specified number of ranges.
For instance, <literal>/NTILES=4</literal> would cause quartiles to be reported.
</para>
<indexterm role="cp"><primary>histogram</primary></indexterm>
<para>The <literal>HISTOGRAM</literal> subcommand causes the output to include a histogram for
each specified numeric variable. The X axis by default ranges from
the minimum to the maximum value observed in the data, but the <literal>MINIMUM</literal>
and <literal>MAXIMUM</literal> keywords can set an explicit range.
<footnote><para>The number of
bins is chosen according to the Freedman-Diaconis rule:
<inlineequation><mathphrase>2 \times IQR(x)n^{-1/3}</mathphrase></inlineequation>, where <inlineequation><mathphrase>IQR(x)</mathphrase></inlineequation> is the interquartile range of <inlineequation><mathphrase>x</mathphrase></inlineequation>
and <inlineequation><mathphrase>n</mathphrase></inlineequation> is the number of samples. Note that
<literal>EXAMINE</literal> uses a different algorithm to determine bin sizes.</para></footnote>
Histograms are not created for string variables.
</para>
<para>Specify <literal>NORMAL</literal> to superimpose a normal curve on the
histogram.
</para>
<indexterm role="cp"><primary>piechart</primary></indexterm>
<para>The <literal>PIECHART</literal> subcommand adds a pie chart for each variable to the data. Each
slice represents one value, with the size of the slice proportional to
the value’s frequency. By default, all non-missing values are given
slices.
The <literal>MINIMUM</literal> and <literal>MAXIMUM</literal> keywords can be used to limit the
displayed slices to a given range of values.
The keyword <literal>NOMISSING</literal> causes missing values to be omitted from the
piechart. This is the default.
If instead, <literal>MISSING</literal> is specified, then the pie chart includes
a single slice representing all system missing and user-missing cases.
</para>
<indexterm role="cp"><primary>bar chart</primary></indexterm>
<para>The <literal>BARCHART</literal> subcommand produces a bar chart for each variable.
The <literal>MINIMUM</literal> and <literal>MAXIMUM</literal> keywords can be used to omit
categories whose counts which lie outside the specified limits.
The <literal>FREQ</literal> option (default) causes the ordinate to display the frequency
of each category, whereas the <literal>PERCENT</literal> option displays relative
percentages.
</para>
<para>The <literal>FREQ</literal> and <literal>PERCENT</literal> options on <literal>HISTOGRAM</literal> and
<literal>PIECHART</literal> are accepted but not currently honoured.
</para>
<para>The <literal>ORDER</literal> subcommand is accepted but ignored.
</para>
<sect2 label="15.2.1">
<title>Frequencies Example</title>
<para><link linkend="frequencies_003aex">frequencies:ex</link> runs a frequency analysis on the <emphasis role="bold">sex</emphasis>
and <emphasis role="bold">occupation</emphasis> variables from the <filename>personnel.sav</filename> file.
This is useful to get a general idea of the way in which these nominal
variables are distributed.
</para>
<anchor id="frequencies_003aex"/>
<sidebar><screen>get file='personnel.sav'.
frequencies /variables = sex occupation
/statistics = none.
</screen></sidebar>
<para>If you are using the graphic user interface, the dialog box is set up such that
by default, several statistics are calculated. Some are not particularly useful
for categorical variables, so you may want to disable those.
</para>
<anchor id="frequencies_003ascr"/>
<sidebar></sidebar>
<para>From <link linkend="frequencies_003ares">frequencies:res</link> it is evident that there are 33 males, 21 females and
2 persons for whom their sex has not been entered.
</para>
<para>One can also see how many of each occupation there are in the data.
When dealing with string variables used as nominal values, running a frequency
analysis is useful to detect data input entries. Notice that
one <emphasis role="bold">occupation</emphasis> value has been mistyped as “Scrientist”. This entry should
be corrected, or marked as missing before using the data.
</para>
<anchor id="frequencies_003ares"/>
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> sex
+--------------+---------+-------+-------------+------------------+
| |Frequency|Percent|Valid Percent|Cumulative Percent|
+--------------+---------+-------+-------------+------------------+
|Valid Male | 33| 58.9%| 61.1%| 61.1%|
| Female| 21| 37.5%| 38.9%| 100.0%|
+--------------+---------+-------+-------------+------------------+
|Missing . | 2| 3.6%| | |
+--------------+---------+-------+-------------+------------------+
|Total | 56| 100.0%| | |
+--------------+---------+-------+-------------+------------------+
occupation
+------------------------+---------+-------+-------------+------------------+
| |Frequency|Percent|Valid Percent|Cumulative Percent|
+------------------------+---------+-------+-------------+------------------+
|Valid Artist | 8| 14.3%| 14.3%| 14.3%|
| Baker | 2| 3.6%| 3.6%| 17.9%|
| Barrister | 1| 1.8%| 1.8%| 19.6%|
| Carpenter | 4| 7.1%| 7.1%| 26.8%|
| Cleaner | 4| 7.1%| 7.1%| 33.9%|
| Cook | 7| 12.5%| 12.5%| 46.4%|
| Manager | 8| 14.3%| 14.3%| 60.7%|
| Mathematician | 4| 7.1%| 7.1%| 67.9%|
| Painter | 2| 3.6%| 3.6%| 71.4%|
| Payload Specialist| 1| 1.8%| 1.8%| 73.2%|
| Plumber | 5| 8.9%| 8.9%| 82.1%|
| Scientist | 7| 12.5%| 12.5%| 94.6%|
| Scrientist | 1| 1.8%| 1.8%| 96.4%|
| Tailor | 2| 3.6%| 3.6%| 100.0%|
+------------------------+---------+-------+-------------+------------------+
|Total | 56| 100.0%| | |
+------------------------+---------+-------+-------------+------------------+
</screen>
</sect2>
</sect1>
<sect1 label="15.3" id="EXAMINE">
<title>EXAMINE</title>
<indexterm role="vr"><primary>EXAMINE</primary></indexterm>
<indexterm role="cp"><primary>Exploratory data analysis</primary></indexterm>
<indexterm role="cp"><primary>normality, testing</primary></indexterm>
<literallayout>EXAMINE
VARIABLES= <replaceable>var1</replaceable> [<replaceable>var2</replaceable>] … [<replaceable>varN</replaceable>]
[BY <replaceable>factor1</replaceable> [BY <replaceable>subfactor1</replaceable>]
[ <replaceable>factor2</replaceable> [BY <replaceable>subfactor2</replaceable>]]
…
[ <replaceable>factor3</replaceable> [BY <replaceable>subfactor3</replaceable>]]
]
/STATISTICS={DESCRIPTIVES, EXTREME[(<replaceable>n</replaceable>)], ALL, NONE}
/PLOT={BOXPLOT, NPPLOT, HISTOGRAM, SPREADLEVEL[(<replaceable>t</replaceable>)], ALL, NONE}
/CINTERVAL <replaceable>p</replaceable>
/COMPARE={GROUPS,VARIABLES}
/ID=<replaceable>identity_variable</replaceable>
/{TOTAL,NOTOTAL}
/PERCENTILE=[<replaceable>percentiles</replaceable>]={HAVERAGE, WAVERAGE, ROUND, AEMPIRICAL, EMPIRICAL }
/MISSING={LISTWISE, PAIRWISE} [{EXCLUDE, INCLUDE}]
[{NOREPORT,REPORT}]
</literallayout>
<para>The <literal>EXAMINE</literal> command is used to perform exploratory data analysis.
In particular, it is useful for testing how closely a distribution follows a
normal distribution, and for finding outliers and extreme values.
</para>
<para>The <literal>VARIABLES</literal> subcommand is mandatory.
It specifies the dependent variables and optionally variables to use as
factors for the analysis.
Variables listed before the first <literal>BY</literal> keyword (if any) are the
dependent variables.
The dependent variables may optionally be followed by a list of
factors which tell PSPP how to break down the analysis for each
dependent variable.
</para>
<para>Following the dependent variables, factors may be specified.
The factors (if desired) should be preceded by a single <literal>BY</literal> keyword.
The format for each factor is
</para><literallayout><replaceable>factorvar</replaceable> [BY <replaceable>subfactorvar</replaceable>].
</literallayout><para>Each unique combination of the values of <replaceable>factorvar</replaceable> and
<replaceable>subfactorvar</replaceable> divide the dataset into <firstterm>cells</firstterm>.
Statistics are calculated for each cell
and for the entire dataset (unless <literal>NOTOTAL</literal> is given).
</para>
<para>The <literal>STATISTICS</literal> subcommand specifies which statistics to show.
<literal>DESCRIPTIVES</literal> produces a table showing some parametric and
non-parametrics statistics.
<literal>EXTREME</literal> produces a table showing the extremities of each cell.
A number in parentheses, <replaceable>n</replaceable> determines
how many upper and lower extremities to show.
The default number is 5.
</para>
<para>The subcommands <literal>TOTAL</literal> and <literal>NOTOTAL</literal> are mutually exclusive.
If <literal>TOTAL</literal> appears, then statistics for the entire dataset
as well as for each cell are produced.
If <literal>NOTOTAL</literal> appears, then statistics are produced only for the cells
(unless no factor variables have been given).
These subcommands have no effect if there have been no factor variables
specified.
</para>
<indexterm role="cp"><primary>boxplot</primary></indexterm>
<indexterm role="cp"><primary>histogram</primary></indexterm>
<indexterm role="cp"><primary>npplot</primary></indexterm>
<indexterm role="cp"><primary>spreadlevel plot</primary></indexterm>
<para>The <literal>PLOT</literal> subcommand specifies which plots are to be produced if any.
Available plots are <literal>HISTOGRAM</literal>, <literal>NPPLOT</literal>, <literal>BOXPLOT</literal> and
<literal>SPREADLEVEL</literal>.
The first three can be used to visualise how closely each cell conforms to a
normal distribution, whilst the spread vs. level plot can be useful to visualise
how the variance differs between factors.
Boxplots show you the outliers and extreme values.
<footnote><para><literal>HISTOGRAM</literal> uses Sturges’ rule to determine the number of
bins, as approximately <inlineequation><mathphrase>1 + \log2(n)</mathphrase></inlineequation>, where <inlineequation><mathphrase>n</mathphrase></inlineequation> is the number of samples.
Note that <literal>FREQUENCIES</literal> uses a different algorithm to find the bin size.</para></footnote>
</para>
<para>The <literal>SPREADLEVEL</literal> plot displays the interquartile range versus the
median. It takes an optional parameter <replaceable>t</replaceable>, which specifies how the data
should be transformed prior to plotting.
The given value <replaceable>t</replaceable> is a power to which the data are raised. For example, if
<replaceable>t</replaceable> is given as 2, then the square of the data is used.
Zero, however is a special value. If <replaceable>t</replaceable> is 0 or
is omitted, then data are transformed by taking its natural logarithm instead of
raising to the power of <replaceable>t</replaceable>.
</para>
<indexterm role="cp"><primary>Shapiro-Wilk</primary></indexterm>
<para>When one or more plots are requested, <literal>EXAMINE</literal> also performs the
Shapiro-Wilk test for each category.
There are however a number of provisos:
</para><itemizedlist><listitem><para>All weight values must be integer.
</para></listitem><listitem><para>The cumulative weight value must be in the range [3, 5000]
</para></listitem></itemizedlist>
<para>The <literal>COMPARE</literal> subcommand is only relevant if producing boxplots, and it is only
useful there is more than one dependent variable and at least one factor.
If
<literal>/COMPARE=GROUPS</literal> is specified, then one plot per dependent variable is produced,
each of which contain boxplots for all the cells.
If <literal>/COMPARE=VARIABLES</literal> is specified, then one plot per cell is produced,
each containing one boxplot per dependent variable.
If the <literal>/COMPARE</literal> subcommand is omitted, then PSPP behaves as if
<literal>/COMPARE=GROUPS</literal> were given.
</para>
<para>The <literal>ID</literal> subcommand is relevant only if <literal>/PLOT=BOXPLOT</literal> or
<literal>/STATISTICS=EXTREME</literal> has been given.
If given, it should provide the name of a variable which is to be used
to labels extreme values and outliers.
Numeric or string variables are permissible.
If the <literal>ID</literal> subcommand is not given, then the case number is used for
labelling.
</para>
<para>The <literal>CINTERVAL</literal> subcommand specifies the confidence interval to use in
calculation of the descriptives command. The default is 95%.
</para>
<indexterm role="cp"><primary>percentiles</primary></indexterm>
<para>The <literal>PERCENTILES</literal> subcommand specifies which percentiles are to be calculated,
and which algorithm to use for calculating them. The default is to
calculate the 5, 10, 25, 50, 75, 90, 95 percentiles using the
<literal>HAVERAGE</literal> algorithm.
</para>
<para>The <literal>TOTAL</literal> and <literal>NOTOTAL</literal> subcommands are mutually exclusive. If <literal>NOTOTAL</literal>
is given and factors have been specified in the <literal>VARIABLES</literal> subcommand,
then statistics for the unfactored dependent variables are
produced in addition to the factored variables. If there are no
factors specified then <literal>TOTAL</literal> and <literal>NOTOTAL</literal> have no effect.
</para>
<para>The following example generates descriptive statistics and histograms for
two variables <replaceable>score1</replaceable> and <replaceable>score2</replaceable>.
Two factors are given, <emphasis>viz</emphasis>: <replaceable>gender</replaceable> and <replaceable>gender</replaceable> BY <replaceable>culture</replaceable>.
Therefore, the descriptives and histograms are generated for each
distinct value
of <replaceable>gender</replaceable> <emphasis>and</emphasis> for each distinct combination of the values
of <replaceable>gender</replaceable> and <replaceable>race</replaceable>.
Since the <literal>NOTOTAL</literal> keyword is given, statistics and histograms for
<replaceable>score1</replaceable> and <replaceable>score2</replaceable> covering the whole dataset are not produced.
</para><screen>EXAMINE <replaceable>score1</replaceable> <replaceable>score2</replaceable> BY
<replaceable>gender</replaceable>
<replaceable>gender</replaceable> BY <replaceable>culture</replaceable>
/STATISTICS = DESCRIPTIVES
/PLOT = HISTOGRAM
/NOTOTAL.
</screen>
<para>Here is a second example showing how the <literal>examine</literal> command can be used to find extremities.
</para><screen>EXAMINE <replaceable>height</replaceable> <replaceable>weight</replaceable> BY
<replaceable>gender</replaceable>
/STATISTICS = EXTREME (3)
/PLOT = BOXPLOT
/COMPARE = GROUPS
/ID = <replaceable>name</replaceable>.
</screen><para>In this example, we look at the height and weight of a sample of individuals and
how they differ between male and female.
A table showing the 3 largest and the 3 smallest values of <emphasis role="bold">height</emphasis> and
<emphasis role="bold">weight</emphasis> for each gender, and for the whole dataset as are shown.
In addition, the <literal>/PLOT</literal> subcommand requests boxplots.
Because <literal>/COMPARE = GROUPS</literal> was specified, boxplots for male and female are
shown in juxtaposed in the same graphic, allowing us to easily see the difference between
the genders.
Since the variable <replaceable>name</replaceable> was specified on the <literal>ID</literal> subcommand,
values of the <replaceable>name</replaceable> variable are used to label the extreme values.
</para>
<para><emphasis role="bold">Warning!</emphasis>
If you specify many dependent variables or factor variables
for which there are many distinct values, then <literal>EXAMINE</literal> will produce a very
large quantity of output.
</para>
</sect1>
<sect1 label="15.4" id="GRAPH">
<title>GRAPH</title>
<indexterm role="vr"><primary>GRAPH</primary></indexterm>
<indexterm role="cp"><primary>Exploratory data analysis</primary></indexterm>
<indexterm role="cp"><primary>normality, testing</primary></indexterm>
<literallayout>GRAPH
/HISTOGRAM [(NORMAL)]= <replaceable>var</replaceable>
/SCATTERPLOT [(BIVARIATE)] = <replaceable>var1</replaceable> WITH <replaceable>var2</replaceable> [BY <replaceable>var3</replaceable>]
/BAR = {<replaceable>summary-function</replaceable>(<replaceable>var1</replaceable>) | <replaceable>count-function</replaceable>} BY <replaceable>var2</replaceable> [BY <replaceable>var3</replaceable>]
[ /MISSING={LISTWISE, VARIABLE} [{EXCLUDE, INCLUDE}] ]
[{NOREPORT,REPORT}]
</literallayout>
<para>The <literal>GRAPH</literal> command produces graphical plots of data. Only one of the subcommands
<literal>HISTOGRAM</literal>, <literal>BAR</literal> or <literal>SCATTERPLOT</literal> can be specified, <emphasis>i.e.</emphasis> only one plot
can be produced per call of <literal>GRAPH</literal>. The <literal>MISSING</literal> is optional.
</para>
<sect2 label="15.4.1" id="SCATTERPLOT">
<title>Scatterplot</title>
<indexterm role="cp"><primary>scatterplot</primary></indexterm>
<para>The subcommand <literal>SCATTERPLOT</literal> produces an xy plot of the
data.
<literal>GRAPH</literal> uses the third variable <replaceable>var3</replaceable>, if specified, to determine
the colours and/or markers for the plot.
The following is an example for producing a scatterplot.
</para>
<screen>GRAPH
/SCATTERPLOT = <replaceable>height</replaceable> WITH <replaceable>weight</replaceable> BY <replaceable>gender</replaceable>.
</screen>
<para>This example produces a scatterplot where <replaceable>height</replaceable> is plotted versus <replaceable>weight</replaceable>. Depending
on the value of the <replaceable>gender</replaceable> variable, the colour of the datapoint is different. With
this plot it is possible to analyze gender differences for <replaceable>height</replaceable> versus <replaceable>weight</replaceable> relation.
</para>
</sect2>
<sect2 label="15.4.2" id="HISTOGRAM">
<title>Histogram</title>
<indexterm role="cp"><primary>histogram</primary></indexterm>
<para>The subcommand <literal>HISTOGRAM</literal> produces a histogram. Only one variable is allowed for
the histogram plot.
The keyword <literal>NORMAL</literal> may be specified in parentheses, to indicate that the ideal normal curve
should be superimposed over the histogram.
For an alternative method to produce histograms see <link linkend="EXAMINE">EXAMINE</link>. The
following example produces a histogram plot for the variable <replaceable>weight</replaceable>.
</para>
<screen>GRAPH
/HISTOGRAM = <replaceable>weight</replaceable>.
</screen>
</sect2>
<sect2 label="15.4.3" id="BAR-CHART">
<title>Bar Chart</title>
<indexterm role="cp"><primary>bar chart</primary></indexterm>
<para>The subcommand <literal>BAR</literal> produces a bar chart.
This subcommand requires that a <replaceable>count-function</replaceable> be specified (with no arguments) or a <replaceable>summary-function</replaceable> with a variable <replaceable>var1</replaceable> in parentheses.
Following the summary or count function, the keyword <literal>BY</literal> should be specified and then a catagorical variable, <replaceable>var2</replaceable>.
The values of the variable <replaceable>var2</replaceable> determine the labels of the bars to be plotted.
Optionally a second categorical variable <replaceable>var3</replaceable> may be specified in which case a clustered (grouped) bar chart is produced.
</para>
<para>Valid count functions are
</para><variablelist><varlistentry><term><literal>COUNT</literal>
</term><listitem><para>The weighted counts of the cases in each category.
</para></listitem></varlistentry><varlistentry><term><literal>PCT</literal>
</term><listitem><para>The weighted counts of the cases in each category expressed as a percentage of the total weights of the cases.
</para></listitem></varlistentry><varlistentry><term><literal>CUFREQ</literal>
</term><listitem><para>The cumulative weighted counts of the cases in each category.
</para></listitem></varlistentry><varlistentry><term><literal>CUPCT</literal>
</term><listitem><para>The cumulative weighted counts of the cases in each category expressed as a percentage of the total weights of the cases.
</para></listitem></varlistentry></variablelist>
<para>The summary function is applied to <replaceable>var1</replaceable> across all cases in each category.
The recognised summary functions are:
</para><variablelist><varlistentry><term><literal>SUM</literal>
</term><listitem><para>The sum.
</para></listitem></varlistentry><varlistentry><term><literal>MEAN</literal>
</term><listitem><para>The arithmetic mean.
</para></listitem></varlistentry><varlistentry><term><literal>MAXIMUM</literal>
</term><listitem><para>The maximum value.
</para></listitem></varlistentry><varlistentry><term><literal>MINIMUM</literal>
</term><listitem><para>The minimum value.
</para></listitem></varlistentry></variablelist>
<para>The following examples assume a dataset which is the results of a survey.
Each respondent has indicated annual income, their sex and city of residence.
One could create a bar chart showing how the mean income varies between of residents of different cities, thus:
</para><screen>GRAPH /BAR = MEAN(<replaceable>income</replaceable>) BY <replaceable>city</replaceable>.
</screen>
<para>This can be extended to also indicate how income in each city differs between the sexes.
</para><screen>GRAPH /BAR = MEAN(<replaceable>income</replaceable>) BY <replaceable>city</replaceable> BY <replaceable>sex</replaceable>.
</screen>
<para>One might also want to see how many respondents there are from each city. This can be achieved as follows:
</para><screen>GRAPH /BAR = COUNT BY <replaceable>city</replaceable>.
</screen>
<para>Bar charts can also be produced using the <link linkend="FREQUENCIES">FREQUENCIES</link> and <link linkend="CROSSTABS">CROSSTABS</link> commands.
</para>
</sect2>
</sect1>
<sect1 label="15.5" id="CORRELATIONS">
<title>CORRELATIONS</title>
<indexterm role="vr"><primary>CORRELATIONS</primary></indexterm>
<literallayout>CORRELATIONS
/VARIABLES = <replaceable>var_list</replaceable> [ WITH <replaceable>var_list</replaceable> ]
[
.
.
.
/VARIABLES = <replaceable>var_list</replaceable> [ WITH <replaceable>var_list</replaceable> ]
/VARIABLES = <replaceable>var_list</replaceable> [ WITH <replaceable>var_list</replaceable> ]
]
[ /PRINT={TWOTAIL, ONETAIL} {SIG, NOSIG} ]
[ /STATISTICS=DESCRIPTIVES XPROD ALL]
[ /MISSING={PAIRWISE, LISTWISE} {INCLUDE, EXCLUDE} ]
</literallayout>
<indexterm role="cp"><primary>correlation</primary></indexterm>
<para>The <literal>CORRELATIONS</literal> procedure produces tables of the Pearson correlation coefficient
for a set of variables. The significance of the coefficients are also given.
</para>
<para>At least one <literal>VARIABLES</literal> subcommand is required. If you specify the <literal>WITH</literal>
keyword, then a non-square correlation table is produced.
The variables preceding <literal>WITH</literal>, are used as the rows of the table,
and the variables following <literal>WITH</literal> are used as the columns of the table.
If no <literal>WITH</literal> subcommand is specified, then <literal>CORRELATIONS</literal> produces a
square, symmetrical table using all variables.
</para>
<para>The <literal>MISSING</literal> subcommand determines the handling of missing variables.
If <literal>INCLUDE</literal> is set, then user-missing values are included in the
calculations, but system-missing values are not.
If <literal>EXCLUDE</literal> is set, which is the default, user-missing
values are excluded as well as system-missing values.
</para>
<para>If <literal>LISTWISE</literal> is set, then the entire case is excluded from analysis
whenever any variable specified in any <literal>/VARIABLES</literal> subcommand
contains a missing value.
If <literal>PAIRWISE</literal> is set, then a case is considered missing only if either of the
values for the particular coefficient are missing.
The default is <literal>PAIRWISE</literal>.
</para>
<para>The <literal>PRINT</literal> subcommand is used to control how the reported significance values are printed.
If the <literal>TWOTAIL</literal> option is used, then a two-tailed test of significance is
printed. If the <literal>ONETAIL</literal> option is given, then a one-tailed test is used.
The default is <literal>TWOTAIL</literal>.
</para>
<para>If the <literal>NOSIG</literal> option is specified, then correlation coefficients with significance less than
0.05 are highlighted.
If <literal>SIG</literal> is specified, then no highlighting is performed. This is the default.
</para>
<indexterm role="cp"><primary>covariance</primary></indexterm>
<para>The <literal>STATISTICS</literal> subcommand requests additional statistics to be displayed. The keyword
<literal>DESCRIPTIVES</literal> requests that the mean, number of non-missing cases, and the non-biased
estimator of the standard deviation are displayed.
These statistics are displayed in a separated table, for all the variables listed
in any <literal>/VARIABLES</literal> subcommand.
The <literal>XPROD</literal> keyword requests cross-product deviations and covariance estimators to
be displayed for each pair of variables.
The keyword <literal>ALL</literal> is the union of <literal>DESCRIPTIVES</literal> and <literal>XPROD</literal>.
</para>
</sect1>
<sect1 label="15.6" id="CROSSTABS">
<title>CROSSTABS</title>
<indexterm role="vr"><primary>CROSSTABS</primary></indexterm>
<literallayout>CROSSTABS
/TABLES=<replaceable>var_list</replaceable> BY <replaceable>var_list</replaceable> [BY <replaceable>var_list</replaceable>]…
/MISSING={TABLE,INCLUDE,REPORT}
/FORMAT={TABLES,NOTABLES}
{AVALUE,DVALUE}
/CELLS={COUNT,ROW,COLUMN,TOTAL,EXPECTED,RESIDUAL,SRESIDUAL,
ASRESIDUAL,ALL,NONE}
/COUNT={ASIS,CASE,CELL}
{ROUND,TRUNCATE}
/STATISTICS={CHISQ,PHI,CC,LAMBDA,UC,BTAU,CTAU,RISK,GAMMA,D,
KAPPA,ETA,CORR,ALL,NONE}
/BARCHART
(Integer mode.)
/VARIABLES=<replaceable>var_list</replaceable> (<replaceable>low</replaceable>,<replaceable>high</replaceable>)…
</literallayout>
<para>The <literal>CROSSTABS</literal> procedure displays crosstabulation
tables requested by the user. It can calculate several statistics for
each cell in the crosstabulation tables. In addition, a number of
statistics can be calculated for each table itself.
</para>
<para>The <literal>TABLES</literal> subcommand is used to specify the tables to be reported. Any
number of dimensions is permitted, and any number of variables per
dimension is allowed. The <literal>TABLES</literal> subcommand may be repeated as many
times as needed. This is the only required subcommand in <firstterm>general
mode</firstterm>.
</para>
<para>Occasionally, one may want to invoke a special mode called <firstterm>integer
mode</firstterm>. Normally, in general mode, PSPP automatically determines
what values occur in the data. In integer mode, the user specifies the
range of values that the data assumes. To invoke this mode, specify the
<literal>VARIABLES</literal> subcommand, giving a range of data values in parentheses for
each variable to be used on the <literal>TABLES</literal> subcommand. Data values inside
the range are truncated to the nearest integer, then assigned to that
value. If values occur outside this range, they are discarded. When it
is present, the <literal>VARIABLES</literal> subcommand must precede the <literal>TABLES</literal>
subcommand.
</para>
<para>In general mode, numeric and string variables may be specified on
TABLES. In integer mode, only numeric variables are allowed.
</para>
<para>The <literal>MISSING</literal> subcommand determines the handling of user-missing values.
When set to <literal>TABLE</literal>, the default, missing values are dropped on a table by
table basis. When set to <literal>INCLUDE</literal>, user-missing values are included in
tables and statistics. When set to <literal>REPORT</literal>, which is allowed only in
integer mode, user-missing values are included in tables but marked with
a footnote and excluded from statistical calculations.
</para>
<para>The <literal>FORMAT</literal> subcommand controls the characteristics of the
crosstabulation tables to be displayed. It has a number of possible
settings:
</para>
<itemizedlist><listitem><para><!-- /@w --> <literal>TABLES</literal>, the default, causes crosstabulation tables to be output.
<literal>NOTABLES</literal>, which is equivalent to <literal>CELLS=NONE</literal>, suppresses them.
</para>
</listitem><listitem><para><!-- /@w --> <literal>AVALUE</literal>, the default, causes values to be sorted in ascending order.
<literal>DVALUE</literal> asserts a descending sort order.
</para></listitem></itemizedlist>
<para>The <literal>CELLS</literal> subcommand controls the contents of each cell in the displayed
crosstabulation table. The possible settings are:
</para>
<variablelist><varlistentry><term>COUNT
</term><listitem><para>Frequency count.
</para></listitem></varlistentry><varlistentry><term>ROW
</term><listitem><para>Row percent.
</para></listitem></varlistentry><varlistentry><term>COLUMN
</term><listitem><para>Column percent.
</para></listitem></varlistentry><varlistentry><term>TOTAL
</term><listitem><para>Table percent.
</para></listitem></varlistentry><varlistentry><term>EXPECTED
</term><listitem><para>Expected value.
</para></listitem></varlistentry><varlistentry><term>RESIDUAL
</term><listitem><para>Residual.
</para></listitem></varlistentry><varlistentry><term>SRESIDUAL
</term><listitem><para>Standardized residual.
</para></listitem></varlistentry><varlistentry><term>ASRESIDUAL
</term><listitem><para>Adjusted standardized residual.
</para></listitem></varlistentry><varlistentry><term>ALL
</term><listitem><para>All of the above.
</para></listitem></varlistentry><varlistentry><term>NONE
</term><listitem><para>Suppress cells entirely.
</para></listitem></varlistentry></variablelist>
<para>‘<literal>/CELLS</literal>’ without any settings specified requests <literal>COUNT</literal>, <literal>ROW</literal>,
<literal>COLUMN</literal>, and <literal>TOTAL</literal>.
If <literal>CELLS</literal> is not specified at all then only <literal>COUNT</literal>
is selected.
</para>
<para>By default, crosstabulation and statistics use raw case weights,
without rounding. Use the <literal>/COUNT</literal> subcommand to perform
rounding: CASE rounds the weights of individual weights as cases are
read, CELL rounds the weights of cells within each crosstabulation
table after it has been constructed, and ASIS explicitly specifies the
default non-rounding behavior. When rounding is requested, ROUND, the
default, rounds to the nearest integer and TRUNCATE rounds toward
zero.
</para>
<para>The <literal>STATISTICS</literal> subcommand selects statistics for computation:
</para>
<variablelist><varlistentry><term>CHISQ
</term><listitem><indexterm role="cp"><primary>chi-square</primary></indexterm>
<para>Pearson chi-square, likelihood ratio, Fisher’s exact test, continuity
correction, linear-by-linear association.
</para></listitem></varlistentry><varlistentry><term>PHI
</term><listitem><para>Phi.
</para></listitem></varlistentry><varlistentry><term>CC
</term><listitem><para>Contingency coefficient.
</para></listitem></varlistentry><varlistentry><term>LAMBDA
</term><listitem><para>Lambda.
</para></listitem></varlistentry><varlistentry><term>UC
</term><listitem><para>Uncertainty coefficient.
</para></listitem></varlistentry><varlistentry><term>BTAU
</term><listitem><para>Tau-b.
</para></listitem></varlistentry><varlistentry><term>CTAU
</term><listitem><para>Tau-c.
</para></listitem></varlistentry><varlistentry><term>RISK
</term><listitem><para>Risk estimate.
</para></listitem></varlistentry><varlistentry><term>GAMMA
</term><listitem><para>Gamma.
</para></listitem></varlistentry><varlistentry><term>D
</term><listitem><para>Somers’ D.
</para></listitem></varlistentry><varlistentry><term>KAPPA
</term><listitem><para>Cohen’s Kappa.
</para></listitem></varlistentry><varlistentry><term>ETA
</term><listitem><para>Eta.
</para></listitem></varlistentry><varlistentry><term>CORR
</term><listitem><para>Spearman correlation, Pearson’s r.
</para></listitem></varlistentry><varlistentry><term>ALL
</term><listitem><para>All of the above.
</para></listitem></varlistentry><varlistentry><term>NONE
</term><listitem><para>No statistics.
</para></listitem></varlistentry></variablelist>
<para>Selected statistics are only calculated when appropriate for the
statistic. Certain statistics require tables of a particular size, and
some statistics are calculated only in integer mode.
</para>
<para>‘<literal>/STATISTICS</literal>’ without any settings selects CHISQ. If the
<literal>STATISTICS</literal> subcommand is not given, no statistics are calculated.
</para>
<indexterm role="cp"><primary>bar chart</primary></indexterm>
<para>The ‘<literal>/BARCHART</literal>’ subcommand produces a clustered bar chart for the first two
variables on each table.
If a table has more than two variables, the counts for the third and subsequent levels
are aggregated and the chart is produced as if there were only two variables.
</para>
<para><emphasis role="bold">Please note:</emphasis> Currently the implementation of <literal>CROSSTABS</literal> has the
following limitations:
</para>
<itemizedlist><listitem><para>Significance of some directional measures is not calculated.
</para></listitem><listitem><para>Asymptotic standard error is not calculated for
Goodman and Kruskal’s tau or symmetric Somers’ d.
</para></listitem><listitem><para>Approximate T is not calculated for symmetric uncertainty coefficient.
</para></listitem></itemizedlist>
<para>Fixes for any of these deficiencies would be welcomed.
</para>
<sect2 label="15.6.1">
<title>Crosstabs Example</title>
<indexterm role="cp"><primary>chi-square test of independence</primary></indexterm>
<para>A researcher wishes to know if, in an industry, a person’s sex is related to
the person’s occupation. To investigate this, she has determined that the
<filename>personnel.sav</filename> is a representative, randomly selected sample of persons.
The researcher’s null hypothesis is that a person’s sex has no relation to a
person’s occupation. She uses a chi-squared test of independence to investigate
the hypothesis.
</para>
<anchor id="crosstabs_003aex"/>
<sidebar><screen>get file="personnel.sav".
crosstabs
/tables= occupation by sex
/cells = count expected
/statistics=chisq.
</screen></sidebar>
<para>The syntax in <link linkend="crosstabs_003aex">crosstabs:ex</link> conducts a chi-squared test of independence.
The line <literal>/tables = occupation by sex</literal> indicates that <emphasis role="bold">occupation</emphasis>
and <emphasis role="bold">sex</emphasis> are the variables to be tabulated. To do this using the graphic user interface
you must place these variable names respectively in the ‘<literal>Row</literal>’ and
‘<literal>Column</literal>’ fields as shown in <link linkend="crosstabs_003ascr">crosstabs:scr</link>.
</para>
<anchor id="crosstabs_003ascr"/>
<sidebar></sidebar>
<para>Similarly, the ‘<literal>Cells</literal>’ button shows a dialog box to select the <literal>count</literal>
and <literal>expected</literal> options. All other cell options can be deselected for this
test.
</para>
<para>You would use the ‘<literal>Format</literal>’ and ‘<literal>Statistics</literal>’ buttons to select options
for the <literal>FORMAT</literal> and <literal>STATISTICS</literal> subcommands. In this example,
the ‘<literal>Statistics</literal>’ requires only the ‘<literal>Chisq</literal>’ option to be checked. All
other options should be unchecked. No special settings are required from the
‘<literal>Format</literal>’ dialog.
</para>
<para>As shown in <link linkend="crosstabs_003ares">crosstabs:res</link> <literal>CROSSTABS</literal> generates a contingency table
containing the observed count and the expected count of each sex and each
occupation. The expected count is the count which would be observed if the
null hypothesis were true.
</para>
<para>The significance of the Pearson Chi-Square value is very much larger than the
normally accepted value of 0.05 and so one cannot reject the null hypothesis.
Thus the researcher must conclude that a person’s sex has no relation to the
person’s occupation.
</para>
<anchor id="crosstabs_003ares"/>
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Summary
+----------------+-------------------------------+
| | Cases |
| +----------+---------+----------+
| | Valid | Missing | Total |
| +--+-------+-+-------+--+-------+
| | N|Percent|N|Percent| N|Percent|
+----------------+--+-------+-+-------+--+-------+
|occupation × sex|54| 96.4%|2| 3.6%|56| 100.0%|
+----------------+--+-------+-+-------+--+-------+
occupation × sex
+--------------------------------------+-----------+-----+
| | sex | |
| +----+------+ |
| |Male|Female|Total|
+--------------------------------------+----+------+-----+
|occupation Artist Count | 2| 6| 8|
| Expected|4.89| 3.11| .15|
| ----------------------------+----+------+-----+
| Baker Count | 1| 1| 2|
| Expected|1.22| .78| .04|
| ----------------------------+----+------+-----+
| Barrister Count | 0| 1| 1|
| Expected| .61| .39| .02|
| ----------------------------+----+------+-----+
| Carpenter Count | 3| 1| 4|
| Expected|2.44| 1.56| .07|
| ----------------------------+----+------+-----+
| Cleaner Count | 4| 0| 4|
| Expected|2.44| 1.56| .07|
| ----------------------------+----+------+-----+
| Cook Count | 3| 2| 5|
| Expected|3.06| 1.94| .09|
| ----------------------------+----+------+-----+
| Manager Count | 4| 4| 8|
| Expected|4.89| 3.11| .15|
| ----------------------------+----+------+-----+
| Mathematician Count | 3| 1| 4|
| Expected|2.44| 1.56| .07|
| ----------------------------+----+------+-----+
| Painter Count | 1| 1| 2|
| Expected|1.22| .78| .04|
| ----------------------------+----+------+-----+
| Payload Specialist Count | 1| 0| 1|
| Expected| .61| .39| .02|
| ----------------------------+----+------+-----+
| Plumber Count | 5| 0| 5|
| Expected|3.06| 1.94| .09|
| ----------------------------+----+------+-----+
| Scientist Count | 5| 2| 7|
| Expected|4.28| 2.72| .13|
| ----------------------------+----+------+-----+
| Scrientist Count | 0| 1| 1|
| Expected| .61| .39| .02|
| ----------------------------+----+------+-----+
| Tailor Count | 1| 1| 2|
| Expected|1.22| .78| .04|
+--------------------------------------+----+------+-----+
|Total Count | 33| 21| 54|
| Expected| .61| .39| 1.00|
+--------------------------------------+----+------+-----+
Chi-Square Tests
+------------------+-----+--+--------------------------+
| |Value|df|Asymptotic Sig. (2-tailed)|
+------------------+-----+--+--------------------------+
|Pearson Chi-Square|15.59|13| .272|
|Likelihood Ratio |19.66|13| .104|
|N of Valid Cases | 54| | |
+------------------+-----+--+--------------------------+
</screen>
</sect2>
</sect1>
<sect1 label="15.7" id="CTABLES">
<title>CTABLES</title>
<indexterm role="vr"><primary>CTABLES</primary></indexterm>
<indexterm role="cp"><primary>custom tables</primary></indexterm>
<indexterm role="cp"><primary>tables, custom</primary></indexterm>
<para><literal>CTABLES</literal> has the following overall syntax. At least one
<literal>TABLE</literal> subcommand is required:
</para>
<literallayout><literal>CTABLES</literal>
…<emphasis>global subcommands</emphasis>…
[<literal>/TABLE</literal> <emphasis>axis</emphasis> [<literal>BY</literal> <emphasis>axis</emphasis> [<literal>BY</literal> <emphasis>axis</emphasis>]]
…<emphasis>per-table subcommands</emphasis>…]…
</literallayout>
<para>where each <emphasis>axis</emphasis> may be empty or take one of the following forms:
</para>
<literallayout><emphasis>variable</emphasis>
<emphasis>variable</emphasis> <literal>[</literal>{<literal>C</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>S</literal>}<literal>]</literal>
<emphasis>axis</emphasis> + <emphasis>axis</emphasis>
<emphasis>axis</emphasis> > <emphasis>axis</emphasis>
(<emphasis>axis</emphasis>)
<emphasis>axis</emphasis> <literal>[</literal><emphasis>summary</emphasis> [<emphasis>string</emphasis>] [<emphasis>format</emphasis>]<literal>]</literal>
</literallayout>
<para>The following subcommands precede the first <literal>TABLE</literal> subcommand
and apply to all of the output tables. All of these subcommands are
optional:
</para>
<literallayout><literal>/FORMAT</literal>
[<literal>MINCOLWIDTH=</literal>{<literal>DEFAULT</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <emphasis>width</emphasis>}]
[<literal>MAXCOLWIDTH=</literal>{<literal>DEFAULT</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <emphasis>width</emphasis>}]
[<literal>UNITS=</literal>{<literal>POINTS</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>INCHES</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>CM</literal>}]
[<literal>EMPTY=</literal>{<literal>ZERO</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>BLANK</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <emphasis>string</emphasis>}]
[<literal>MISSING=</literal><emphasis>string</emphasis>]
<literal>/VLABELS</literal>
<literal>VARIABLES=</literal><emphasis>variables</emphasis>
<literal>DISPLAY</literal>={<literal>DEFAULT</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>NAME</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>LABEL</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>BOTH</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>NONE</literal>}
<literal>/SMISSING</literal> {<literal>VARIABLE</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>LISTWISE</literal>}
<literal>/PCOMPUTE</literal> <literal>&</literal><emphasis>postcompute</emphasis><literal>=EXPR(</literal><emphasis>expression</emphasis><literal>)</literal>
<literal>/PPROPERTIES</literal> <literal>&</literal><emphasis>postcompute</emphasis>…
[<literal>LABEL=</literal><emphasis>string</emphasis>]
[<literal>FORMAT=</literal>[<emphasis>summary</emphasis> <emphasis>format</emphasis>]…]
[<literal>HIDESOURCECATS=</literal>{<literal>NO</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>YES</literal>}
<literal>/WEIGHT VARIABLE=</literal><emphasis>variable</emphasis>
<literal>/HIDESMALLCOUNTS COUNT=<emphasis>count</emphasis></literal>
</literallayout>
<para>The following subcommands follow <literal>TABLE</literal> and apply only to the
previous <literal>TABLE</literal>. All of these subcommands are optional:
</para>
<literallayout><literal>/SLABELS</literal>
[<literal>POSITION=</literal>{<literal>COLUMN</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>ROW</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>LAYER</literal>}]
[<literal>VISIBLE=</literal>{<literal>YES</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>NO</literal>}]
<literal>/CLABELS</literal> {<literal>AUTO</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> {<literal>ROWLABELS</literal><inlineequation><mathphrase>|</mathphrase></inlineequation><literal>COLLABELS</literal>}<literal>=</literal>{<literal>OPPOSITE</literal><inlineequation><mathphrase>|</mathphrase></inlineequation><literal>LAYER</literal>}}
<literal>/CATEGORIES</literal> <literal>VARIABLES=</literal><emphasis>variables</emphasis>
{<literal>[</literal><emphasis>value</emphasis><literal>,</literal> <emphasis>value</emphasis>…<literal>]</literal>
<inlineequation><mathphrase>|</mathphrase></inlineequation> [<literal>ORDER=</literal>{<literal>A</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>D</literal>}]
[<literal>KEY=</literal>{<literal>VALUE</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>LABEL</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <emphasis>summary</emphasis><literal>(</literal><emphasis>variable</emphasis><literal>)</literal>}]
[<literal>MISSING=</literal>{<literal>EXCLUDE</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>INCLUDE</literal>}]}
[<literal>TOTAL=</literal>{<literal>NO</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>YES</literal>} [<literal>LABEL=</literal><emphasis>string</emphasis>] [<literal>POSITION=</literal>{<literal>AFTER</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>BEFORE</literal>}]]
[<literal>EMPTY=</literal>{<literal>INCLUDE</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>EXCLUDE</literal>}]
<literal>/TITLES</literal>
[<literal>TITLE=</literal><emphasis>string</emphasis>…]
[<literal>CAPTION=</literal><emphasis>string</emphasis>…]
[<literal>CORNER=</literal><emphasis>string</emphasis>…]
</literallayout>
<para>The <literal>CTABLES</literal> (aka “custom tables”) command produces
multi-dimensional tables from categorical and scale data. It offers
many options for data summarization and formatting.
</para>
<para>This section’s examples use data from the 2008 (USA) National Survey
of Drinking and Driving Attitudes and Behaviors, a public domain data
set from the (USA) National Highway Traffic Administration and
available at <ulink url="https://data.transportation.gov">https://data.transportation.gov</ulink>. PSPP includes
this data set, with a modified dictionary, as
<filename>examples/nhtsa.sav</filename>.
</para>
<sect2 label="15.7.1" id="CTABLES-Basics">
<title>Basics</title>
<para>The only required subcommand is <literal>TABLE</literal>, which specifies the
variables to include along each axis:
</para><literallayout><literal>/TABLE</literal> <emphasis>rows</emphasis> [<literal>BY</literal> <emphasis>columns</emphasis> [<literal>BY</literal> <emphasis>layers</emphasis>]]
</literallayout><para>In <literal>TABLE</literal>, each of <replaceable>rows</replaceable>, <replaceable>columns</replaceable>, and <replaceable>layers</replaceable>
is either empty or an axis expression that specifies one or more
variables. At least one must specify an axis expression.
</para>
<sect3 label="15.7.1.1" id="CTABLES-Categorical-Variable-Basics">
<title>Categorical Variables</title>
<para>An axis expression that names a categorical variable divides the data
into cells according to the values of that variable. When all the
variables named on <literal>TABLE</literal> are categorical, by default each cell
displays the number of cases that it contains, so specifying a single
variable yields a frequency table, much like the output of the
<literal>FREQUENCIES</literal> command (see <link linkend="FREQUENCIES">FREQUENCIES</link>):
</para>
<screen>CTABLES /TABLE=ageGroup.
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+-----------------------+-----+
| |Count|
+-----------------------+-----+
|Age group 15 or younger| 0|
| 16 to 25 | 1099|
| 26 to 35 | 967|
| 36 to 45 | 1037|
| 46 to 55 | 1175|
| 56 to 65 | 1247|
| 66 or older | 1474|
+-----------------------+-----+
</screen>
<para>Specifying a row and a column categorical variable yields a
crosstabulation, much like the output of the <literal>CROSSTABS</literal> command
(see <link linkend="CROSSTABS">CROSSTABS</link>):
</para>
<screen>CTABLES /TABLE=ageGroup BY gender.
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+-----------------------+------------+
| |S3a. GENDER:|
| +-----+------+
| | Male|Female|
| +-----+------+
| |Count| Count|
+-----------------------+-----+------+
|Age group 15 or younger| 0| 0|
| 16 to 25 | 594| 505|
| 26 to 35 | 476| 491|
| 36 to 45 | 489| 548|
| 46 to 55 | 526| 649|
| 56 to 65 | 516| 731|
| 66 or older | 531| 943|
+-----------------------+-----+------+
</screen>
<para>The ‘<literal>></literal>’ “nesting” operator nests multiple variables on a single
axis, e.g.:
</para>
<screen>CTABLES /TABLE likelihoodOfBeingStoppedByPolice BY ageGroup > gender.
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+---------------------------------+-------------------------------------------+
| | 86. In the past year, have you hosted a |
| | social event or party where alcohol was |
| | served to adults? |
| +---------------------+---------------------+
| | Yes | No |
| +---------------------+---------------------+
| | Count | Count |
+---------------------------------+---------------------+---------------------+
|Age 15 or S3a. Male | 0| 0|
|group younger GENDER: Female| 0| 0|
| ---------------------------+---------------------+---------------------+
| 16 to 25 S3a. Male | 208| 386|
| GENDER: Female| 202| 303|
| ---------------------------+---------------------+---------------------+
| 26 to 35 S3a. Male | 225| 251|
| GENDER: Female| 242| 249|
| ---------------------------+---------------------+---------------------+
| 36 to 45 S3a. Male | 223| 266|
| GENDER: Female| 240| 307|
| ---------------------------+---------------------+---------------------+
| 46 to 55 S3a. Male | 201| 325|
| GENDER: Female| 282| 366|
| ---------------------------+---------------------+---------------------+
| 56 to 65 S3a. Male | 196| 320|
| GENDER: Female| 279| 452|
| ---------------------------+---------------------+---------------------+
| 66 or S3a. Male | 162| 367|
| older GENDER: Female| 243| 700|
+---------------------------------+---------------------+---------------------+
</screen>
<para>The ‘<literal>+</literal>’ “stacking” operator allows a single output table to
include multiple data analyses. With ‘<literal>+</literal>’, <literal>CTABLES</literal> divides
the output table into multiple <firstterm>sections</firstterm>, each of which includes
an analysis of the full data set. For example, the following command
separately tabulates age group and driving frequency by gender:
</para>
<screen>CTABLES /TABLE ageGroup + freqOfDriving BY gender.
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+----------------------------------------------------------------+------------+
| |S3a. GENDER:|
| +-----+------+
| | Male|Female|
| +-----+------+
| |Count| Count|
+----------------------------------------------------------------+-----+------+
|Age group 15 or younger | 0| 0|
| 16 to 25 | 594| 505|
| 26 to 35 | 476| 491|
| 36 to 45 | 489| 548|
| 46 to 55 | 526| 649|
| 56 to 65 | 516| 731|
| 66 or older | 531| 943|
+----------------------------------------------------------------+-----+------+
| 1. How often do you usually drive a car or Every day | 2305| 2362|
|other motor vehicle? Several days a week| 440| 834|
| Once a week or less| 125| 236|
| Only certain times | 58| 72|
| a year | | |
| Never | 192| 348|
+----------------------------------------------------------------+-----+------+
</screen>
<para>When ‘<literal>+</literal>’ and ‘<literal>></literal>’ are used together, ‘<literal>></literal>’ binds more
tightly. Use parentheses to override operator precedence. Thus:
</para>
<screen>CTABLES /TABLE hasConsideredReduction + hasBeenCriticized > gender.
CTABLES /TABLE (hasConsideredReduction + hasBeenCriticized) > gender.
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+-----------------------------------------------------------------------+-----+
| |Count|
+-----------------------------------------------------------------------+-----+
|26. During the last 12 months, has there been a Yes | 513|
|time when you felt you should cut down on your ---------------------+-----+
|drinking? No | 3710|
+-----------------------------------------------------------------------+-----+
|27. During the last 12 months, has there been a Yes S3a. Male | 135|
|time when people criticized your drinking? GENDER: Female| 49|
| ---------------------+-----+
| No S3a. Male | 1916|
| GENDER: Female| 2126|
+-----------------------------------------------------------------------+-----+
Custom Tables
+-----------------------------------------------------------------------+-----+
| |Count|
+-----------------------------------------------------------------------+-----+
|26. During the last 12 months, has there been a Yes S3a. Male | 333|
|time when you felt you should cut down on your GENDER: Female| 180|
|drinking? ---------------------+-----+
| No S3a. Male | 1719|
| GENDER: Female| 1991|
+-----------------------------------------------------------------------+-----+
|27. During the last 12 months, has there been a Yes S3a. Male | 135|
|time when people criticized your drinking? GENDER: Female| 49|
| ---------------------+-----+
| No S3a. Male | 1916|
| GENDER: Female| 2126|
+-----------------------------------------------------------------------+-----+
</screen>
</sect3>
<sect3 label="15.7.1.2" id="CTABLES-Scalar-Variable-Basics">
<title>Scalar Variables</title>
<para>For a categorical variable, <literal>CTABLES</literal> divides the table into a
cell per category. For a scalar variable, <literal>CTABLES</literal> instead
calculates a summary measure, by default the mean, of the values that
fall into a cell. For example, if the only variable specified is a
scalar variable, then the output is a single cell that holds the mean
of all of the data:
</para>
<screen>CTABLES /TABLE age.
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+--------------------------+----+
| |Mean|
+--------------------------+----+
|D1. AGE: What is your age?| 48|
+--------------------------+----+
</screen>
<para>A scalar variable may nest with categorical variables. The following
example shows the mean age of survey respondents across gender and
language groups:
</para>
<screen>CTABLES /TABLE gender > age BY region.
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+-------------------------------------+---------------------------------------+
| |Was this interview conducted in English|
| | or Spanish? |
| +-------------------+-------------------+
| | English | Spanish |
| +-------------------+-------------------+
| | Mean | Mean |
+-------------------------------------+-------------------+-------------------+
|D1. AGE: What is S3a. Male | 46| 37|
|your age? GENDER: Female| 51| 39|
+-------------------------------------+-------------------+-------------------+
</screen>
<para>The order of nesting of scalar and categorical variables affects table
labeling, but it does not affect the data displayed in the table. The
following example shows how the output changes when the nesting order
of the scalar and categorical variable are interchanged:
</para>
<screen>CTABLES /TABLE age > gender BY region.
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+-------------------------------------+---------------------------------------+
| |Was this interview conducted in English|
| | or Spanish? |
| +-------------------+-------------------+
| | English | Spanish |
| +-------------------+-------------------+
| | Mean | Mean |
+-------------------------------------+-------------------+-------------------+
|S3a. Male D1. AGE: What is | 46| 37|
|GENDER: your age? | | |
| ---------------------------+-------------------+-------------------+
| Female D1. AGE: What is | 51| 39|
| your age? | | |
+-------------------------------------+-------------------+-------------------+
</screen>
<para>Only a single scalar variable may appear in each section; that is, a
scalar variable may not nest inside a scalar variable directly or
indirectly. Scalar variables may only appear on one axis within
<literal>TABLE</literal>.
</para>
</sect3>
<sect3 label="15.7.1.3" id="CTABLES-Overriding-Measurement-Level">
<title>Overriding Measurement Level</title>
<para>By default, <literal>CTABLES</literal> uses a variable’s measurement level to
decide whether to treat it as categorical or scalar. Variables
assigned the nominal or ordinal measurement level are treated as
categorical, and scalar variables are treated as scalar.
</para>
<para>When PSPP reads data from a file in an external format, such as a
text file, variables’ measurement levels are often unknown. If
<literal>CTABLES</literal> runs when a variable has an unknown measurement level,
it makes an initial pass through the data to guess measurement levels
using the rules described in an earlier section (see <link linkend="Measurement-Level">Measurement
Level</link>). Use the <literal>VARIABLE LEVEL</literal> command to set or change a
variable’s measurement level (see <link linkend="VARIABLE-LEVEL">VARIABLE LEVEL</link>).
</para>
<para>To treat a variable as categorical or scalar only for one use on
<literal>CTABLES</literal>, add ‘<literal>[C]</literal>’ or ‘<literal>[S]</literal>’, respectively, after the
variable name. The following example shows the output when variable
<literal>monthDaysMin1drink</literal> is analyzed as scalar (the default for its measurement
level) and as categorical:
</para>
<screen>CTABLES
/TABLE monthDaysMin1drink BY gender
/TABLE monthDaysMin1drink [C] BY gender.
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+----------------------------------------------------------------+------------+
| |S3a. GENDER:|
| +----+-------+
| |Male| Female|
| +----+-------+
| |Mean| Mean |
+----------------------------------------------------------------+----+-------+
|20. On how many of the thirty days in this typical month did you| 7| 5|
|have one or more alcoholic beverages to drink? | | |
+----------------------------------------------------------------+----+-------+
Custom Tables
+----------------------------------------------------------------+------------+
| |S3a. GENDER:|
| +-----+------+
| | Male|Female|
| +-----+------+
| |Count| Count|
+----------------------------------------------------------------+-----+------+
|20. On how many of the thirty days in this typical month None | 152| 258|
|did you have one or more alcoholic beverages to drink? 1 | 403| 653|
| 2 | 284| 324|
| 3 | 169| 215|
| 4 | 178| 143|
| 5 | 107| 106|
| 6 | 67| 59|
| 7 | 31| 11|
| 8 | 101| 74|
| 9 | 6| 4|
| 10 | 95| 75|
| 11 | 4| 0|
| 12 | 58| 33|
| 13 | 3| 2|
| 14 | 13| 3|
| 15 | 79| 58|
| 16 | 10| 6|
| 17 | 4| 2|
| 18 | 5| 4|
| 19 | 2| 0|
| 20 | 105| 47|
| 21 | 2| 0|
| 22 | 3| 3|
| 23 | 0| 3|
| 24 | 3| 0|
| 25 | 35| 25|
| 26 | 1| 1|
| 27 | 3| 3|
| 28 | 13| 8|
| 29 | 3| 3|
| Every | 104| 43|
| day | | |
+----------------------------------------------------------------+-----+------+
</screen>
</sect3>
</sect2>
<sect2 label="15.7.2" id="CTABLES-Data-Summarization">
<title>Data Summarization</title>
<para>The <literal>CTABLES</literal> command allows the user to control how the data are
summarized with <firstterm>summary specifications</firstterm>, syntax that lists one or
more summary function names, optionally separated by commas, and which
are enclosed in square brackets following a variable name on the
<literal>TABLE</literal> subcommand. When all the variables are categorical,
summary specifications can be given for the innermost nested variables
on any one axis. When a scalar variable is present, only the scalar
variable may have summary specifications.
</para>
<para>The following example includes a summary specification for column and
row percentages for categorical variables, and mean and median for a
scalar variable:
</para>
<screen>CTABLES
/TABLE=age [MEAN, MEDIAN] BY gender
/TABLE=ageGroup [COLPCT, ROWPCT] BY gender.
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+--------------------------+-----------------------+
| | S3a. GENDER: |
| +-----------+-----------+
| | Male | Female |
| +----+------+----+------+
| |Mean|Median|Mean|Median|
+--------------------------+----+------+----+------+
|D1. AGE: What is your age?| 46| 45| 50| 52|
+--------------------------+----+------+----+------+
Custom Tables
+-----------------------+-----------------------------+
| | S3a. GENDER: |
| +--------------+--------------+
| | Male | Female |
| +--------+-----+--------+-----+
| |Column %|Row %|Column %|Row %|
+-----------------------+--------+-----+--------+-----+
|Age group 15 or younger| .0%| .| .0%| .|
| 16 to 25 | 19.0%|54.0%| 13.1%|46.0%|
| 26 to 35 | 15.2%|49.2%| 12.7%|50.8%|
| 36 to 45 | 15.6%|47.2%| 14.2%|52.8%|
| 46 to 55 | 16.8%|44.8%| 16.8%|55.2%|
| 56 to 65 | 16.5%|41.4%| 18.9%|58.6%|
| 66 or older | 17.0%|36.0%| 24.4%|64.0%|
+-----------------------+--------+-----+--------+-----+
</screen>
<para>A summary specification may override the default label and format by
appending a string or format specification or both (in that order) to
the summary function name. For example:
</para>
<screen>CTABLES /TABLE=ageGroup [COLPCT 'Gender %' PCT5.0,
ROWPCT 'Age Group %' PCT5.0]
BY gender.
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+-----------------------+-----------------------------------------+
| | S3a. GENDER: |
| +--------------------+--------------------+
| | Male | Female |
| +--------+-----------+--------+-----------+
| |Gender %|Age Group %|Gender %|Age Group %|
+-----------------------+--------+-----------+--------+-----------+
|Age group 15 or younger| 0%| .| 0%| .|
| 16 to 25 | 19%| 54%| 13%| 46%|
| 26 to 35 | 15%| 49%| 13%| 51%|
| 36 to 45 | 16%| 47%| 14%| 53%|
| 46 to 55 | 17%| 45%| 17%| 55%|
| 56 to 65 | 16%| 41%| 19%| 59%|
| 66 or older | 17%| 36%| 24%| 64%|
+-----------------------+--------+-----------+--------+-----------+
</screen>
<para>In addition to the standard formats, <literal>CTABLES</literal> allows the user to
specify the following special formats:
</para>
<informaltable><tgroup cols="4"><colspec colwidth="11*"></colspec><colspec colwidth="36*"></colspec><colspec colwidth="8*"></colspec><colspec colwidth="9*"></colspec><tbody><row><entry><para><literal>NEGPAREN<emphasis>w</emphasis>.<emphasis>d</emphasis></literal>
</para></entry><entry><para>Encloses negative numbers in parentheses.
</para></entry><entry><para><literal>&#160;<!-- /@w -->42.96</literal>
</para></entry><entry><para><literal>&#160;<!-- /@w -->(42.96)</literal>
</para>
</entry></row><row><entry><para><literal>NEQUAL<emphasis>w</emphasis>.<emphasis>d</emphasis></literal>
</para></entry><entry><para>Adds a <literal>N=</literal> prefix.
</para></entry><entry><para><literal>&#160;<!-- /@w -->N=42.96</literal>
</para></entry><entry><para><literal>&#160;<!-- /@w -->N=-42.96</literal>
</para>
</entry></row><row><entry><para><literal><literal>PAREN<emphasis>w</emphasis>.<emphasis>d</emphasis></literal></literal>
</para></entry><entry><para>Encloses all numbers in parentheses.
</para></entry><entry><para><literal>&#160;<!-- /@w -->(42.96)</literal>
</para></entry><entry><para><literal>&#160;<!-- /@w -->(-42.96)</literal>
</para>
</entry></row><row><entry><para><literal>PCTPAREN<emphasis>w</emphasis>.<emphasis>d</emphasis></literal>
</para></entry><entry><para>Encloses all numbers in parentheses with a ‘<literal>%</literal>’ suffix.
</para></entry><entry><para><literal>&#160;<!-- /@w -->(42.96%)</literal>
</para></entry><entry><para><literal>(-42.96%)</literal>
</para></entry></row></tbody></tgroup></informaltable>
<para>Parentheses provide a shorthand to apply summary specifications to
multiple variables. For example, both of these commands:
</para>
<screen>CTABLES /TABLE=ageGroup[COLPCT] + membersOver16[COLPCT] BY gender.
CTABLES /TABLE=(ageGroup + membersOver16)[COLPCT] BY gender.
</screen>
<para>produce the same output shown below:
</para>
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+-------------------------------------------------------------+---------------+
| | S3a. GENDER: |
| +-------+-------+
| | Male | Female|
| +-------+-------+
| | Column| Column|
| | % | % |
+-------------------------------------------------------------+-------+-------+
|Age group 15 or | .0%| .0%|
| younger | | |
| 16 to 25 | 19.0%| 13.1%|
| 26 to 35 | 15.2%| 12.7%|
| 36 to 45 | 15.6%| 14.2%|
| 46 to 55 | 16.8%| 16.8%|
| 56 to 65 | 16.5%| 18.9%|
| 66 or older| 17.0%| 24.4%|
+-------------------------------------------------------------+-------+-------+
|S1. Including yourself, how many members of this None | .0%| .0%|
|household are age 16 or older? 1 | 21.4%| 35.0%|
| 2 | 61.9%| 52.3%|
| 3 | 11.0%| 8.2%|
| 4 | 4.2%| 3.2%|
| 5 | 1.1%| .9%|
| 6 or more | .4%| .4%|
+-------------------------------------------------------------+-------+-------+
</screen>
<para>The following sections list the available summary functions. After
each function’s name is given its default label and format. If no
format is listed, then the default format is the print format for the
variable being summarized.
</para>
<sect3 label="15.7.2.1" id="CTABLES-Summary-Functions-for-Individual-Cells">
<title>Summary Functions for Individual Cells</title>
<para>This section lists the summary functions that consider only an
individual cell in <literal>CTABLES</literal>. Only one such summary function,
<literal>COUNT</literal>, may be applied to both categorical and scale variables:
</para>
<variablelist><varlistentry><term><literal>COUNT</literal> (“Count”, F40.0)
</term><listitem><para>The sum of weights in a cell.
</para>
<para>If <literal>CATEGORIES</literal> for one or more of the variables in a table
include missing values (see <link linkend="CTABLES-Per_002dVariable-Category-Options">CTABLES Per-Variable Category
Options</link>), then some or all of the categories for a cell might be
missing values. <literal>COUNT</literal> counts data included in a cell
regardless of whether its categories are missing.
</para></listitem></varlistentry></variablelist>
<para>The following summary functions apply only to scale variables or
totals and subtotals for categorical variables. Be cautious about
interpreting the summary value in the latter case, because it is not
necessarily meaningful; however, the mean of a Likert scale, etc.
may have a straightforward interpreation.
</para>
<variablelist><varlistentry><term><literal>MAXIMUM</literal> (“Maximum”)
</term><listitem><para>The largest value.
</para>
</listitem></varlistentry><varlistentry><term><literal>MEAN</literal> (“Mean”)
</term><listitem><para>The mean.
</para>
</listitem></varlistentry><varlistentry><term><literal>MEDIAN</literal> (“Median”)
</term><listitem><para>The median value.
</para>
</listitem></varlistentry><varlistentry><term><literal>MINIMUM</literal> (“Minimum”)
</term><listitem><para>The smallest value.
</para>
</listitem></varlistentry><varlistentry><term><literal>MISSING</literal> (“Missing”)
</term><listitem><para>Sum of weights of user- and system-missing values.
</para>
</listitem></varlistentry><varlistentry><term><literal>MODE</literal> (“Mode”)
</term><listitem><para>The highest-frequency value. Ties are broken by taking the smallest mode.
</para>
</listitem></varlistentry><varlistentry><term><literal>PTILE</literal> <emphasis>n</emphasis> (“Percentile <emphasis>n</emphasis>”)
</term><listitem><para>The <replaceable>n</replaceable>th percentile, where <inlineequation><mathphrase>0 ≤ <replaceable>n</replaceable> ≤ 100</mathphrase></inlineequation>.
</para>
</listitem></varlistentry><varlistentry><term><literal>RANGE</literal> (“Range”)
</term><listitem><para>The maximum minus the minimum.
</para>
</listitem></varlistentry><varlistentry><term><literal>SEMEAN</literal> (“Std Error of Mean”)
</term><listitem><para>The standard error of the mean.
</para>
</listitem></varlistentry><varlistentry><term><literal>STDDEV</literal> (“Std Deviation”)
</term><listitem><para>The standard deviation.
</para>
</listitem></varlistentry><varlistentry><term><literal>SUM</literal> (“Sum”)
</term><listitem><para>The sum.
</para>
</listitem></varlistentry><varlistentry><term><literal>TOTALN</literal> (“Total N”, F40.0)
</term><listitem><para>The sum of weights in a cell.
</para>
<para>For scale data, <literal>COUNT</literal> and <literal>TOTALN</literal> are the same.
</para>
<para>For categorical data, <literal>TOTALN</literal> counts missing values in excluded
categories, that is, user-missing values not in an explicit category
list on <literal>CATEGORIES</literal> (see <link linkend="CTABLES-Per_002dVariable-Category-Options">CTABLES Per-Variable Category
Options</link>), or user-missing values excluded because
<literal>MISSING=EXCLUDE</literal> is in effect on <literal>CATEGORIES</literal>, or
system-missing values. <literal>COUNT</literal> does not count these.
</para>
<para>See <link linkend="CTABLES-Missing-Values-for-Summary-Variables">CTABLES Missing Values for Summary Variables</link>, for details of
how <literal>CTABLES</literal> summarizes missing values.
</para>
</listitem></varlistentry><varlistentry><term><literal>VALIDN</literal> (“Valid N”, F40.0)
</term><listitem><para>The sum of valid count weights in included categories.
</para>
<para>For categorical variables, <literal>VALIDN</literal> does not count missing values
regardless of whether they are in included categories via
<literal>CATEGORIES</literal>. <literal>VALIDN</literal> does not count valid values that are
in excluded categories. See <link linkend="CTABLES-Missing-Values-for-Summary-Variables">CTABLES Missing Values for Summary
Variables</link>, for details.
</para>
</listitem></varlistentry><varlistentry><term><literal>VARIANCE</literal> (“Variance”)
</term><listitem><para>The variance.
</para></listitem></varlistentry></variablelist>
</sect3>
<sect3 label="15.7.2.2" id="CTABLES-Summary-Functions-for-Groups-of-Cells">
<title>Summary Functions for Groups of Cells</title>
<para>These summary functions summarize over multiple cells within an area
of the output chosen by the user and specified as part of the function
name. The following basic <replaceable>area</replaceable>s are supported, in decreasing
order of size:
</para>
<variablelist><varlistentry><term><literal>TABLE</literal>
</term><listitem><para>A <firstterm>section</firstterm>. Stacked variables divide sections of the output from
each other. sections may span multiple layers.
</para>
</listitem></varlistentry><varlistentry><term><literal>LAYER</literal>
</term><listitem><para>A section within a single layer.
</para>
</listitem></varlistentry><varlistentry><term><literal>SUBTABLE</literal>
</term><listitem><para>A <firstterm>subtable</firstterm>, whose contents are the cells that pair an innermost
row variable and an innermost column variable within a single layer.
</para></listitem></varlistentry></variablelist>
<para>The following shows how the output for the table expression
<literal>hasBeenPassengerOfDesignatedDriver >
hasBeenPassengerOfDrunkDriver BY isLicensedDriver >
hasHostedEventWithAlcohol + hasBeenDesignatedDriver BY
gender</literal><footnote><para>This is not necessarily a meaningful table. To make
it easier to read, short variable labels are used.</para></footnote> is divided up into
<literal>TABLE</literal>, <literal>LAYER</literal>, and <literal>SUBTABLE</literal> areas. Each unique
value for Table ID is one section, and similarly for Layer ID and
Subtable ID. Thus, this output has two <literal>TABLE</literal> areas (one for
<literal>isLicensedDriver</literal> and one for <literal>hasBeenDesignatedDriver</literal>),
four <literal>LAYER</literal> areas (for those two variables, per layer), and 12
<literal>SUBTABLE</literal> areas.
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
</para><screen> Custom Tables
Male
+---------------------------------+-----------------+------+
| | licensed |desDrv|
| +--------+--------+---+--+
| | Yes | No | | |
| +--------+--------+ | |
| | hostAlc| hostAlc| | |
| +----+---+----+---+ | |
| | Yes| No| Yes| No|Yes|No|
+---------------------------------+----+---+----+---+---+--+
|desPas Yes druPas Yes Table ID | 1| 1| 1| 1| 2| 2|
| Layer ID | 1| 1| 1| 1| 2| 2|
| Subtable ID| 1| 1| 2| 2| 3| 3|
| ----------------+----+---+----+---+---+--+
| No Table ID | 1| 1| 1| 1| 2| 2|
| Layer ID | 1| 1| 1| 1| 2| 2|
| Subtable ID| 1| 1| 2| 2| 3| 3|
| ---------------------------+----+---+----+---+---+--+
| No druPas Yes Table ID | 1| 1| 1| 1| 2| 2|
| Layer ID | 1| 1| 1| 1| 2| 2|
| Subtable ID| 4| 4| 5| 5| 6| 6|
| ----------------+----+---+----+---+---+--+
| No Table ID | 1| 1| 1| 1| 2| 2|
| Layer ID | 1| 1| 1| 1| 2| 2|
| Subtable ID| 4| 4| 5| 5| 6| 6|
+---------------------------------+----+---+----+---+---+--+
</screen>
<para><literal>CTABLES</literal> also supports the following <replaceable>area</replaceable>s that further
divide a subtable or a layer within a section:
</para>
<variablelist><varlistentry><term><literal>LAYERROW</literal>
</term><term><literal>LAYERCOL</literal>
</term><listitem><para>A row or column, respectively, in one layer of a section.
</para>
</listitem></varlistentry><varlistentry><term><literal>ROW</literal>
</term><term><literal>COL</literal>
</term><listitem><para>A row or column, respectively, in a subtable.
</para></listitem></varlistentry></variablelist>
<para>The following summary functions for groups of cells are available for
each <replaceable>area</replaceable> described above, for both categorical and scale
variables:
</para>
<variablelist><varlistentry><term><literal><emphasis>area</emphasis>PCT</literal> or <literal><emphasis>area</emphasis>PCT.COUNT</literal> (“<emphasis>Area</emphasis> %”, PCT40.1)
</term><listitem><para>A percentage of total counts within <replaceable>area</replaceable>.
</para>
</listitem></varlistentry><varlistentry><term><literal><emphasis>area</emphasis>PCT.VALIDN</literal> (“<emphasis>Area</emphasis> Valid N %”, PCT40.1)
</term><listitem><para>A percentage of total counts for valid values within <replaceable>area</replaceable>.
</para>
</listitem></varlistentry><varlistentry><term><literal><emphasis>area</emphasis>PCT.TOTALN</literal> (“<emphasis>Area</emphasis> Total N %”, PCT40.1)
</term><listitem><para>A percentage of total counts for all values within <replaceable>area</replaceable>.
</para></listitem></varlistentry></variablelist>
<para>Scale variables and totals and subtotals for categorical variables may
use the following additional group cell summary function:
</para>
<variablelist><varlistentry><term><literal><emphasis>area</emphasis>PCT.SUM</literal> (“<emphasis>Area</emphasis> Sum %”, PCT40.1)
</term><listitem><para>Percentage of the sum of the values within <replaceable>area</replaceable>.
</para></listitem></varlistentry></variablelist>
</sect3>
<sect3 label="15.7.2.3" id="CTABLES-Summary-Functions-for-Adjusted-Weights">
<title>Summary Functions for Adjusted Weights</title>
<para>If the <literal>WEIGHT</literal> subcommand specified an effective weight variable
(see <link linkend="CTABLES-Effective-Weight">CTABLES Effective Weight</link>), then the following summary functions
use its value instead of the dictionary weight variable. Otherwise,
they are equivalent to the summary function without the
‘<literal>E</literal>’-prefix:
</para>
<itemizedlist><listitem><para><literal>ECOUNT</literal> (“Adjusted Count”, F40.0)
</para>
</listitem><listitem><para><literal>ETOTALN</literal> (“Adjusted Total N”, F40.0)
</para>
</listitem><listitem><para><literal>EVALIDN</literal> (“Adjusted Valid N”, F40.0)
</para></listitem></itemizedlist>
</sect3>
<sect3 label="15.7.2.4" id="CTABLES-Unweighted-Summary-Functions">
<title>Unweighted Summary Functions</title>
<para>The following summary functions with a ‘<literal>U</literal>’-prefix are equivalent
to the same ones without the prefix, except that they use unweighted
counts:
</para>
<itemizedlist><listitem><para><literal>UCOUNT</literal> (“Unweighted Count”, F40.0)
</para>
</listitem><listitem><para><literal>U<emphasis>area</emphasis>PCT</literal> or <literal>U<emphasis>area</emphasis>PCT.COUNT</literal> (“Unweighted <emphasis>Area</emphasis> %”, PCT40.1)
</para>
</listitem><listitem><para><literal>U<emphasis>area</emphasis>PCT.VALIDN</literal> (“Unweighted <emphasis>Area</emphasis> Valid N %”, PCT40.1)
</para>
</listitem><listitem><para><literal>U<emphasis>area</emphasis>PCT.TOTALN</literal> (“Unweighted <emphasis>Area</emphasis> Total N %”, PCT40.1)
</para>
</listitem><listitem><para><literal>UMEAN</literal> (“Unweighted Mean”)
</para>
</listitem><listitem><para><literal>UMEDIAN</literal> (“Unweighted Median”)
</para>
</listitem><listitem><para><literal>UMISSING</literal> (“Unweighted Missing”)
</para>
</listitem><listitem><para><literal>UMODE</literal> (“Unweighted Mode”)
</para>
</listitem><listitem><para><literal>U<emphasis>area</emphasis>PCT.SUM</literal> (“Unweighted <emphasis>Area</emphasis> Sum %”, PCT40.1)
</para>
</listitem><listitem><para><literal>UPTILE</literal> <emphasis>n</emphasis> (“Unweighted Percentile <emphasis>n</emphasis>”)
</para>
</listitem><listitem><para><literal>USEMEAN</literal> (“Unweighted Std Error of Mean”)
</para>
</listitem><listitem><para><literal>USTDDEV</literal> (“Unweighted Std Deviation”)
</para>
</listitem><listitem><para><literal>USUM</literal> (“Unweighted Sum”)
</para>
</listitem><listitem><para><literal>UTOTALN</literal> (“Unweighted Total N”, F40.0)
</para>
</listitem><listitem><para><literal>UVALIDN</literal> (“Unweighted Valid N”, F40.0)
</para>
</listitem><listitem><para><literal>UVARIANCE</literal> (“Unweighted Variance”, F40.0)
</para></listitem></itemizedlist>
</sect3>
</sect2>
<sect2 label="15.7.3" id="CTABLES-Statistics-Positions-and-Labels">
<title>Statistics Positions and Labels</title>
<literallayout><literal>/SLABELS</literal>
[<literal>POSITION=</literal>{<literal>COLUMN</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>ROW</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>LAYER</literal>}]
[<literal>VISIBLE=</literal>{<literal>YES</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>NO</literal>}]
</literallayout>
<para>The <literal>SLABELS</literal> subcommand controls the position and visibility of
summary statistics for the <literal>TABLE</literal> subcommand that it follows.
</para>
<para><literal>POSITION</literal> sets the axis on which summary statistics appear.
With <literal>POSITION=COLUMN</literal>, which is the default, each summary statistic
appears in a column. For example:
</para>
<screen>CTABLES /TABLE=age [MEAN, MEDIAN] BY gender.
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+--------------------------+-----------------------+
| | S3a. GENDER: |
| +-----------+-----------+
| | Male | Female |
| +----+------+----+------+
| |Mean|Median|Mean|Median|
+--------------------------+----+------+----+------+
|D1. AGE: What is your age?| 46| 45| 50| 52|
+--------------------------+----+------+----+------+
</screen>
<para>With <literal>POSITION=ROW</literal>, each summary statistic appears in a row, as
shown below:
</para>
<screen>CTABLES /TABLE=age [MEAN, MEDIAN] BY gender /SLABELS POSITION=ROW.
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+---------------------------------+-------------+
| | S3a. GENDER:|
| +-----+-------+
| | Male| Female|
+---------------------------------+-----+-------+
|D1. AGE: What is your age? Mean | 46| 50|
| Median| 45| 52|
+---------------------------------+-----+-------+
</screen>
<para><literal>POSITION=LAYER</literal> is also available to place each summary statistic in
a separate layer.
</para>
<para>Labels for summary statistics are shown by default. Use
<literal>VISIBLE=NO</literal> to suppress them. Because unlabeled data can cause
confusion, it should only be considered if the meaning of the data is
evident, as in a simple case like this:
</para>
<screen>CTABLES /TABLE=ageGroup [TABLEPCT] /SLABELS VISIBLE=NO.
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+-----------------------+-----+
|Age group 15 or younger| .0%|
| 16 to 25 |15.7%|
| 26 to 35 |13.8%|
| 36 to 45 |14.8%|
| 46 to 55 |16.8%|
| 56 to 65 |17.8%|
| 66 or older |21.1%|
+-----------------------+-----+
</screen>
</sect2>
<sect2 label="15.7.4" id="CTABLES-Category-Label-Positions">
<title>Category Label Positions</title>
<literallayout><literal>/CLABELS</literal> {<literal>AUTO</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> {<literal>ROWLABELS</literal><inlineequation><mathphrase>|</mathphrase></inlineequation><literal>COLLABELS</literal>}<literal>=</literal>{<literal>OPPOSITE</literal><inlineequation><mathphrase>|</mathphrase></inlineequation><literal>LAYER</literal>}}
</literallayout>
<para>The <literal>CLABELS</literal> subcommand controls the position of category labels
for the <literal>TABLE</literal> subcommand that it follows. By default, or if
<literal>AUTO</literal> is specified, category labels for a given variable nest
inside the variable’s label on the same axis. For example, the
command below results in age categories nesting within the age group
variable on the rows axis and gender categories within the gender
variable on the columns axis:
</para>
<screen>CTABLES /TABLE ageGroup BY gender.
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+-----------------------+------------+
| |S3a. GENDER:|
| +-----+------+
| | Male|Female|
| +-----+------+
| |Count| Count|
+-----------------------+-----+------+
|Age group 15 or younger| 0| 0|
| 16 to 25 | 594| 505|
| 26 to 35 | 476| 491|
| 36 to 45 | 489| 548|
| 46 to 55 | 526| 649|
| 56 to 65 | 516| 731|
| 66 or older | 531| 943|
+-----------------------+-----+------+
</screen>
<para><literal>ROWLABELS=OPPOSITE</literal> or <literal>COLLABELS=OPPOSITE</literal> move row or column
variable category labels, respectively, to the opposite axis. The
setting affects only the innermost variable or variables, which must
be categorical, on the given axis. For example:
</para>
<screen>CTABLES /TABLE ageGroup BY gender /CLABELS ROWLABELS=OPPOSITE.
CTABLES /TABLE ageGroup BY gender /CLABELS COLLABELS=OPPOSITE.
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+-----+----------------------------------------------------------------------
| | S3a. GENDER:
| +-------------------------------------------+--------------------------
| | Male | Female
| +-------+-----+-----+-----+-----+-----+-----+-------+-----+-----+-----+
| | 15 or |16 to|26 to|36 to|46 to|56 to|66 or| 15 or |16 to|26 to|36 to|
| |younger| 25 | 35 | 45 | 55 | 65 |older|younger| 25 | 35 | 45 |
| +-------+-----+-----+-----+-----+-----+-----+-------+-----+-----+-----+
| | Count |Count|Count|Count|Count|Count|Count| Count |Count|Count|Count|
+-----+-------+-----+-----+-----+-----+-----+-----+-------+-----+-----+-----+
|Age | 0| 594| 476| 489| 526| 516| 531| 0| 505| 491| 548|
|group| | | | | | | | | | | |
+-----+-------+-----+-----+-----+-----+-----+-----+-------+-----+-----+-----+
+-----+-----------------+
| | |
| +-----------------+
| | |
| +-----+-----+-----+
| |46 to|56 to|66 or|
| | 55 | 65 |older|
| +-----+-----+-----+
| |Count|Count|Count|
+-----+-----+-----+-----+
|Age | 649| 731| 943|
|group| | | |
+-----+-----+-----+-----+
Custom Tables
+------------------------------+------------+
| |S3a. GENDER:|
| +------------+
| | Count |
+------------------------------+------------+
|Age group 15 or younger Male | 0|
| Female| 0|
| ---------------------+------------+
| 16 to 25 Male | 594|
| Female| 505|
| ---------------------+------------+
| 26 to 35 Male | 476|
| Female| 491|
| ---------------------+------------+
| 36 to 45 Male | 489|
| Female| 548|
| ---------------------+------------+
| 46 to 55 Male | 526|
| Female| 649|
| ---------------------+------------+
| 56 to 65 Male | 516|
| Female| 731|
| ---------------------+------------+
| 66 or older Male | 531|
| Female| 943|
+------------------------------+------------+
</screen>
<para><literal>ROWLABELS=LAYER</literal> or <literal>COLLABELS=LAYER</literal> move the innermost row or
column variable category labels, respectively, to the layer axis.
</para>
<para>Only one axis’s labels may be moved, whether to the opposite axis or
to the layer axis.
</para>
<bridgehead renderas="sect3">Effect on Summary Statistics</bridgehead>
<para><literal>CLABELS</literal> primarily affects the appearance of tables, not the
data displayed in them. However, <literal>CTABLES</literal> can affect the values
displayed for statistics that summarize areas of a table, since it can
change the definitions of these areas.
</para>
<para>For example, consider the following syntax and output:
</para>
<screen>CTABLES /TABLE ageGroup BY gender [ROWPCT, COLPCT].
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+-----------------------+-----------------------------+
| | S3a. GENDER: |
| +--------------+--------------+
| | Male | Female |
| +-----+--------+-----+--------+
| |Row %|Column %|Row %|Column %|
+-----------------------+-----+--------+-----+--------+
|Age group 15 or younger| .| .0%| .| .0%|
| 16 to 25 |54.0%| 19.0%|46.0%| 13.1%|
| 26 to 35 |49.2%| 15.2%|50.8%| 12.7%|
| 36 to 45 |47.2%| 15.6%|52.8%| 14.2%|
| 46 to 55 |44.8%| 16.8%|55.2%| 16.8%|
| 56 to 65 |41.4%| 16.5%|58.6%| 18.9%|
| 66 or older |36.0%| 17.0%|64.0%| 24.4%|
+-----------------------+-----+--------+-----+--------+
</screen>
<para>Using <literal>COLLABELS=OPPOSITE</literal> changes the definitions of rows and
columns, so that column percentages display what were previously row
percentages and the new row percentages become meaningless (because
there is only one cell per row):
</para>
<screen>CTABLES
/TABLE ageGroup BY gender [ROWPCT, COLPCT]
/CLABELS COLLABELS=OPPOSITE.
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+------------------------------+---------------+
| | S3a. GENDER: |
| +------+--------+
| | Row %|Column %|
+------------------------------+------+--------+
|Age group 15 or younger Male | .| .|
| Female| .| .|
| ---------------------+------+--------+
| 16 to 25 Male |100.0%| 54.0%|
| Female|100.0%| 46.0%|
| ---------------------+------+--------+
| 26 to 35 Male |100.0%| 49.2%|
| Female|100.0%| 50.8%|
| ---------------------+------+--------+
| 36 to 45 Male |100.0%| 47.2%|
| Female|100.0%| 52.8%|
| ---------------------+------+--------+
| 46 to 55 Male |100.0%| 44.8%|
| Female|100.0%| 55.2%|
| ---------------------+------+--------+
| 56 to 65 Male |100.0%| 41.4%|
| Female|100.0%| 58.6%|
| ---------------------+------+--------+
| 66 or older Male |100.0%| 36.0%|
| Female|100.0%| 64.0%|
+------------------------------+------+--------+
</screen>
<bridgehead renderas="sect3">Moving Categories for Stacked Variables</bridgehead>
<para>If <literal>CLABELS</literal> moves category labels from an axis with stacked
variables, the variables that are moved must have the same category
specifications (see <link linkend="CTABLES-Per_002dVariable-Category-Options">CTABLES Per-Variable Category Options</link>) and the
same value labels.
</para>
<para>The following shows both moving stacked category variables and
adapting to the changing definitions of rows and columns:
</para>
<screen>CTABLES /TABLE (likelihoodOfBeingStoppedByPolice
+ likelihoodOfHavingAnAccident) [COLPCT].
CTABLES /TABLE (likelihoodOfBeingStoppedByPolice
+ likelihoodOfHavingAnAccident) [ROWPCT]
/CLABELS ROW=OPPOSITE.
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+---------------------------------------------------------------------+-------+
| | Column|
| | % |
+---------------------------------------------------------------------+-------+
|105b. How likely is it that drivers who have had too Almost | 10.2%|
|much to drink to drive safely will A. Get stopped by the certain | |
|police? Very likely | 21.8%|
| Somewhat | 40.2%|
| likely | |
| Somewhat | 19.0%|
| unlikely | |
| Very | 8.9%|
| unlikely | |
+---------------------------------------------------------------------+-------+
|105b. How likely is it that drivers who have had too Almost | 15.9%|
|much to drink to drive safely will B. Have an accident? certain | |
| Very likely | 40.8%|
| Somewhat | 35.0%|
| likely | |
| Somewhat | 6.2%|
| unlikely | |
| Very | 2.0%|
| unlikely | |
+---------------------------------------------------------------------+-------+
Custom Tables
+-----------------------------+--------+-------+---------+----------+---------+
| | Almost | Very | Somewhat| Somewhat | Very |
| | certain| likely| likely | unlikely | unlikely|
| +--------+-------+---------+----------+---------+
| | Row % | Row % | Row % | Row % | Row % |
+-----------------------------+--------+-------+---------+----------+---------+
|105b. How likely is it that | 10.2%| 21.8%| 40.2%| 19.0%| 8.9%|
|drivers who have had too much| | | | | |
|to drink to drive safely will| | | | | |
|A. Get stopped by the police?| | | | | |
|105b. How likely is it that | 15.9%| 40.8%| 35.0%| 6.2%| 2.0%|
|drivers who have had too much| | | | | |
|to drink to drive safely will| | | | | |
|B. Have an accident? | | | | | |
+-----------------------------+--------+-------+---------+----------+---------+
</screen>
</sect2>
<sect2 label="15.7.5" id="CTABLES-Per_002dVariable-Category-Options">
<title>Per-Variable Category Options</title>
<literallayout><literal>/CATEGORIES</literal> <literal>VARIABLES=</literal><emphasis>variables</emphasis>
{<literal>[</literal><emphasis>value</emphasis><literal>,</literal> <emphasis>value</emphasis>…<literal>]</literal>
<inlineequation><mathphrase>|</mathphrase></inlineequation> [<literal>ORDER=</literal>{<literal>A</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>D</literal>}]
[<literal>KEY=</literal>{<literal>VALUE</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>LABEL</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <emphasis>summary</emphasis><literal>(</literal><emphasis>variable</emphasis><literal>)</literal>}]
[<literal>MISSING=</literal>{<literal>EXCLUDE</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>INCLUDE</literal>}]}
[<literal>TOTAL=</literal>{<literal>NO</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>YES</literal>} [<literal>LABEL=</literal><emphasis>string</emphasis>] [<literal>POSITION=</literal>{<literal>AFTER</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>BEFORE</literal>}]]
[<literal>EMPTY=</literal>{<literal>INCLUDE</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>EXCLUDE</literal>}]
</literallayout>
<para>The <literal>CATEGORIES</literal> subcommand specifies, for one or more
categorical variables, the categories to include and exclude, the sort
order for included categories, and treatment of missing values. It
also controls the totals and subtotals to display. It may be
specified any number of times, each time for a different set of
variables. <literal>CATEGORIES</literal> applies to the table produced by the
<literal>TABLE</literal> subcommand that it follows.
</para>
<para><literal>CATEGORIES</literal> does not apply to scalar variables.
</para>
<para><literal>VARIABLES</literal> is required and must list the variables for the subcommand
to affect.
</para>
<para>The syntax may specify the categories to include and their sort order
either explicitly or implicitly. The following sections give the
details of each form of syntax, followed by information on totals and
subtotals and the <literal>EMPTY</literal> setting.
</para>
<sect3 label="15.7.5.1" id="CTABLES-Explicit-Categories">
<title>Explicit Categories</title>
<anchor id="CTABLES-Explicit-Category-List"/>
<para>To use <literal>CTABLES</literal> to explicitly specify categories to include,
list the categories within square brackets in the desired sort order.
Use spaces or commas to separate values. Categories not covered by
the list are excluded from analysis.
</para>
<para>Each element of the list takes one of the following forms:
</para>
<variablelist><varlistentry><term><literal><emphasis>number</emphasis></literal>
</term><term><literal>'<emphasis>string</emphasis>'</literal>
</term><listitem><para>A numeric or string category value, for variables that have the
corresponding type.
</para>
</listitem></varlistentry><varlistentry><term><literal>'<emphasis>date</emphasis>'</literal>
</term><term><literal>'<emphasis>time</emphasis>'</literal>
</term><listitem><para>A date or time category value, for variables that have a date or time
print format.
</para>
</listitem></varlistentry><varlistentry><term><literal><emphasis>min</emphasis> THRU <emphasis>max</emphasis></literal>
</term><term><literal>LO THRU <emphasis>max</emphasis></literal>
</term><term><literal><emphasis>min</emphasis> THRU HI</literal>
</term><listitem><para>A range of category values, where <replaceable>min</replaceable> and <replaceable>max</replaceable> each takes
one of the forms above, in increasing order.
</para>
</listitem></varlistentry><varlistentry><term><literal>MISSING</literal>
</term><listitem><para>All user-missing values. (To match individual user-missing values,
specify their category values.)
</para>
</listitem></varlistentry><varlistentry><term><literal>OTHERNM</literal>
</term><listitem><para>Any non-missing value not covered by any other element of the list
(regardless of where <literal>OTHERNM</literal> is placed in the list).
</para>
</listitem></varlistentry><varlistentry><term><literal>&<emphasis>postcompute</emphasis></literal>
</term><listitem><para>A computed category name (see <link linkend="CTABLES-Computed-Categories">CTABLES Computed Categories</link>).
</para>
</listitem></varlistentry><varlistentry><term><literal>SUBTOTAL</literal>
</term><term><literal>HSUBTOTAL</literal>
</term><listitem><para>A subtotal (see <link linkend="CTABLES-Totals-and-Subtotals">CTABLES Totals and Subtotals</link>).
</para></listitem></varlistentry></variablelist>
<para>If multiple elements of the list cover a given category, the last one
in the list takes precedence.
</para>
<para>The following example syntax and output show how an explicit category
can limit the displayed categories:
</para>
<screen>CTABLES /TABLE freqOfDriving.
CTABLES /TABLE freqOfDriving /CATEGORIES VARIABLES=freqOfDriving [1, 2, 3].
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+-----------------------------------------------------------------------+-----+
| |Count|
+-----------------------------------------------------------------------+-----+
| 1. How often do you usually drive a car or other Every day | 4667|
|motor vehicle? Several days a week | 1274|
| Once a week or less | 361|
| Only certain times a| 130|
| year | |
| Never | 540|
+-----------------------------------------------------------------------+-----+
Custom Tables
+-----------------------------------------------------------------------+-----+
| |Count|
+-----------------------------------------------------------------------+-----+
| 1. How often do you usually drive a car or other Every day | 4667|
|motor vehicle? Several days a | 1274|
| week | |
| Once a week or | 361|
| less | |
+-----------------------------------------------------------------------+-----+
</screen>
</sect3>
<sect3 label="15.7.5.2" id="CTABLES-Implicit-Categories">
<title>Implicit Categories</title>
<para>In the absence of an explicit list of categories, <literal>CATEGORIES</literal>
allows <literal>KEY</literal>, <literal>ORDER</literal>, and <literal>MISSING</literal> to specify how to
select and sort categories.
</para>
<para>The <literal>KEY</literal> setting specifies the sort key. By default, or with
<literal>KEY=VALUE</literal>, categories are sorted by default. Categories may
also be sorted by value label, with <literal>KEY=LABEL</literal>, or by the value
of a summary function, e.g. <literal>KEY=COUNT</literal>.
</para>
<para>By default, or with <literal>ORDER=A</literal>, categories are sorted in ascending
order. Specify <literal>ORDER=D</literal> to sort in descending order.
</para>
<para>User-missing values are excluded by default, or with
<literal>MISSING=EXCLUDE</literal>. Specify <literal>MISSING=INCLUDE</literal> to include
user-missing values. The system-missing value is always excluded.
</para>
<para>The following example syntax and output show how
<literal>MISSING=INCLUDE</literal> causes missing values to be included in a
category list.
</para>
<screen>CTABLES /TABLE freqOfDriving.
CTABLES /TABLE freqOfDriving
/CATEGORIES VARIABLES=freqOfDriving MISSING=INCLUDE.
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+-----------------------------------------------------------------------+-----+
| |Count|
+-----------------------------------------------------------------------+-----+
| 1. How often do you usually drive a car or other Every day | 4667|
|motor vehicle? Several days a week | 1274|
| Once a week or less | 361|
| Only certain times a| 130|
| year | |
| Never | 540|
+-----------------------------------------------------------------------+-----+
Custom Tables
+-----------------------------------------------------------------------+-----+
| |Count|
+-----------------------------------------------------------------------+-----+
| 1. How often do you usually drive a car or other Every day | 4667|
|motor vehicle? Several days a week | 1274|
| Once a week or less | 361|
| Only certain times a| 130|
| year | |
| Never | 540|
| Don't know | 8|
| Refused | 19|
+-----------------------------------------------------------------------+-----+
</screen>
</sect3>
<sect3 label="15.7.5.3" id="CTABLES-Totals-and-Subtotals">
<title>Totals and Subtotals</title>
<para><literal>CATEGORIES</literal> also controls display of totals and subtotals. By
default, or with <literal>TOTAL=NO</literal>, totals are not displayed. Use
<literal>TOTAL=YES</literal> to display a total. By default, the total is labeled
“Total”; use <literal>LABEL="<emphasis>label</emphasis>"</literal> to override it.
</para>
<para>Subtotals are also not displayed by default. To add one or more
subtotals, use an explicit category list and insert <literal>SUBTOTAL</literal> or
<literal>HSUBTOTAL</literal> in the position or positions where the subtotal
should appear. The subtotal becomes an extra row or column or layer.
<literal>HSUBTOTAL</literal> additionally hides the categories that make up the
subtotal. Either way, the default label is “Subtotal”, use
<literal>SUBTOTAL="<emphasis>label</emphasis>"</literal> or <literal>HSUBTOTAL="<emphasis>label</emphasis>"</literal> to specify
a custom label.
</para>
<para>The following example syntax and output show how to use
<literal>TOTAL=YES</literal> and <literal>SUBTOTAL</literal>:
</para>
<screen>CTABLES
/TABLE freqOfDriving
/CATEGORIES VARIABLES=freqOfDriving [OTHERNM, SUBTOTAL='Valid Total',
MISSING, SUBTOTAL='Missing Total']
TOTAL=YES LABEL='Overall Total'.
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+-----------------------------------------------------------------------+-----+
| |Count|
+-----------------------------------------------------------------------+-----+
| 1. How often do you usually drive a car or other Every day | 4667|
|motor vehicle? Several days a week | 1274|
| Once a week or less | 361|
| Only certain times a| 130|
| year | |
| Never | 540|
| Valid Total | 6972|
| Don't know | 8|
| Refused | 19|
| Missing Total | 27|
| Overall Total | 6999|
+-----------------------------------------------------------------------+-----+
</screen>
<para>By default, or with <literal>POSITION=AFTER</literal>, totals are displayed in the
output after the last category and subtotals apply to categories that
precede them. With <literal>POSITION=BEFORE</literal>, totals come before the
first category and subtotals apply to categories that follow them.
</para>
<para>Only categorical variables may have totals and subtotals. Scalar
variables may be “totaled” indirectly by enabling totals and
subtotals on a categorical variable within which the scalar variable
is summarized. For example, the following syntax produces a mean,
count, and valid count across all data by adding a total on the
categorical <literal>region</literal> variable, as shown:
</para>
<screen>CTABLES /TABLE=region > monthDaysMin1drink [MEAN, VALIDN]
/CATEGORIES VARIABLES=region TOTAL=YES LABEL='All regions'.
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+-----------------------------------------------------------+----+-----+------+
| | | | Valid|
| |Mean|Count| N |
+-----------------------------------------------------------+----+-----+------+
|20. On how many of the thirty days in this Region NE | 5.6| 1409| 945|
|typical month did you have one or more MW | 5.0| 1654| 1026|
|alcoholic beverages to drink? S | 6.0| 2390| 1285|
| W | 6.5| 1546| 953|
| All | 5.8| 6999| 4209|
| regions | | | |
+-----------------------------------------------------------+----+-----+------+
</screen>
<para>By default, PSPP uses the same summary functions for totals and
subtotals as other categories. To summarize totals and subtotals
differently, specify the summary functions for totals and subtotals
after the ordinary summary functions inside a nested set of <literal>[]</literal>
following <literal>TOTALS</literal>. For example, the following syntax displays
<literal>COUNT</literal> for individual categories and totals and <literal>VALIDN</literal>
for totals, as shown:
</para>
<screen>CTABLES
/TABLE isLicensedDriver [COUNT, TOTALS[COUNT, VALIDN]]
/CATEGORIES VARIABLES=isLicensedDriver TOTAL=YES MISSING=INCLUDE.
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+----------------------------------------------------------------+-----+------+
| | | Valid|
| |Count| N |
+----------------------------------------------------------------+-----+------+
|D7a. Are you a licensed driver; that is, do you have a Yes | 6379| |
|valid driver's license? No | 572| |
| Don't | 4| |
| know | | |
| Refused | 44| |
| Total | 6999| 6951|
+----------------------------------------------------------------+-----+------+
</screen>
</sect3>
<sect3 label="15.7.5.4" id="CTABLES-Categories-Without-Values">
<title>Categories Without Values</title>
<para>Some categories might not be included in the data set being analyzed.
For example, our example data set has no cases in the “15 or
younger” age group. By default, or with <literal>EMPTY=INCLUDE</literal>,
PSPP includes these empty categories in output tables. To exclude
them, specify <literal>EMPTY=EXCLUDE</literal>.
</para>
<para>For implicit categories, empty categories potentially include all the
values with value labels for a given variable; for explicit
categories, they include all the values listed individually and all
values with value labels that are covered by ranges or <literal>MISSING</literal>
or <literal>OTHERNM</literal>.
</para>
<para>The following example syntax and output show the effect of
<literal>EMPTY=EXCLUDE</literal> for the <literal>membersOver16</literal> variable, in which 0
is labeled “None” but no cases exist with that value:
</para>
<screen>CTABLES /TABLE=membersOver16.
CTABLES /TABLE=membersOver16 /CATEGORIES VARIABLES=membersOver16 EMPTY=EXCLUDE.
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+-----------------------------------------------------------------------+-----+
| |Count|
+-----------------------------------------------------------------------+-----+
|S1. Including yourself, how many members of this household are None | 0|
|age 16 or older? 1 | 1586|
| 2 | 3031|
| 3 | 505|
| 4 | 194|
| 5 | 55|
| 6 or | 21|
| more | |
+-----------------------------------------------------------------------+-----+
Custom Tables
+-----------------------------------------------------------------------+-----+
| |Count|
+-----------------------------------------------------------------------+-----+
|S1. Including yourself, how many members of this household are 1 | 1586|
|age 16 or older? 2 | 3031|
| 3 | 505|
| 4 | 194|
| 5 | 55|
| 6 or | 21|
| more | |
+-----------------------------------------------------------------------+-----+
</screen>
</sect3>
</sect2>
<sect2 label="15.7.6" id="CTABLES-Titles">
<title>Titles</title>
<literallayout><literal>/TITLES</literal>
[<literal>TITLE=</literal><emphasis>string</emphasis>…]
[<literal>CAPTION=</literal><emphasis>string</emphasis>…]
[<literal>CORNER=</literal><emphasis>string</emphasis>…]
</literallayout>
<para>The <literal>TITLES</literal> subcommand sets the title, caption, and corner text
for the table output for the previous <literal>TABLE</literal> subcommand. Any
number of strings may be specified for each kind of text, with each
string appearing on a separate line in the output. The title appears
above the table, the caption below the table, and the corner text
appears in the table’s upper left corner. By default, the title is
“Custom Tables” and the caption and corner text are empty. With
some table output styles, the corner text is not displayed.
</para>
<para>The strings provided in this subcommand may contain the following
macro-like keywords that PSPP substitutes at the time that it runs
the command:
</para>
<variablelist><varlistentry><term><literal>)DATE</literal>
</term><listitem><para>The current date, e.g. MM/DD/YY. The format is locale-dependent.
</para>
<!-- ( -->
</listitem></varlistentry><varlistentry><term><literal>)TIME</literal>
</term><listitem><para>The current time, e.g. HH:MM:SS. The format is locale-dependent.
</para>
<!-- ( -->
</listitem></varlistentry><varlistentry><term><literal>)TABLE</literal>
</term><listitem><para>The expression specified on the <literal>TABLE</literal> command. Summary
and measurement level specifications are omitted, and variable labels are used in place of variable names.
</para></listitem></varlistentry></variablelist>
</sect2>
<sect2 label="15.7.7" id="CTABLES-Table-Formatting">
<title>Table Formatting</title>
<literallayout><literal>/FORMAT</literal>
[<literal>MINCOLWIDTH=</literal>{<literal>DEFAULT</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <emphasis>width</emphasis>}]
[<literal>MAXCOLWIDTH=</literal>{<literal>DEFAULT</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <emphasis>width</emphasis>}]
[<literal>UNITS=</literal>{<literal>POINTS</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>INCHES</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>CM</literal>}]
[<literal>EMPTY=</literal>{<literal>ZERO</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>BLANK</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <emphasis>string</emphasis>}]
[<literal>MISSING=</literal><emphasis>string</emphasis>]
</literallayout>
<para>The <literal>FORMAT</literal> subcommand, which must precede the first
<literal>TABLE</literal> subcommand, controls formatting for all the output
tables. <literal>FORMAT</literal> and all of its settings are optional.
</para>
<para>Use <literal>MINCOLWIDTH</literal> and <literal>MAXCOLWIDTH</literal> to control the minimum
or maximum width of columns in output tables. By default, with
<literal>DEFAULT</literal>, column width varies based on content. Otherwise,
specify a number for either or both of these settings. If both are
specified, <literal>MAXCOLWIDTH</literal> must be greater than or equal to
<literal>MINCOLWIDTH</literal>. The default unit, or with <literal>UNITS=POINTS</literal>, is
points (1/72 inch), or specify <literal>UNITS=INCHES</literal> to use inches or
<literal>UNITS=CM</literal> for centimeters. PSPP does not currently honor any
of these settings.
</para>
<para>By default, or with <literal>EMPTY=ZERO</literal>, zero values are displayed in
their usual format. Use <literal>EMPTY=BLANK</literal> to use an empty cell
instead, or <literal>EMPTY="<emphasis>string</emphasis>"</literal> to use the specified string.
</para>
<para>By default, missing values are displayed as ‘<literal>.</literal>’, the same as in
other tables. Specify <literal>MISSING="<emphasis>string</emphasis>"</literal> to instead use a
custom string.
</para>
</sect2>
<sect2 label="15.7.8" id="CTABLES-Display-of-Variable-Labels">
<title>Display of Variable Labels</title>
<literallayout><literal>/VLABELS</literal>
<literal>VARIABLES=</literal><emphasis>variables</emphasis>
<literal>DISPLAY</literal>={<literal>DEFAULT</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>NAME</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>LABEL</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>BOTH</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>NONE</literal>}
</literallayout>
<para>The <literal>VLABELS</literal> subcommand, which must precede the first
<literal>TABLE</literal> subcommand, controls display of variable labels in all
the output tables. <literal>VLABELS</literal> is optional. It may appear
multiple times to adjust settings for different variables.
</para>
<para><literal>VARIABLES</literal> and <literal>DISPLAY</literal> are required. The value of
<literal>DISPLAY</literal> controls how variable labels are displayed for the
variables listed on <literal>VARIABLES</literal>. The supported values are:
</para>
<variablelist><varlistentry><term><literal>DEFAULT</literal>
</term><listitem><para>Use the setting from <literal>SET TVARS</literal> (see <link linkend="SET-TVARS">SET TVARS</link>).
</para>
</listitem></varlistentry><varlistentry><term><literal>NAME</literal>
</term><listitem><para>Show only a variable name.
</para>
</listitem></varlistentry><varlistentry><term><literal>LABEL</literal>
</term><listitem><para>Show only a variable label.
</para>
</listitem></varlistentry><varlistentry><term><literal>BOTH</literal>
</term><listitem><para>Show variable name and label.
</para>
</listitem></varlistentry><varlistentry><term><literal>NONE</literal>
</term><listitem><para>Show nothing.
</para></listitem></varlistentry></variablelist>
</sect2>
<sect2 label="15.7.9" id="CTABLES-Missing-Value-Treatment">
<title>Missing Value Treatment</title>
<para>The <literal>TABLE</literal> subcommand on <literal>CTABLES</literal> specifies two different
kinds of variables: variables that divide tables into cells (which are
always categorical) and variables being summarized (which may be
categorical or scale). PSPP treats missing values differently in
each kind of variable, as described in the sections below.
</para>
<sect3 label="15.7.9.1" id="CTABLES-Missing-Values-for-Cell_002dDefining-Variables">
<title>Missing Values for Cell-Defining Variables</title>
<para>For variables that divide tables into cells, per-variable category
options, as described in <link linkend="CTABLES-Per_002dVariable-Category-Options">CTABLES Per-Variable Category Options</link>,
determine which data is analyzed. If any of the categories for such a
variable would exclude a case, then that case is not included.
</para>
<para>As an example, consider the following entirely artificial dataset, in
which ‘<literal>x</literal>’ and ‘<literal>y</literal>’ are categorical variables with missing
value 9, and ‘<literal>z</literal>’ is scale:
</para>
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Data List
+-+-+---------+
|x|y| z |
+-+-+---------+
|1|1| 1|
|1|2| 10|
|1|9| 100|
|2|1| 1000|
|2|2| 10000|
|2|9| 100000|
|9|1| 1000000|
|9|2| 10000000|
|9|9|100000000|
+-+-+---------+
</screen>
<para>Using ‘<literal>x</literal>’ and ‘<literal>y</literal>’ to define cells, and summarizing ‘<literal>z</literal>’,
by default PSPP omits all the cases that have ‘<literal>x</literal>’ or ‘<literal>y</literal>’ (or both)
missing:
</para>
<screen>CTABLES /TABLE x > y > z [SUM].
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+---------+-----+
| | Sum |
+---------+-----+
|x 1 y 1 z| 1|
| ----+-----+
| 2 z| 10|
| --------+-----+
| 2 y 1 z| 1000|
| ----+-----+
| 2 z|10000|
+---------+-----+
</screen>
<para>If, however, we add <literal>CATEGORIES</literal> specifications to include
missing values for ‘<literal>y</literal>’ or for ‘<literal>x</literal>’ and ‘<literal>y</literal>’, the output
table includes them, like so:
</para>
<screen>CTABLES /TABLE x > y > z [SUM] /CATEGORIES VARIABLES=y MISSING=INCLUDE.
CTABLES /TABLE x > y > z [SUM] /CATEGORIES VARIABLES=x y MISSING=INCLUDE.
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+---------+------+
| | Sum |
+---------+------+
|x 1 y 1 z| 1|
| ----+------+
| 2 z| 10|
| ----+------+
| 9 z| 100|
| --------+------+
| 2 y 1 z| 1000|
| ----+------+
| 2 z| 10000|
| ----+------+
| 9 z|100000|
+---------+------+
Custom Tables
+---------+---------+
| | Sum |
+---------+---------+
|x 1 y 1 z| 1|
| ----+---------+
| 2 z| 10|
| ----+---------+
| 9 z| 100|
| --------+---------+
| 2 y 1 z| 1000|
| ----+---------+
| 2 z| 10000|
| ----+---------+
| 9 z| 100000|
| --------+---------+
| 9 y 1 z| 1000000|
| ----+---------+
| 2 z| 10000000|
| ----+---------+
| 9 z|100000000|
+---------+---------+
</screen>
</sect3>
<sect3 label="15.7.9.2" id="CTABLES-Missing-Values-for-Summary-Variables">
<title>Missing Values for Summary Variables</title>
<para>For summary variables, values that are valid and in included
categories are analyzed, and values that are missing or in excluded
categories are not analyzed, with the following exceptions:
</para>
<itemizedlist><listitem><para>The “<literal>VALIDN</literal>” summary functions (<literal>VALIDN</literal>, <literal>EVALIDN</literal>,
<literal>UVALIDN</literal>, <literal><emphasis>area</emphasis>PCT.VALIDN</literal>, and
<literal>U<emphasis>area</emphasis>PCT.VALIDN</literal>) only count valid values in included
categories (not missing values in included categories).
</para>
</listitem><listitem><para>The “<literal>TOTALN</literal>” summary functions (<literal>TOTALN</literal>, <literal>ETOTALN</literal>,
<literal>UTOTALN</literal>, <literal><emphasis>area</emphasis>PCT.TOTALN</literal>), and
<literal>U<emphasis>area</emphasis>PCT.TOTALN</literal> count all values (valid and missing) in
included categories and missing (but not valid) values in excluded
categories.
</para></listitem></itemizedlist>
<para>For categorical variables, system-missing values are never in included
categories. For scale variables, there is no notion of included and
excluded categories, so all values are effectively included.
</para>
<para>The following table provides another view of the above rules:
</para>
<informaltable><tgroup cols="4"><colspec colwidth="41*"></colspec><colspec colwidth="6*"></colspec><colspec colwidth="5*"></colspec><colspec colwidth="6*"></colspec><thead><row><entry></entry><entry><para><literal>VALIDN</literal> </para></entry><entry><para>other </para></entry><entry><para><literal>TOTALN</literal>
</para></entry></row></thead><tbody><row><entry><para><emphasis role="bold">Categorical variables:</emphasis>
</para></entry></row><row><entry><para>&#160;<!-- /@w -->&#160;<!-- /@w -->&#160;<!-- /@w -->&#160;<!-- /@w -->Valid values in included categories </para></entry><entry><para>yes </para></entry><entry><para>yes </para></entry><entry><para>yes
</para></entry></row><row><entry><para>&#160;<!-- /@w -->&#160;<!-- /@w -->&#160;<!-- /@w -->&#160;<!-- /@w -->Missing values in included categories </para></entry><entry><para>— </para></entry><entry><para>yes </para></entry><entry><para>yes
</para></entry></row><row><entry><para>&#160;<!-- /@w -->&#160;<!-- /@w -->&#160;<!-- /@w -->&#160;<!-- /@w -->Missing values in excluded categories </para></entry><entry><para>— </para></entry><entry><para>— </para></entry><entry><para>yes
</para></entry></row><row><entry><para>&#160;<!-- /@w -->&#160;<!-- /@w -->&#160;<!-- /@w -->&#160;<!-- /@w -->Valid values in excluded categories </para></entry><entry><para>— </para></entry><entry><para>— </para></entry><entry><para>—
</para></entry></row><row><entry><para><emphasis role="bold">Scale variables:</emphasis>
</para></entry></row><row><entry><para>&#160;<!-- /@w -->&#160;<!-- /@w -->&#160;<!-- /@w -->&#160;<!-- /@w -->Valid values </para></entry><entry><para>yes </para></entry><entry><para>yes </para></entry><entry><para>yes
</para></entry></row><row><entry><para>&#160;<!-- /@w -->&#160;<!-- /@w -->&#160;<!-- /@w -->&#160;<!-- /@w -->User- or system-missing values </para></entry><entry><para>— </para></entry><entry><para>yes </para></entry><entry><para>yes
</para></entry></row></tbody></tgroup></informaltable>
</sect3>
<sect3 label="15.7.9.3" id="CTABLES-Scale-Missing-Values">
<title>Scale Missing Values</title>
<literallayout><literal>/SMISSING</literal> {<literal>VARIABLE</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>LISTWISE</literal>}
</literallayout>
<para>The <literal>SMISSING</literal> subcommand, which must precede the first
<literal>TABLE</literal> subcommand, controls treatment of missing values for
scalar variables in producing all the output tables. <literal>SMISSING</literal>
is optional.
</para>
<para>With <literal>SMISSING=VARIABLE</literal>, which is the default, missing values
are excluded on a variable-by-variable basis. With
<literal>SMISSING=LISTWISE</literal>, when stacked scalar variables are nested
together with a categorical variable, a missing value for any of the
scalar variables causes the case to be excluded for all of them.
</para>
<para>As an example, consider the following dataset, in which ‘<literal>x</literal>’ is a
categorical variable and ‘<literal>y</literal>’ and ‘<literal>z</literal>’ are scale:
</para>
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Data List
+-+-----+-----+
|x| y | z |
+-+-----+-----+
|1| .|40.00|
|1|10.00|50.00|
|1|20.00|60.00|
|1|30.00| .|
+-+-----+-----+
</screen>
<para>With the default missing-value treatment, ‘<literal>x</literal>’’s mean is 20, based
on the values 10, 20, and 30, and ‘<literal>y</literal>’’s mean is 50, based on 40,
50, and 60:
</para>
<screen>CTABLES /TABLE (y + z) > x.
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen>Custom Tables
+-----+-----+
| | Mean|
+-----+-----+
|y x 1|20.00|
+-----+-----+
|z x 1|50.00|
+-----+-----+
</screen>
<para>By adding <literal>SMISSING=LISTWISE</literal>, only cases where ‘<literal>y</literal>’ and
‘<literal>z</literal>’ are both non-missing are considered, so ‘<literal>x</literal>’’s mean
becomes 15, as the average of 10 and 20, and ‘<literal>y</literal>’’s mean becomes
55, the average of 50 and 60:
</para>
<screen>CTABLES /SMISSING LISTWISE /TABLE (y + z) > x.
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen>Custom Tables
+-----+-----+
| | Mean|
+-----+-----+
|y x 1|15.00|
+-----+-----+
|z x 1|55.00|
+-----+-----+
</screen>
<para>Even with <literal>SMISSING=LISTWISE</literal>, if ‘<literal>y</literal>’ and ‘<literal>z</literal>’ are
separately nested with ‘<literal>x</literal>’, instead of using a single ‘<literal>></literal>’
operator, missing values revert to being considered on a
variable-by-variable basis:
</para>
<screen>CTABLES /SMISSING LISTWISE /TABLE (y > x) + (z > x).
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen>Custom Tables
+-----+-----+
| | Mean|
+-----+-----+
|y x 1|20.00|
+-----+-----+
|z x 1|50.00|
+-----+-----+
</screen>
</sect3>
</sect2>
<sect2 label="15.7.10" id="CTABLES-Computed-Categories">
<title>Computed Categories</title>
<literallayout><literal>/PCOMPUTE</literal> <literal>&</literal><emphasis>postcompute</emphasis><literal>=EXPR(</literal><emphasis>expression</emphasis><literal>)</literal>
<literal>/PPROPERTIES</literal> <literal>&</literal><emphasis>postcompute</emphasis>…
[<literal>LABEL=</literal><emphasis>string</emphasis>]
[<literal>FORMAT=</literal>[<emphasis>summary</emphasis> <emphasis>format</emphasis>]…]
[<literal>HIDESOURCECATS=</literal>{<literal>NO</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>YES</literal>}
</literallayout>
<para><firstterm>Computed categories</firstterm>, also called <firstterm>postcomputes</firstterm>, are
categories created using arithmetic on categories obtained from the
data. The <literal>PCOMPUTE</literal> subcommand creates a postcompute, which may
then be used on <literal>CATEGORIES</literal> within an explicit category list
(see <link linkend="CTABLES-Explicit-Category-List">CTABLES Explicit Category List</link>). Optionally,
<literal>PPROPERTIES</literal> refines how a postcompute is displayed. The
following sections provide the details.
</para>
<sect3 label="15.7.10.1" id="CTABLES-PCOMPUTE">
<title>PCOMPUTE</title>
<literallayout><literal>/PCOMPUTE</literal> <literal>&</literal><emphasis>postcompute</emphasis><literal>=EXPR(</literal><emphasis>expression</emphasis><literal>)</literal>
</literallayout>
<para>The <literal>PCOMPUTE</literal> subcommand, which must precede the first
<literal>TABLE</literal> command, defines computed categories. It is optional and
may be used any number of times to define multiple postcomputes.
</para>
<para>Each <literal>PCOMPUTE</literal> defines one postcompute. Its syntax consists of
a name to identify the postcompute as a PSPP identifier prefixed by
‘<literal>&</literal>’, followed by ‘<literal>=</literal>’ and a postcompute expression enclosed
in <literal>EXPR(…)</literal>. A postcompute expression consists of:
</para>
<variablelist><varlistentry><term><literal>[<emphasis>category</emphasis>]</literal>
</term><listitem><para>This form evaluates to the summary statistic for <emphasis>category</emphasis>, e.g.
<literal>[1]</literal> evaluates to the value of the summary statistic associated
with category 1. The <emphasis>category</emphasis> may be a number, a quoted string,
or a quoted time or date value. All of the categories for a given
postcompute must have the same form. The category must appear in all
the <literal>CATEGORIES</literal> list in which the postcompute is used.
</para>
</listitem></varlistentry><varlistentry><term><literal>[<emphasis>min</emphasis> THRU <emphasis>max</emphasis>]</literal>
</term><term><literal>[LO THRU <emphasis>max</emphasis>]</literal>
</term><term><literal>[<emphasis>min</emphasis> THRU HI]</literal>
</term><term><literal>MISSING</literal>
</term><term><literal>OTHERNM</literal>
</term><listitem><para>These forms evaluate to the summary statistics for a category
specified with the same syntax, as described in previous section
(see <link linkend="CTABLES-Explicit-Category-List">CTABLES Explicit Category List</link>). The category must appear in
all the <literal>CATEGORIES</literal> list in which the postcompute is used.
</para>
</listitem></varlistentry><varlistentry><term><literal>SUBTOTAL</literal>
</term><listitem><para>The summary statistic for the subtotal category. This form is allowed
only if the <literal>CATEGORIES</literal> lists that include this postcompute have
exactly one subtotal.
</para>
</listitem></varlistentry><varlistentry><term><literal>SUBTOTAL[<emphasis>index</emphasis>]</literal>
</term><listitem><para>The summary statistic for subtotal category <emphasis>index</emphasis>, where 1 is the
first subtotal, 2 is the second, and so on. This form may be used for
<literal>CATEGORIES</literal> lists with any number of subtotals.
</para>
</listitem></varlistentry><varlistentry><term><literal>TOTAL</literal>
</term><listitem><para>The summary statistic for the total. The <literal>CATEGORIES</literal> lsits that
include this postcompute must have a total enabled.
</para>
</listitem></varlistentry><varlistentry><term><literal><emphasis>a</emphasis> + <emphasis>b</emphasis></literal>
</term><term><literal><emphasis>a</emphasis> - <emphasis>b</emphasis></literal>
</term><term><literal><emphasis>a</emphasis> * <emphasis>b</emphasis></literal>
</term><term><literal><emphasis>a</emphasis> / <emphasis>b</emphasis></literal>
</term><term><literal><emphasis>a</emphasis> ** <emphasis>b</emphasis></literal>
</term><listitem><para>These forms perform arithmetic on the values of postcompute
expressions <emphasis>a</emphasis> and <emphasis>b</emphasis>. The usual operator precedence rules
apply.
</para>
</listitem></varlistentry><varlistentry><term><literal><emphasis>number</emphasis></literal>
</term><listitem><para>Numeric constants may be used in postcompute expressions.
</para>
</listitem></varlistentry><varlistentry><term><literal>(<emphasis>a</emphasis>)</literal>
</term><listitem><para>Parentheses override operator precedence.
</para></listitem></varlistentry></variablelist>
<para>A postcompute is not associated with any particular variable.
Instead, it may be referenced within <literal>CATEGORIES</literal> for any
suitable variable (e.g. only a string variable is suitable for a
postcompute expression that refers to a string category, only a
variable with subtotals for an expression that refers to subtotals,
…).
</para>
<para>Normally a named postcompute is defined only once, but if a later
<literal>PCOMPUTE</literal> redefines a postcompute with the same name as an
earlier one, the later one take precedence.
</para>
<para>The following syntax and output shows how <literal>PCOMPUTE</literal> can compute
a total over subtotals, summing the “Frequent Drivers” and
“Infrequent Drivers” subtotals to form an “All Drivers”
postcompute. It also shows how to calculate and display a percentage,
in this case the percentage of valid responses that report never
driving. It uses <literal>PPROPERTIES</literal> (see <link linkend="CTABLES-PPROPERTIES">CTABLES PPROPERTIES</link>) to
display the latter in <literal>PCT</literal> format.
</para>
<screen>CTABLES
/PCOMPUTE &all_drivers=EXPR([1 THRU 2] + [3 THRU 4])
/PPROPERTIES &all_drivers LABEL='All Drivers'
/PCOMPUTE &pct_never=EXPR([5] / ([1 THRU 2] + [3 THRU 4] + [5]) * 100)
/PPROPERTIES &pct_never LABEL='% Not Drivers' FORMAT=COUNT PCT40.1
/TABLE=freqOfDriving BY gender
/CATEGORIES VARIABLES=freqOfDriving
[1 THRU 2, SUBTOTAL='Frequent Drivers',
3 THRU 4, SUBTOTAL='Infrequent Drivers',
&all_drivers, 5, &pct_never,
MISSING, SUBTOTAL='Not Drivers or Missing'].
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+----------------------------------------------------------------+------------+
| |S3a. GENDER:|
| +-----+------+
| | Male|Female|
| +-----+------+
| |Count| Count|
+----------------------------------------------------------------+-----+------+
| 1. How often do you usually drive a car or Every day | 2305| 2362|
|other motor vehicle? Several days a week | 440| 834|
| Frequent Drivers | 2745| 3196|
| Once a week or less | 125| 236|
| Only certain times a| 58| 72|
| year | | |
| Infrequent Drivers | 183| 308|
| All Drivers | 2928| 3504|
| Never | 192| 348|
| % Not Drivers | 6.2%| 9.0%|
| Don't know | 3| 5|
| Refused | 9| 10|
| Not Drivers or | 204| 363|
| Missing | | |
+----------------------------------------------------------------+-----+------+
</screen>
</sect3>
<sect3 label="15.7.10.2" id="CTABLES-PPROPERTIES">
<title>PPROPERTIES</title>
<literallayout><literal>/PPROPERTIES</literal> <literal>&</literal><emphasis>postcompute</emphasis>…
[<literal>LABEL=</literal><emphasis>string</emphasis>]
[<literal>FORMAT=</literal>[<emphasis>summary</emphasis> <emphasis>format</emphasis>]…]
[<literal>HIDESOURCECATS=</literal>{<literal>NO</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>YES</literal>}
</literallayout>
<para>The <literal>PPROPERTIES</literal> subcommand, which must appear before
<literal>TABLE</literal>, sets properties for one or more postcomputes defined on
prior <literal>PCOMPUTE</literal> subcommands. The subcommand syntax begins with
the list of postcomputes, each prefixed with ‘<literal>&</literal>’ as specified on
<literal>PCOMPUTE</literal>.
</para>
<para>All of the settings on <literal>PPROPERTIES</literal> are optional. Use
<literal>LABEL</literal> to set the label shown for the postcomputes in table
output. The default label for a postcompute is the expression used to
define it.
</para>
<para>A postcompute always uses same summary functions as the variable whose
categories contain it, but <literal>FORMAT</literal> allows control over the
format used to display their values. It takes a list of summary
function names and format specifiers.
</para>
<para>By default, or with <literal>HIDESOURCECATS=NO</literal>, categories referred to
by computed categories are displayed like other categories. Use
<literal>HIDESOURCECATS=YES</literal> to hide them.
</para>
<para>The previous section provides an example for <literal>PPROPERTIES</literal>.
</para>
</sect3>
</sect2>
<sect2 label="15.7.11" id="CTABLES-Effective-Weight">
<title>Effective Weight</title>
<literallayout><literal>/WEIGHT VARIABLE=</literal><emphasis>variable</emphasis>
</literallayout>
<para>The <literal>WEIGHT</literal> subcommand is optional and must appear before
<literal>TABLE</literal>. If it appears, it must name a numeric variable, known
as the <firstterm>effective weight</firstterm> or <firstterm>adjustment weight</firstterm>. The
effective weight variable stands in for the dictionary’s weight
variable (see <link linkend="WEIGHT">WEIGHT</link>), if any, in most calculations in
<literal>CTABLES</literal>. The only exceptions are the <literal>COUNT</literal>,
<literal>TOTALN</literal>, and <literal>VALIDN</literal> summary functions, which use the
dictionary weight instead.
</para>
<para>Weights obtained from the PSPP dictionary are rounded to the
nearest integer at the case level. Effective weights are not rounded.
Regardless of the weighting source, PSPP does not analyze cases
with zero, missing, or negative effective weights.
</para>
</sect2>
<sect2 label="15.7.12" id="CTABLES-Hiding-Small-Counts">
<title>Hiding Small Counts</title>
<literallayout><literal>/HIDESMALLCOUNTS COUNT=<emphasis>count</emphasis></literal>
</literallayout>
<para>The <literal>HIDESMALLCOUNTS</literal> subcommand is optional. If it specified,
then <literal>COUNT</literal>, <literal>ECOUNT</literal>, and <literal>UCOUNT</literal> values in output
tables less than the value of <emphasis>count</emphasis> are shown as <literal><<emphasis>count</emphasis></literal>
instead of their true values. The value of <emphasis>count</emphasis> must be an
integer and must be at least 2.
</para>
<para>The following syntax and example shows how to use
<literal>HIDESMALLCOUNTS</literal>:
</para>
<screen>CTABLES /HIDESMALLCOUNTS COUNT=10 /TABLE placeOfLastDrinkBeforeDrive.
</screen><!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Custom Tables
+-----------------------------------------------------------------------+-----+
| |Count|
+-----------------------------------------------------------------------+-----+
|37. Please think about the most recent occasion that Other (list) |<10 |
|you drove within two hours of drinking alcoholic Your home | 182|
|beverages. Where did you drink on that occasion? Friend's home | 264|
| Bar/Tavern/Club | 279|
| Restaurant | 495|
| Work | 21|
| Bowling alley |<10 |
| Hotel/Motel |<10 |
| Country Club/ | 17|
| Golf course | |
| Drank in the |<10 |
| car/On the road | |
| Sporting event | 15|
| Movie theater |<10 |
| Shopping/Store/ |<10 |
| Grocery store | |
| Wedding | 15|
| Party at someone| 81|
| else's home | |
| Park/picnic | 14|
| Party at your |<10 |
| house | |
+-----------------------------------------------------------------------+-----+
</screen>
</sect2>
</sect1>
<sect1 label="15.8" id="FACTOR">
<title>FACTOR</title>
<indexterm role="vr"><primary>FACTOR</primary></indexterm>
<indexterm role="cp"><primary>factor analysis</primary></indexterm>
<indexterm role="cp"><primary>principal components analysis</primary></indexterm>
<indexterm role="cp"><primary>principal axis factoring</primary></indexterm>
<indexterm role="cp"><primary>data reduction</primary></indexterm>
<literallayout>FACTOR {
VARIABLES=<replaceable>var_list</replaceable>,
MATRIX IN ({CORR,COV}={*,<replaceable>file_spec</replaceable>})
}
[ /METHOD = {CORRELATION, COVARIANCE} ]
[ /ANALYSIS=<replaceable>var_list</replaceable> ]
[ /EXTRACTION={PC, PAF}]
[ /ROTATION={VARIMAX, EQUAMAX, QUARTIMAX, PROMAX[(<replaceable>k</replaceable>)], NOROTATE}]
[ /PRINT=[INITIAL] [EXTRACTION] [ROTATION] [UNIVARIATE] [CORRELATION] [COVARIANCE] [DET] [KMO] [AIC] [SIG] [ALL] [DEFAULT] ]
[ /PLOT=[EIGEN] ]
[ /FORMAT=[SORT] [BLANK(<replaceable>n</replaceable>)] [DEFAULT] ]
[ /CRITERIA=[FACTORS(<replaceable>n</replaceable>)] [MINEIGEN(<replaceable>l</replaceable>)] [ITERATE(<replaceable>m</replaceable>)] [ECONVERGE (<replaceable>delta</replaceable>)] [DEFAULT] ]
[ /MISSING=[{LISTWISE, PAIRWISE}] [{INCLUDE, EXCLUDE}] ]
</literallayout>
<para>The <literal>FACTOR</literal> command performs Factor Analysis or Principal Axis Factoring on a dataset. It may be used to find
common factors in the data or for data reduction purposes.
</para>
<para>The <literal>VARIABLES</literal> subcommand is required (unless the <literal>MATRIX IN</literal>
subcommand is used).
It lists the variables which are to partake in the analysis. (The <literal>ANALYSIS</literal>
subcommand may optionally further limit the variables that
participate; it is useful primarily in conjunction with <literal>MATRIX IN</literal>.)
</para>
<para>If <literal>MATRIX IN</literal> instead of <literal>VARIABLES</literal> is specified, then the analysis
is performed on a pre-prepared correlation or covariance matrix file instead of on
individual data cases. Typically the matrix file will have been generated by
<literal>MATRIX DATA</literal> (see <link linkend="MATRIX-DATA">MATRIX DATA</link>) or provided by a third party.
If specified, <literal>MATRIX IN</literal> must be followed by ‘<literal>COV</literal>’ or ‘<literal>CORR</literal>’,
then by ‘<literal>=</literal>’ and <replaceable>file_spec</replaceable> all in parentheses.
<replaceable>file_spec</replaceable> may either be an asterisk, which indicates the currently loaded
dataset, or it may be a file name to be loaded. See <link linkend="MATRIX-DATA">MATRIX DATA</link>, for the expected
format of the file.
</para>
<para>The <literal>/EXTRACTION</literal> subcommand is used to specify the way in which factors
(components) are extracted from the data.
If <literal>PC</literal> is specified, then Principal Components Analysis is used.
If <literal>PAF</literal> is specified, then Principal Axis Factoring is
used. By default Principal Components Analysis is used.
</para>
<para>The <literal>/ROTATION</literal> subcommand is used to specify the method by which the
extracted solution is rotated. Three orthogonal rotation methods are available:
<literal>VARIMAX</literal> (which is the default), <literal>EQUAMAX</literal>, and <literal>QUARTIMAX</literal>.
There is one oblique rotation method, <emphasis>viz</emphasis>: <literal>PROMAX</literal>.
Optionally you may enter the power of the promax rotation <replaceable>k</replaceable>, which must be enclosed in parentheses.
The default value of <replaceable>k</replaceable> is 5.
If you don’t want any rotation to be performed, the word <literal>NOROTATE</literal>
prevents the command from performing any rotation on the data.
</para>
<para>The <literal>/METHOD</literal> subcommand should be used to determine whether the
covariance matrix or the correlation matrix of the data is
to be analysed. By default, the correlation matrix is analysed.
</para>
<para>The <literal>/PRINT</literal> subcommand may be used to select which features of the analysis are reported:
</para>
<itemizedlist><listitem><para><literal>UNIVARIATE</literal>
A table of mean values, standard deviations and total weights are printed.
</para></listitem><listitem><para><literal>INITIAL</literal>
Initial communalities and eigenvalues are printed.
</para></listitem><listitem><para><literal>EXTRACTION</literal>
Extracted communalities and eigenvalues are printed.
</para></listitem><listitem><para><literal>ROTATION</literal>
Rotated communalities and eigenvalues are printed.
</para></listitem><listitem><para><literal>CORRELATION</literal>
The correlation matrix is printed.
</para></listitem><listitem><para><literal>COVARIANCE</literal>
The covariance matrix is printed.
</para></listitem><listitem><para><literal>DET</literal>
The determinant of the correlation or covariance matrix is printed.
</para></listitem><listitem><para><literal>AIC</literal>
The anti-image covariance and anti-image correlation matrices are printed.
</para></listitem><listitem><para><literal>KMO</literal>
The Kaiser-Meyer-Olkin measure of sampling adequacy and the Bartlett test of sphericity is printed.
</para></listitem><listitem><para><literal>SIG</literal>
The significance of the elements of correlation matrix is printed.
</para></listitem><listitem><para><literal>ALL</literal>
All of the above are printed.
</para></listitem><listitem><para><literal>DEFAULT</literal>
Identical to <literal>INITIAL</literal> and <literal>EXTRACTION</literal>.
</para></listitem></itemizedlist>
<para>If <literal>/PLOT=EIGEN</literal> is given, then a “Scree” plot of the eigenvalues is
printed. This can be useful for visualizing the factors and deciding
which factors (components) should be retained.
</para>
<para>The <literal>/FORMAT</literal> subcommand determined how data are to be
displayed in loading matrices. If <literal>SORT</literal> is specified, then
the variables are sorted in descending order of significance. If
<literal>BLANK(<replaceable>n</replaceable>)</literal> is specified, then coefficients whose absolute
value is less than <replaceable>n</replaceable> are not printed. If the keyword
<literal>DEFAULT</literal> is specified, or if no <literal>/FORMAT</literal> subcommand is
specified, then no sorting is performed, and all coefficients are printed.
</para>
<para>You can use the <literal>/CRITERIA</literal> subcommand to specify how the number of
extracted factors (components) are chosen. If <literal>FACTORS(<replaceable>n</replaceable>)</literal> is
specified, where <replaceable>n</replaceable> is an integer, then <replaceable>n</replaceable> factors are
extracted. Otherwise, the <literal>MINEIGEN</literal> setting is used.
<literal>MINEIGEN(<replaceable>l</replaceable>)</literal> requests that all factors whose eigenvalues
are greater than or equal to <replaceable>l</replaceable> are extracted. The default value
of <replaceable>l</replaceable> is 1. The <literal>ECONVERGE</literal> setting has effect only when
using iterative algorithms for factor extraction (such as Principal Axis
Factoring). <literal>ECONVERGE(<replaceable>delta</replaceable>)</literal> specifies that
iteration should cease when the maximum absolute value of the
communality estimate between one iteration and the previous is less
than <replaceable>delta</replaceable>. The default value of <replaceable>delta</replaceable> is 0.001.
</para>
<para>The <literal>ITERATE(<replaceable>m</replaceable>)</literal> may appear any number of times and is
used for two different purposes. It is used to set the maximum number
of iterations (<replaceable>m</replaceable>) for convergence and also to set the maximum
number of iterations for rotation.
Whether it affects convergence or rotation depends upon which
subcommand follows the <literal>ITERATE</literal> subcommand.
If <literal>EXTRACTION</literal> follows, it affects convergence.
If <literal>ROTATION</literal> follows, it affects rotation.
If neither <literal>ROTATION</literal> nor <literal>EXTRACTION</literal> follow a
<literal>ITERATE</literal> subcommand, then the entire subcommand is ignored.
The default value of <replaceable>m</replaceable> is 25.
</para>
<para>The <literal>MISSING</literal> subcommand determines the handling of missing
variables. If <literal>INCLUDE</literal> is set, then user-missing values are
included in the calculations, but system-missing values are not.
If <literal>EXCLUDE</literal> is set, which is the default, user-missing
values are excluded as well as system-missing values. This is the
default. If <literal>LISTWISE</literal> is set, then the entire case is excluded
from analysis whenever any variable specified in the <literal>VARIABLES</literal>
subcommand contains a missing value.
</para>
<para>If <literal>PAIRWISE</literal> is set, then a case is considered missing only if
either of the values for the particular coefficient are missing.
The default is <literal>LISTWISE</literal>.
</para>
</sect1>
<sect1 label="15.9" id="GLM">
<title>GLM</title>
<indexterm role="vr"><primary>GLM</primary></indexterm>
<indexterm role="cp"><primary>univariate analysis of variance</primary></indexterm>
<indexterm role="cp"><primary>fixed effects</primary></indexterm>
<indexterm role="cp"><primary>factorial anova</primary></indexterm>
<indexterm role="cp"><primary>analysis of variance</primary></indexterm>
<indexterm role="cp"><primary>ANOVA</primary></indexterm>
<literallayout>GLM <replaceable>dependent_vars</replaceable> BY <replaceable>fixed_factors</replaceable>
[/METHOD = SSTYPE(<replaceable>type</replaceable>)]
[/DESIGN = <replaceable>interaction_0</replaceable> [<replaceable>interaction_1</replaceable> [... <replaceable>interaction_n</replaceable>]]]
[/INTERCEPT = {INCLUDE|EXCLUDE}]
[/MISSING = {INCLUDE|EXCLUDE}]
</literallayout>
<para>The <literal>GLM</literal> procedure can be used for fixed effects factorial Anova.
</para>
<para>The <replaceable>dependent_vars</replaceable> are the variables to be analysed.
You may analyse several variables in the same command in which case they should all
appear before the <literal>BY</literal> keyword.
</para>
<para>The <replaceable>fixed_factors</replaceable> list must be one or more categorical variables. Normally it
does not make sense to enter a scalar variable in the <replaceable>fixed_factors</replaceable> and doing
so may cause PSPP to do a lot of unnecessary processing.
</para>
<para>The <literal>METHOD</literal> subcommand is used to change the method for producing the sums of
squares. Available values of <replaceable>type</replaceable> are 1, 2 and 3. The default is type 3.
</para>
<para>You may specify a custom design using the <literal>DESIGN</literal> subcommand.
The design comprises a list of interactions where each interaction is a
list of variables separated by a ‘<literal>*</literal>’. For example the command
</para><literallayout>GLM subject BY sex age_group race
/DESIGN = age_group sex group age_group*sex age_group*race
</literallayout><para>specifies the model <inlineequation><mathphrase>subject = age_group + sex + race + age_group*sex + age_group*race</mathphrase></inlineequation>.
If no <literal>DESIGN</literal> subcommand is specified, then the default is all possible combinations
of the fixed factors. That is to say
</para><literallayout>GLM subject BY sex age_group race
</literallayout><para>implies the model
<inlineequation><mathphrase>subject = age_group + sex + race + age_group*sex + age_group*race + sex*race + age_group*sex*race</mathphrase></inlineequation>.
</para>
<para>The <literal>MISSING</literal> subcommand determines the handling of missing
variables.
If <literal>INCLUDE</literal> is set then, for the purposes of GLM analysis,
only system-missing values are considered
to be missing; user-missing values are not regarded as missing.
If <literal>EXCLUDE</literal> is set, which is the default, then user-missing
values are considered to be missing as well as system-missing values.
A case for which any dependent variable or any factor
variable has a missing value is excluded from the analysis.
</para>
</sect1>
<sect1 label="15.10" id="LOGISTIC-REGRESSION">
<title>LOGISTIC REGRESSION</title>
<indexterm role="vr"><primary>LOGISTIC REGRESSION</primary></indexterm>
<indexterm role="cp"><primary>logistic regression</primary></indexterm>
<indexterm role="cp"><primary>bivariate logistic regression</primary></indexterm>
<literallayout>LOGISTIC REGRESSION [VARIABLES =] <replaceable>dependent_var</replaceable> WITH <replaceable>predictors</replaceable>
[/CATEGORICAL = <replaceable>categorical_predictors</replaceable>]
[{/NOCONST | /ORIGIN | /NOORIGIN }]
[/PRINT = [SUMMARY] [DEFAULT] [CI(<replaceable>confidence</replaceable>)] [ALL]]
[/CRITERIA = [BCON(<replaceable>min_delta</replaceable>)] [ITERATE(<replaceable>max_interations</replaceable>)]
[LCON(<replaceable>min_likelihood_delta</replaceable>)] [EPS(<replaceable>min_epsilon</replaceable>)]
[CUT(<replaceable>cut_point</replaceable>)]]
[/MISSING = {INCLUDE|EXCLUDE}]
</literallayout>
<para>Bivariate Logistic Regression is used when you want to explain a dichotomous dependent
variable in terms of one or more predictor variables.
</para>
<para>The minimum command is
</para><screen>LOGISTIC REGRESSION <replaceable>y</replaceable> WITH <replaceable>x1</replaceable> <replaceable>x2</replaceable> … <replaceable>xn</replaceable>.
</screen><para>Here, <replaceable>y</replaceable> is the dependent variable, which must be dichotomous and <replaceable>x1</replaceable> … <replaceable>xn</replaceable>
are the predictor variables whose coefficients the procedure estimates.
</para>
<para>By default, a constant term is included in the model.
Hence, the full model is
<inlineequation><mathphrase>{\bf y}
= b_0 + b_1 {\bf x_1}
+ b_2 {\bf x_2}
+ \dots
+ b_n {\bf x_n}
</mathphrase></inlineequation>
</para>
<para>Predictor variables which are categorical in nature should be listed on the <literal>/CATEGORICAL</literal> subcommand.
Simple variables as well as interactions between variables may be listed here.
</para>
<para>If you want a model without the constant term <inlineequation><mathphrase>b_0</mathphrase></inlineequation>, use the keyword <literal>/ORIGIN</literal>.
<literal>/NOCONST</literal> is a synonym for <literal>/ORIGIN</literal>.
</para>
<para>An iterative Newton-Raphson procedure is used to fit the model.
The <literal>/CRITERIA</literal> subcommand is used to specify the stopping criteria of the procedure,
and other parameters.
The value of <replaceable>cut_point</replaceable> is used in the classification table. It is the
threshold above which predicted values are considered to be 1. Values
of <replaceable>cut_point</replaceable> must lie in the range [0,1].
During iterations, if any one of the stopping criteria are satisfied, the procedure is
considered complete.
The stopping criteria are:
</para><itemizedlist><listitem><para>The number of iterations exceeds <replaceable>max_iterations</replaceable>.
The default value of <replaceable>max_iterations</replaceable> is 20.
</para></listitem><listitem><para>The change in the all coefficient estimates are less than <replaceable>min_delta</replaceable>.
The default value of <replaceable>min_delta</replaceable> is 0.001.
</para></listitem><listitem><para>The magnitude of change in the likelihood estimate is less than <replaceable>min_likelihood_delta</replaceable>.
The default value of <replaceable>min_delta</replaceable> is zero.
This means that this criterion is disabled.
</para></listitem><listitem><para>The differential of the estimated probability for all cases is less than <replaceable>min_epsilon</replaceable>.
In other words, the probabilities are close to zero or one.
The default value of <replaceable>min_epsilon</replaceable> is 0.00000001.
</para></listitem></itemizedlist>
<para>The <literal>PRINT</literal> subcommand controls the display of optional statistics.
Currently there is one such option, <literal>CI</literal>, which indicates that the
confidence interval of the odds ratio should be displayed as well as its value.
<literal>CI</literal> should be followed by an integer in parentheses, to indicate the
confidence level of the desired confidence interval.
</para>
<para>The <literal>MISSING</literal> subcommand determines the handling of missing
variables.
If <literal>INCLUDE</literal> is set, then user-missing values are included in the
calculations, but system-missing values are not.
If <literal>EXCLUDE</literal> is set, which is the default, user-missing
values are excluded as well as system-missing values.
This is the default.
</para>
</sect1>
<sect1 label="15.11" id="MEANS">
<title>MEANS</title>
<indexterm role="vr"><primary>MEANS</primary></indexterm>
<indexterm role="cp"><primary>means</primary></indexterm>
<literallayout>MEANS [TABLES =]
{<replaceable>var_list</replaceable>}
[ BY {<replaceable>var_list</replaceable>} [BY {<replaceable>var_list</replaceable>} [BY {<replaceable>var_list</replaceable>} … ]]]
[ /{<replaceable>var_list</replaceable>}
[ BY {<replaceable>var_list</replaceable>} [BY {<replaceable>var_list</replaceable>} [BY {<replaceable>var_list</replaceable>} … ]]] ]
[/CELLS = [MEAN] [COUNT] [STDDEV] [SEMEAN] [SUM] [MIN] [MAX] [RANGE]
[VARIANCE] [KURT] [SEKURT]
[SKEW] [SESKEW] [FIRST] [LAST]
[HARMONIC] [GEOMETRIC]
[DEFAULT]
[ALL]
[NONE] ]
[/MISSING = [INCLUDE] [DEPENDENT]]
</literallayout>
<para>You can use the <literal>MEANS</literal> command to calculate the arithmetic mean and similar
statistics, either for the dataset as a whole or for categories of data.
</para>
<para>The simplest form of the command is
</para><screen>MEANS <replaceable>v</replaceable>.
</screen><para>which calculates the mean, count and standard deviation for <replaceable>v</replaceable>.
If you specify a grouping variable, for example
</para><screen>MEANS <replaceable>v</replaceable> BY <replaceable>g</replaceable>.
</screen><para>then the means, counts and standard deviations for <replaceable>v</replaceable> after having
been grouped by <replaceable>g</replaceable> are calculated.
Instead of the mean, count and standard deviation, you could specify the statistics
in which you are interested:
</para><screen>MEANS <replaceable>x</replaceable> <replaceable>y</replaceable> BY <replaceable>g</replaceable>
/CELLS = HARMONIC SUM MIN.
</screen><para>This example calculates the harmonic mean, the sum and the minimum values of <replaceable>x</replaceable> and <replaceable>y</replaceable>
grouped by <replaceable>g</replaceable>.
</para>
<para>The <literal>CELLS</literal> subcommand specifies which statistics to calculate. The available statistics
are:
</para><itemizedlist><listitem><para><literal>MEAN</literal>
<indexterm role="cp"><primary>arithmetic mean</primary></indexterm>
The arithmetic mean.
</para></listitem><listitem><para><literal>COUNT</literal>
The count of the values.
</para></listitem><listitem><para><literal>STDDEV</literal>
The standard deviation.
</para></listitem><listitem><para><literal>SEMEAN</literal>
The standard error of the mean.
</para></listitem><listitem><para><literal>SUM</literal>
The sum of the values.
</para></listitem><listitem><para><literal>MIN</literal>
The minimum value.
</para></listitem><listitem><para><literal>MAX</literal>
The maximum value.
</para></listitem><listitem><para><literal>RANGE</literal>
The difference between the maximum and minimum values.
</para></listitem><listitem><para><literal>VARIANCE</literal>
The variance.
</para></listitem><listitem><para><literal>FIRST</literal>
The first value in the category.
</para></listitem><listitem><para><literal>LAST</literal>
The last value in the category.
</para></listitem><listitem><para><literal>SKEW</literal>
The skewness.
</para></listitem><listitem><para><literal>SESKEW</literal>
The standard error of the skewness.
</para></listitem><listitem><para><literal>KURT</literal>
The kurtosis
</para></listitem><listitem><para><literal>SEKURT</literal>
The standard error of the kurtosis.
</para></listitem><listitem><para><literal>HARMONIC</literal>
<indexterm role="cp"><primary>harmonic mean</primary></indexterm>
The harmonic mean.
</para></listitem><listitem><para><literal>GEOMETRIC</literal>
<indexterm role="cp"><primary>geometric mean</primary></indexterm>
The geometric mean.
</para></listitem></itemizedlist>
<para>In addition, three special keywords are recognized:
</para><itemizedlist><listitem><para><literal>DEFAULT</literal>
This is the same as <literal>MEAN</literal> <literal>COUNT</literal> <literal>STDDEV</literal>.
</para></listitem><listitem><para><literal>ALL</literal>
All of the above statistics are calculated.
</para></listitem><listitem><para><literal>NONE</literal>
No statistics are calculated (only a summary is shown).
</para></listitem></itemizedlist>
<para>More than one <firstterm>table</firstterm> can be specified in a single command.
Each table is separated by a ‘<literal>/</literal>’. For
example
</para><screen>MEANS TABLES =
<replaceable>c</replaceable> <replaceable>d</replaceable> <replaceable>e</replaceable> BY <replaceable>x</replaceable>
/<replaceable>a</replaceable> <replaceable>b</replaceable> BY <replaceable>x</replaceable> <replaceable>y</replaceable>
/<replaceable>f</replaceable> BY <replaceable>y</replaceable> BY <replaceable>z</replaceable>.
</screen><para>has three tables (the ‘<literal>TABLE =</literal>’ is optional).
The first table has three dependent variables <replaceable>c</replaceable>, <replaceable>d</replaceable> and <replaceable>e</replaceable>
and a single categorical variable <replaceable>x</replaceable>.
The second table has two dependent variables <replaceable>a</replaceable> and <replaceable>b</replaceable>,
and two categorical variables <replaceable>x</replaceable> and <replaceable>y</replaceable>.
The third table has a single dependent variables <replaceable>f</replaceable>
and a categorical variable formed by the combination of <replaceable>y</replaceable> and <replaceable>z</replaceable>.
</para>
<para>By default values are omitted from the analysis only if missing values
(either system missing or user missing)
for any of the variables directly involved in their calculation are
encountered.
This behaviour can be modified with the <literal>/MISSING</literal> subcommand.
Three options are possible: <literal>TABLE</literal>, <literal>INCLUDE</literal> and <literal>DEPENDENT</literal>.
</para>
<para><literal>/MISSING = INCLUDE</literal> says that user missing values, either in the dependent
variables or in the categorical variables should be taken at their face
value, and not excluded.
</para>
<para><literal>/MISSING = DEPENDENT</literal> says that user missing values, in the dependent
variables should be taken at their face value, however cases which
have user missing values for the categorical variables should be omitted
from the calculation.
</para>
<sect2 label="15.11.1">
<title>Example Means</title>
<para>The dataset in <filename>repairs.sav</filename> contains the mean time between failures (<emphasis role="bold">mtbf</emphasis>)
for a sample of artifacts produced by different factories and trialed under
different operating conditions.
Since there are four combinations of categorical variables, by simply looking
at the list of data, it would be hard to how the scores vary for each category.
<link linkend="means_003aex">means:ex</link> shows one way of tabulating the <emphasis role="bold">mtbf</emphasis> in a way which is
easier to understand.
</para>
<anchor id="means_003aex"/>
<sidebar><screen>get file='repairs.sav'.
means tables = mtbf
by factory by environment.
</screen></sidebar>
<para>The results are shown in <link linkend="means_003ares">means:res</link>. The figures shown indicate the mean,
standard deviation and number of samples in each category.
These figures however do not indicate whether the results are statistically
significant. For that, you would need to use the procedures <literal>ONEWAY</literal>, <literal>GLM</literal> or
<literal>T-TEST</literal> depending on the hypothesis being tested.
</para>
<anchor id="means_003ares"/>
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Case Processing Summary
+----------------------------+-------------------------------+
| | Cases |
| +----------+---------+----------+
| | Included | Excluded| Total |
| +--+-------+-+-------+--+-------+
| | N|Percent|N|Percent| N|Percent|
+----------------------------+--+-------+-+-------+--+-------+
|mtbf * factory * environment|30| 100.0%|0| .0%|30| 100.0%|
+----------------------------+--+-------+-+-------+--+-------+
Report
+--------------------------------------------+-----+--+--------------+
|Manufacturing facility Operating Environment| Mean| N|Std. Deviation|
+--------------------------------------------+-----+--+--------------+
|0 Temperate | 7.26| 9| 2.57|
| Tropical | 7.47| 7| 2.68|
| Total | 7.35|16| 2.53|
+--------------------------------------------+-----+--+--------------+
|1 Temperate |13.38| 6| 7.77|
| Tropical | 8.20| 8| 8.39|
| Total |10.42|14| 8.26|
+--------------------------------------------+-----+--+--------------+
|Total Temperate | 9.71|15| 5.91|
| Tropical | 7.86|15| 6.20|
| Total | 8.78|30| 6.03|
+--------------------------------------------+-----+--+--------------+
</screen>
<para>Note that there is no limit to the number of variables for which you can calculate
statistics, nor to the number of categorical variables per layer, nor the number
of layers.
However, running <literal>MEANS</literal> on a large numbers of variables, or with categorical variables
containing a large number of distinct values may result in an extremely large output, which
will not be easy to interpret.
So you should consider carefully which variables to select for participation in the analysis.
</para>
</sect2>
</sect1>
<sect1 label="15.12" id="NPAR-TESTS">
<title>NPAR TESTS</title>
<indexterm role="vr"><primary>NPAR TESTS</primary></indexterm>
<indexterm role="cp"><primary>nonparametric tests</primary></indexterm>
<literallayout>NPAR TESTS
nonparametric test subcommands
.
.
.
[ /STATISTICS={DESCRIPTIVES} ]
[ /MISSING={ANALYSIS, LISTWISE} {INCLUDE, EXCLUDE} ]
[ /METHOD=EXACT [ TIMER [(<replaceable>n</replaceable>)] ] ]
</literallayout>
<para><literal>NPAR TESTS</literal> performs nonparametric tests.
Non parametric tests make very few assumptions about the distribution of the
data.
One or more tests may be specified by using the corresponding subcommand.
If the <literal>/STATISTICS</literal> subcommand is also specified, then summary statistics are
produces for each variable that is the subject of any test.
</para>
<para>Certain tests may take a long time to execute, if an exact figure is required.
Therefore, by default asymptotic approximations are used unless the
subcommand <literal>/METHOD=EXACT</literal> is specified.
Exact tests give more accurate results, but may take an unacceptably long
time to perform. If the <literal>TIMER</literal> keyword is used, it sets a maximum time,
after which the test is abandoned, and a warning message printed.
The time, in minutes, should be specified in parentheses after the <literal>TIMER</literal> keyword.
If the <literal>TIMER</literal> keyword is given without this figure, then a default value of 5 minutes
is used.
</para>
<sect2 label="15.12.1" id="BINOMIAL">
<title>Binomial test</title>
<indexterm role="vr"><primary>BINOMIAL</primary></indexterm>
<indexterm role="cp"><primary>binomial test</primary></indexterm>
<literallayout> [ /BINOMIAL[(<replaceable>p</replaceable>)]=<replaceable>var_list</replaceable>[(<replaceable>value1</replaceable>[, <replaceable>value2</replaceable>)] ] ]
</literallayout>
<para>The <literal>/BINOMIAL</literal> subcommand compares the observed distribution of a dichotomous
variable with that of a binomial distribution.
The variable <replaceable>p</replaceable> specifies the test proportion of the binomial
distribution.
The default value of 0.5 is assumed if <replaceable>p</replaceable> is omitted.
</para>
<para>If a single value appears after the variable list, then that value is
used as the threshold to partition the observed values. Values less
than or equal to the threshold value form the first category. Values
greater than the threshold form the second category.
</para>
<para>If two values appear after the variable list, then they are used
as the values which a variable must take to be in the respective
category.
Cases for which a variable takes a value equal to neither of the specified
values, take no part in the test for that variable.
</para>
<para>If no values appear, then the variable must assume dichotomous
values.
If more than two distinct, non-missing values for a variable
under test are encountered then an error occurs.
</para>
<para>If the test proportion is equal to 0.5, then a two-tailed test is
reported. For any other test proportion, a one-tailed test is
reported.
For one-tailed tests, if the test proportion is less than
or equal to the observed proportion, then the significance of
observing the observed proportion or more is reported.
If the test proportion is more than the observed proportion, then the
significance of observing the observed proportion or less is reported.
That is to say, the test is always performed in the observed
direction.
</para>
<para>PSPP uses a very precise approximation to the gamma function to
compute the binomial significance. Thus, exact results are reported
even for very large sample sizes.
</para>
</sect2>
<sect2 label="15.12.2" id="CHISQUARE">
<title>Chi-square Test</title>
<indexterm role="vr"><primary>CHISQUARE</primary></indexterm>
<indexterm role="cp"><primary>chi-square test</primary></indexterm>
<literallayout> [ /CHISQUARE=<replaceable>var_list</replaceable>[(<replaceable>lo</replaceable>,<replaceable>hi</replaceable>)] [/EXPECTED={EQUAL|<replaceable>f1</replaceable>, <replaceable>f2</replaceable> … <replaceable>fn</replaceable>}] ]
</literallayout>
<para>The <literal>/CHISQUARE</literal> subcommand produces a chi-square statistic for the differences
between the expected and observed frequencies of the categories of a variable.
Optionally, a range of values may appear after the variable list.
If a range is given, then non integer values are truncated, and values
outside the specified range are excluded from the analysis.
</para>
<para>The <literal>/EXPECTED</literal> subcommand specifies the expected values of each
category.
There must be exactly one non-zero expected value, for each observed
category, or the <literal>EQUAL</literal> keyword must be specified.
You may use the notation <literal><replaceable>n</replaceable>*<replaceable>f</replaceable></literal> to specify <replaceable>n</replaceable>
consecutive expected categories all taking a frequency of <replaceable>f</replaceable>.
The frequencies given are proportions, not absolute frequencies. The
sum of the frequencies need not be 1.
If no <literal>/EXPECTED</literal> subcommand is given, then equal frequencies
are expected.
</para>
<sect3 label="15.12.2.1">
<title>Chi-square Example</title>
<para>A researcher wishes to investigate whether there are an equal number of
persons of each sex in a population. The sample chosen for invesigation
is that from the <filename>physiology.sav</filename> dataset. The null hypothesis for
the test is that the population comprises an equal number of males and females.
The analysis is performed as shown in <link linkend="chisquare_003aex">chisquare:ex</link>.
</para>
<anchor id="chisquare_003aex"/>
<sidebar><screen>get file='physiology.sav'.
npar test
/chisquare=sex.
</screen></sidebar>
<para>There is only one test variable, <emphasis>viz:</emphasis> <emphasis role="bold">sex</emphasis>. The other variables in the dataset
are ignored.
</para>
<anchor id="chisquare_003ascr"/>
<sidebar></sidebar>
<para>In <link linkend="chisquare_003ares">chisquare:res</link> the summary box shows that in the sample, there are more males
than females. However the significance of chi-square result is greater than 0.05
— the most commonly accepted p-value — and therefore
there is not enough evidence to reject the null hypothesis and one must conclude
that the evidence does not indicate that there is an imbalance of the sexes
in the population.
</para>
<anchor id="chisquare_003ares"/>
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Sex of subject
+------+----------+----------+--------+
|Value |Observed N|Expected N|Residual|
+------+----------+----------+--------+
|Male | 22| 20.00| 2.00|
|Female| 18| 20.00| -2.00|
|Total | 40| | |
+------+----------+----------+--------+
Test Statistics
+--------------+----------+--+-----------+
| |Chi-square|df|Asymp. Sig.|
+--------------+----------+--+-----------+
|Sex of subject| .40| 1| .527|
+--------------+----------+--+-----------+
</screen>
</sect3>
</sect2>
<sect2 label="15.12.3" id="COCHRAN">
<title>Cochran Q Test</title>
<indexterm role="vr"><primary>Cochran</primary></indexterm>
<indexterm role="cp"><primary>Cochran Q test</primary></indexterm>
<indexterm role="cp"><primary>Q, Cochran Q</primary></indexterm>
<literallayout> [ /COCHRAN = <replaceable>var_list</replaceable> ]
</literallayout>
<para>The Cochran Q test is used to test for differences between three or more groups.
The data for <replaceable>var_list</replaceable> in all cases must assume exactly two
distinct values (other than missing values).
</para>
<para>The value of Q is displayed along with its Asymptotic significance
based on a chi-square distribution.
</para>
</sect2>
<sect2 label="15.12.4" id="FRIEDMAN">
<title>Friedman Test</title>
<indexterm role="vr"><primary>FRIEDMAN</primary></indexterm>
<indexterm role="cp"><primary>Friedman test</primary></indexterm>
<literallayout> [ /FRIEDMAN = <replaceable>var_list</replaceable> ]
</literallayout>
<para>The Friedman test is used to test for differences between repeated measures when
there is no indication that the distributions are normally distributed.
</para>
<para>A list of variables which contain the measured data must be given. The procedure
prints the sum of ranks for each variable, the test statistic and its significance.
</para>
</sect2>
<sect2 label="15.12.5" id="KENDALL">
<title>Kendall’s W Test</title>
<indexterm role="vr"><primary>KENDALL</primary></indexterm>
<indexterm role="cp"><primary>Kendall’s W test</primary></indexterm>
<indexterm role="cp"><primary>coefficient of concordance</primary></indexterm>
<literallayout> [ /KENDALL = <replaceable>var_list</replaceable> ]
</literallayout>
<para>The Kendall test investigates whether an arbitrary number of related samples come from the
same population.
It is identical to the Friedman test except that the additional statistic W, Kendall’s Coefficient of Concordance is printed.
It has the range [0,1] — a value of zero indicates no agreement between the samples whereas a value of
unity indicates complete agreement.
</para>
</sect2>
<sect2 label="15.12.6" id="KOLMOGOROV_002dSMIRNOV">
<title>Kolmogorov-Smirnov Test</title>
<indexterm role="vr"><primary>KOLMOGOROV-SMIRNOV</primary></indexterm>
<indexterm role="vr"><primary>K-S</primary></indexterm>
<indexterm role="cp"><primary>Kolmogorov-Smirnov test</primary></indexterm>
<literallayout> [ /KOLMOGOROV-SMIRNOV ({NORMAL [<replaceable>mu</replaceable>, <replaceable>sigma</replaceable>], UNIFORM [<replaceable>min</replaceable>, <replaceable>max</replaceable>], POISSON [<replaceable>lambda</replaceable>], EXPONENTIAL [<replaceable>scale</replaceable>] }) = <replaceable>var_list</replaceable> ]
</literallayout>
<para>The one-sample Kolmogorov-Smirnov subcommand is used to test whether or not a dataset is
drawn from a particular distribution. Four distributions are supported, <emphasis>viz:</emphasis>
Normal, Uniform, Poisson and Exponential.
</para>
<para>Ideally you should provide the parameters of the distribution against
which you wish to test the data. For example, with the normal
distribution the mean (<replaceable>mu</replaceable>)and standard deviation (<replaceable>sigma</replaceable>)
should be given; with the uniform distribution, the minimum
(<replaceable>min</replaceable>)and maximum (<replaceable>max</replaceable>) value should be provided.
However, if the parameters are omitted they are imputed from the
data. Imputing the parameters reduces the power of the test so should
be avoided if possible.
</para>
<para>In the following example, two variables <replaceable>score</replaceable> and <replaceable>age</replaceable> are
tested to see if they follow a normal distribution with a mean of 3.5
and a standard deviation of 2.0.
</para><screen> NPAR TESTS
/KOLMOGOROV-SMIRNOV (normal 3.5 2.0) = <replaceable>score</replaceable> <replaceable>age</replaceable>.
</screen><para>If the variables need to be tested against different distributions, then a separate
subcommand must be used. For example the following syntax tests <replaceable>score</replaceable> against
a normal distribution with mean of 3.5 and standard deviation of 2.0 whilst <replaceable>age</replaceable>
is tested against a normal distribution of mean 40 and standard deviation 1.5.
</para><screen> NPAR TESTS
/KOLMOGOROV-SMIRNOV (normal 3.5 2.0) = <replaceable>score</replaceable>
/KOLMOGOROV-SMIRNOV (normal 40 1.5) = <replaceable>age</replaceable>.
</screen>
<para>The abbreviated subcommand <literal>K-S</literal> may be used in place of <literal>KOLMOGOROV-SMIRNOV</literal>.
</para>
</sect2>
<sect2 label="15.12.7" id="KRUSKAL_002dWALLIS">
<title>Kruskal-Wallis Test</title>
<indexterm role="vr"><primary>KRUSKAL-WALLIS</primary></indexterm>
<indexterm role="vr"><primary>K-W</primary></indexterm>
<indexterm role="cp"><primary>Kruskal-Wallis test</primary></indexterm>
<literallayout> [ /KRUSKAL-WALLIS = <replaceable>var_list</replaceable> BY var (<replaceable>lower</replaceable>, <replaceable>upper</replaceable>) ]
</literallayout>
<para>The Kruskal-Wallis test is used to compare data from an
arbitrary number of populations. It does not assume normality.
The data to be compared are specified by <replaceable>var_list</replaceable>.
The categorical variable determining the groups to which the
data belongs is given by <replaceable>var</replaceable>. The limits <replaceable>lower</replaceable> and
<replaceable>upper</replaceable> specify the valid range of <replaceable>var</replaceable>.
If <replaceable>upper</replaceable> is smaller than <replaceable>lower</replaceable>, the PSPP will assume their values
to be reversed. Any cases for which <replaceable>var</replaceable> falls outside
[<replaceable>lower</replaceable>, <replaceable>upper</replaceable>] are ignored.
</para>
<para>The mean rank of each group as well as the chi-squared value and
significance of the test are printed.
The abbreviated subcommand <literal>K-W</literal> may be used in place of
<literal>KRUSKAL-WALLIS</literal>.
</para>
</sect2>
<sect2 label="15.12.8" id="MANN_002dWHITNEY">
<title>Mann-Whitney U Test</title>
<indexterm role="vr"><primary>MANN-WHITNEY</primary></indexterm>
<indexterm role="vr"><primary>M-W</primary></indexterm>
<indexterm role="cp"><primary>Mann-Whitney U test</primary></indexterm>
<indexterm role="cp"><primary>U, Mann-Whitney U</primary></indexterm>
<literallayout> [ /MANN-WHITNEY = <replaceable>var_list</replaceable> BY var (<replaceable>group1</replaceable>, <replaceable>group2</replaceable>) ]
</literallayout>
<para>The Mann-Whitney subcommand is used to test whether two groups of data
come from different populations. The variables to be tested should be
specified in <replaceable>var_list</replaceable> and the grouping variable, that determines
to which group the test variables belong, in <replaceable>var</replaceable>.
<replaceable>Var</replaceable> may be either a string or an alpha variable.
<replaceable>Group1</replaceable> and <replaceable>group2</replaceable> specify the
two values of <replaceable>var</replaceable> which determine the groups of the test data.
Cases for which the <replaceable>var</replaceable> value is neither <replaceable>group1</replaceable> or
<replaceable>group2</replaceable> are ignored.
</para>
<para>The value of the Mann-Whitney U statistic, the Wilcoxon W, and the
significance are printed.
You may abbreviated the subcommand <literal>MANN-WHITNEY</literal> to
<literal>M-W</literal>.
</para>
</sect2>
<sect2 label="15.12.9" id="MCNEMAR">
<title>McNemar Test</title>
<indexterm role="vr"><primary>MCNEMAR</primary></indexterm>
<indexterm role="cp"><primary>McNemar test</primary></indexterm>
<literallayout> [ /MCNEMAR <replaceable>var_list</replaceable> [ WITH <replaceable>var_list</replaceable> [ (PAIRED) ]]]
</literallayout>
<para>Use McNemar’s test to analyse the significance of the difference between
pairs of correlated proportions.
</para>
<para>If the <literal>WITH</literal> keyword is omitted, then tests for all
combinations of the listed variables are performed.
If the <literal>WITH</literal> keyword is given, and the <literal>(PAIRED)</literal> keyword
is also given, then the number of variables preceding <literal>WITH</literal>
must be the same as the number following it.
In this case, tests for each respective pair of variables are
performed.
If the <literal>WITH</literal> keyword is given, but the
<literal>(PAIRED)</literal> keyword is omitted, then tests for each combination
of variable preceding <literal>WITH</literal> against variable following
<literal>WITH</literal> are performed.
</para>
<para>The data in each variable must be dichotomous. If there are more
than two distinct variables an error will occur and the test will
not be run.
</para>
</sect2>
<sect2 label="15.12.10" id="MEDIAN">
<title>Median Test</title>
<indexterm role="vr"><primary>MEDIAN</primary></indexterm>
<indexterm role="cp"><primary>Median test</primary></indexterm>
<literallayout> [ /MEDIAN [(<replaceable>value</replaceable>)] = <replaceable>var_list</replaceable> BY <replaceable>variable</replaceable> (<replaceable>value1</replaceable>, <replaceable>value2</replaceable>) ]
</literallayout>
<para>The median test is used to test whether independent samples come from
populations with a common median.
The median of the populations against which the samples are to be tested
may be given in parentheses immediately after the
<literal>/MEDIAN</literal> subcommand. If it is not given, the median is imputed from the
union of all the samples.
</para>
<para>The variables of the samples to be tested should immediately follow the ‘<literal>=</literal>’ sign. The
keyword <literal>BY</literal> must come next, and then the grouping variable. Two values
in parentheses should follow. If the first value is greater than the second,
then a 2 sample test is performed using these two values to determine the groups.
If however, the first variable is less than the second, then a <emphasis>k</emphasis> sample test is
conducted and the group values used are all values encountered which lie in the
range [<replaceable>value1</replaceable>,<replaceable>value2</replaceable>].
</para>
</sect2>
<sect2 label="15.12.11" id="RUNS">
<title>Runs Test</title>
<indexterm role="vr"><primary>RUNS</primary></indexterm>
<indexterm role="cp"><primary>runs test</primary></indexterm>
<literallayout> [ /RUNS ({MEAN, MEDIAN, MODE, <replaceable>value</replaceable>}) = <replaceable>var_list</replaceable> ]
</literallayout>
<para>The <literal>/RUNS</literal> subcommand tests whether a data sequence is randomly ordered.
</para>
<para>It works by examining the number of times a variable’s value crosses a given threshold.
The desired threshold must be specified within parentheses.
It may either be specified as a number or as one of <literal>MEAN</literal>, <literal>MEDIAN</literal> or <literal>MODE</literal>.
Following the threshold specification comes the list of variables whose values are to be
tested.
</para>
<para>The subcommand shows the number of runs, the asymptotic significance based on the
length of the data.
</para>
</sect2>
<sect2 label="15.12.12" id="SIGN">
<title>Sign Test</title>
<indexterm role="vr"><primary>SIGN</primary></indexterm>
<indexterm role="cp"><primary>sign test</primary></indexterm>
<literallayout> [ /SIGN <replaceable>var_list</replaceable> [ WITH <replaceable>var_list</replaceable> [ (PAIRED) ]]]
</literallayout>
<para>The <literal>/SIGN</literal> subcommand tests for differences between medians of the
variables listed.
The test does not make any assumptions about the
distribution of the data.
</para>
<para>If the <literal>WITH</literal> keyword is omitted, then tests for all
combinations of the listed variables are performed.
If the <literal>WITH</literal> keyword is given, and the <literal>(PAIRED)</literal> keyword
is also given, then the number of variables preceding <literal>WITH</literal>
must be the same as the number following it.
In this case, tests for each respective pair of variables are
performed.
If the <literal>WITH</literal> keyword is given, but the
<literal>(PAIRED)</literal> keyword is omitted, then tests for each combination
of variable preceding <literal>WITH</literal> against variable following
<literal>WITH</literal> are performed.
</para>
</sect2>
<sect2 label="15.12.13" id="WILCOXON">
<title>Wilcoxon Matched Pairs Signed Ranks Test</title>
<indexterm role="vr"><primary>WILCOXON</primary></indexterm>
<indexterm role="cp"><primary>wilcoxon matched pairs signed ranks test</primary></indexterm>
<literallayout> [ /WILCOXON <replaceable>var_list</replaceable> [ WITH <replaceable>var_list</replaceable> [ (PAIRED) ]]]
</literallayout>
<para>The <literal>/WILCOXON</literal> subcommand tests for differences between medians of the
variables listed.
The test does not make any assumptions about the variances of the samples.
It does however assume that the distribution is symmetrical.
</para>
<para>If the <literal>WITH</literal> keyword is omitted, then tests for all
combinations of the listed variables are performed.
If the <literal>WITH</literal> keyword is given, and the <literal>(PAIRED)</literal> keyword
is also given, then the number of variables preceding <literal>WITH</literal>
must be the same as the number following it.
In this case, tests for each respective pair of variables are
performed.
If the <literal>WITH</literal> keyword is given, but the
<literal>(PAIRED)</literal> keyword is omitted, then tests for each combination
of variable preceding <literal>WITH</literal> against variable following
<literal>WITH</literal> are performed.
</para>
</sect2>
</sect1>
<sect1 label="15.13" id="T_002dTEST">
<title>T-TEST</title>
<indexterm role="vr"><primary>T-TEST</primary></indexterm>
<literallayout>T-TEST
/MISSING={ANALYSIS,LISTWISE} {EXCLUDE,INCLUDE}
/CRITERIA=CI(<replaceable>confidence</replaceable>)
(One Sample mode.)
TESTVAL=<replaceable>test_value</replaceable>
/VARIABLES=<replaceable>var_list</replaceable>
(Independent Samples mode.)
GROUPS=var(<replaceable>value1</replaceable> [, <replaceable>value2</replaceable>])
/VARIABLES=<replaceable>var_list</replaceable>
(Paired Samples mode.)
PAIRS=<replaceable>var_list</replaceable> [WITH <replaceable>var_list</replaceable> [(PAIRED)] ]
</literallayout>
<para>The <literal>T-TEST</literal> procedure outputs tables used in testing hypotheses about
means.
It operates in one of three modes:
</para><itemizedlist><listitem><para>One Sample mode.
</para></listitem><listitem><para>Independent Groups mode.
</para></listitem><listitem><para>Paired mode.
</para></listitem></itemizedlist>
<para>Each of these modes are described in more detail below.
There are two optional subcommands which are common to all modes.
</para>
<para>The <literal>/CRITERIA</literal> subcommand tells PSPP the confidence interval used
in the tests. The default value is 0.95.
</para>
<para>The <literal>MISSING</literal> subcommand determines the handling of missing
variables.
If <literal>INCLUDE</literal> is set, then user-missing values are included in the
calculations, but system-missing values are not.
If <literal>EXCLUDE</literal> is set, which is the default, user-missing
values are excluded as well as system-missing values.
This is the default.
</para>
<para>If <literal>LISTWISE</literal> is set, then the entire case is excluded from analysis
whenever any variable specified in the <literal>/VARIABLES</literal>, <literal>/PAIRS</literal> or
<literal>/GROUPS</literal> subcommands contains a missing value.
If <literal>ANALYSIS</literal> is set, then missing values are excluded only in the analysis for
which they would be needed. This is the default.
</para>
<sect2 label="15.13.1" id="One-Sample-Mode">
<title>One Sample Mode</title>
<para>The <literal>TESTVAL</literal> subcommand invokes the One Sample mode.
This mode is used to test a population mean against a hypothesized
mean.
The value given to the <literal>TESTVAL</literal> subcommand is the value against
which you wish to test.
In this mode, you must also use the <literal>/VARIABLES</literal> subcommand to
tell PSPP which variables you wish to test.
</para>
<sect3 label="15.13.1.1">
<title>Example - One-Sample T-test</title>
<para>A researcher wishes to know whether the weight of persons in a population
is different from the national average.
The samples are drawn from the population under investigation and recorded
in the file <filename>physiology.sav</filename>.
From the Department of Health, she
knows that the national average weight of healthy adults is 76.8kg.
Accordingly the <literal>TESTVAL</literal> is set to 76.8.
The null hypothesis therefore is that the mean average weight of the
population from which the sample was drawn is 76.8kg.
</para>
<para>As previously noted (see <link linkend="Identifying-incorrect-data">Identifying incorrect data</link>), one
sample in the dataset contains a weight value
which is clearly incorrect. So this is excluded from the analysis
using the <literal>SELECT</literal> command.
</para>
<anchor id="one_002dsample_002dt_003aex"/>
<sidebar><screen>get file='physiology.sav'.
select if (weight > 0).
t-test testval = 76.8
/variables = weight.
</screen></sidebar>
<anchor id="one_002dsample_002dt_003ascr"/>
<sidebar></sidebar>
<para><link linkend="one_002dsample_002dt_003ares">one-sample-t:res</link> shows that the mean of our sample differs from the test value
by -1.40kg. However the significance is very high (0.610). So one cannot
reject the null hypothesis, and must conclude there is not enough evidence
to suggest that the mean weight of the persons in our population is different
from 76.8kg.
</para>
<anchor id="one_002dsample_002dt_003ares"/>
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> One-Sample Statistics
+-------------------+--+-----+--------------+---------+
| | N| Mean|Std. Deviation|S.E. Mean|
+-------------------+--+-----+--------------+---------+
|Weight in kilograms|39|75.40| 17.08| 2.73|
+-------------------+--+-----+--------------+---------+
One-Sample Test
+--------------+--------------------------------------------------------------+
| | Test Value = 76.8 |
| +----+--+------------+------------+----------------------------+
| | | | | | 95% Confidence Interval of |
| | | | | | the Difference |
| | | | Sig. (2- | Mean +--------------+-------------+
| | t |df| tailed) | Difference | Lower | Upper |
+--------------+----+--+------------+------------+--------------+-------------+
|Weight in |-.51|38| .610| -1.40| -6.94| 4.13|
|kilograms | | | | | | |
+--------------+----+--+------------+------------+--------------+-------------+
</screen>
</sect3>
</sect2>
<sect2 label="15.13.2" id="Independent-Samples-Mode">
<title>Independent Samples Mode</title>
<para>The <literal>GROUPS</literal> subcommand invokes Independent Samples mode or
‘Groups’ mode.
This mode is used to test whether two groups of values have the
same population mean.
In this mode, you must also use the <literal>/VARIABLES</literal> subcommand to
tell PSPP the dependent variables you wish to test.
</para>
<para>The variable given in the <literal>GROUPS</literal> subcommand is the independent
variable which determines to which group the samples belong.
The values in parentheses are the specific values of the independent
variable for each group.
If the parentheses are omitted and no values are given, the default values
of 1.0 and 2.0 are assumed.
</para>
<para>If the independent variable is numeric,
it is acceptable to specify only one value inside the parentheses.
If you do this, cases where the independent variable is
greater than or equal to this value belong to the first group, and cases
less than this value belong to the second group.
When using this form of the <literal>GROUPS</literal> subcommand, missing values in
the independent variable are excluded on a listwise basis, regardless
of whether <literal>/MISSING=LISTWISE</literal> was specified.
</para>
<sect3 label="15.13.2.1">
<title>Example - Independent Samples T-test</title>
<para>A researcher wishes to know whether within a population, adult males
are taller than adult females.
The samples are drawn from the population under investigation and recorded
in the file <filename>physiology.sav</filename>.
</para>
<para>As previously noted (see <link linkend="Identifying-incorrect-data">Identifying incorrect data</link>), one
sample in the dataset contains a height value
which is clearly incorrect. So this is excluded from the analysis
using the <literal>SELECT</literal> command.
</para>
<anchor id="indepdendent_002dsamples_002dt_003aex"/>
<sidebar><screen>get file='physiology.sav'.
select if (height >= 200).
t-test /variables = height
/groups = sex(0,1).
</screen></sidebar>
<para>The null hypothesis is that both males and females are on average
of equal height.
</para>
<anchor id="independent_002dsamples_002dt_003ascr"/>
<sidebar></sidebar>
<para>In this case, the grouping variable is <emphasis role="bold">sex</emphasis>, so this is entered
as the variable for the <literal>GROUP</literal> subcommand. The group values are 0 (male) and
1 (female).
</para>
<para>If you are running the proceedure using syntax, then you need to enter
the values corresponding to each group within parentheses.
If you are using the graphic user interface, then you have to open
the “Define Groups” dialog box and enter the values corresponding
to each group as shown in <link linkend="define_002dgroups_002dt_003ascr">define-groups-t:scr</link>. If, as in this case, the dataset has defined value
labels for the group variable, then you can enter them by label
or by value.
</para>
<anchor id="define_002dgroups_002dt_003ascr"/>
<sidebar></sidebar>
<para>From <link linkend="independent_002dsamples_002dt_003ares">independent-samples-t:res</link>, one can clearly see that the <emphasis>sample</emphasis> mean height
is greater for males than for females. However in order to see if this
is a significant result, one must consult the T-Test table.
</para>
<para>The T-Test table contains two rows; one for use if the variance of the samples
in each group may be safely assumed to be equal, and the second row
if the variances in each group may not be safely assumed to be equal.
</para>
<para>In this case however, both rows show a 2-tailed significance less than 0.001 and
one must therefore reject the null hypothesis and conclude that within
the population the mean height of males and of females are unequal.
</para>
<anchor id="independent_002dsamples_002dt_003ares"/>
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> Group Statistics
+----------------------------+--+-------+--------------+---------+
| Group | N| Mean |Std. Deviation|S.E. Mean|
+----------------------------+--+-------+--------------+---------+
|Height in millimeters Male |22|1796.49| 49.71| 10.60|
| Female|17|1610.77| 25.43| 6.17|
+----------------------------+--+-------+--------------+---------+
Independent Samples Test
+---------------------+----------+------------------------------------------
| | Levene's |
| | Test for |
| | Equality |
| | of |
| | Variances| T-Test for Equality of Means
| +----+-----+-----+-----+-------+----------+----------+
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | Sig. | | |
| | | | | | (2- | Mean |Std. Error|
| | F | Sig.| t | df |tailed)|Difference|Difference|
+---------------------+----+-----+-----+-----+-------+----------+----------+
|Height in Equal | .97| .331|14.02|37.00| .000| 185.72| 13.24|
|millimeters variances| | | | | | | |
| assumed | | | | | | | |
| Equal | | |15.15|32.71| .000| 185.72| 12.26|
| variances| | | | | | | |
| not | | | | | | | |
| assumed | | | | | | | |
+---------------------+----+-----+-----+-----+-------+----------+----------+
+---------------------+-------------+
| | |
| | |
| | |
| | |
| | |
| +-------------+
| | 95% |
| | Confidence |
| | Interval of |
| | the |
| | Difference |
| +------+------+
| | Lower| Upper|
+---------------------+------+------+
|Height in Equal |158.88|212.55|
|millimeters variances| | |
| assumed | | |
| Equal |160.76|210.67|
| variances| | |
| not | | |
| assumed | | |
+---------------------+------+------+
</screen>
</sect3>
</sect2>
<sect2 label="15.13.3" id="Paired-Samples-Mode">
<title>Paired Samples Mode</title>
<para>The <literal>PAIRS</literal> subcommand introduces Paired Samples mode.
Use this mode when repeated measures have been taken from the same
samples.
If the <literal>WITH</literal> keyword is omitted, then tables for all
combinations of variables given in the <literal>PAIRS</literal> subcommand are
generated.
If the <literal>WITH</literal> keyword is given, and the <literal>(PAIRED)</literal> keyword
is also given, then the number of variables preceding <literal>WITH</literal>
must be the same as the number following it.
In this case, tables for each respective pair of variables are
generated.
In the event that the <literal>WITH</literal> keyword is given, but the
<literal>(PAIRED)</literal> keyword is omitted, then tables for each combination
of variable preceding <literal>WITH</literal> against variable following
<literal>WITH</literal> are generated.
</para>
</sect2>
</sect1>
<sect1 label="15.14" id="ONEWAY">
<title>ONEWAY</title>
<indexterm role="vr"><primary>ONEWAY</primary></indexterm>
<indexterm role="cp"><primary>analysis of variance</primary></indexterm>
<indexterm role="cp"><primary>ANOVA</primary></indexterm>
<literallayout>ONEWAY
[/VARIABLES = ] <replaceable>var_list</replaceable> BY <replaceable>var</replaceable>
/MISSING={ANALYSIS,LISTWISE} {EXCLUDE,INCLUDE}
/CONTRAST= <replaceable>value1</replaceable> [, <replaceable>value2</replaceable>] ... [,<replaceable>valueN</replaceable>]
/STATISTICS={DESCRIPTIVES,HOMOGENEITY}
/POSTHOC={BONFERRONI, GH, LSD, SCHEFFE, SIDAK, TUKEY, ALPHA ([<replaceable>value</replaceable>])}
</literallayout>
<para>The <literal>ONEWAY</literal> procedure performs a one-way analysis of variance of
variables factored by a single independent variable.
It is used to compare the means of a population
divided into more than two groups.
</para>
<para>The dependent variables to be analysed should be given in the <literal>VARIABLES</literal>
subcommand.
The list of variables must be followed by the <literal>BY</literal> keyword and
the name of the independent (or factor) variable.
</para>
<para>You can use the <literal>STATISTICS</literal> subcommand to tell PSPP to display
ancillary information. The options accepted are:
</para><itemizedlist><listitem><para>DESCRIPTIVES
Displays descriptive statistics about the groups factored by the independent
variable.
</para></listitem><listitem><para>HOMOGENEITY
Displays the Levene test of Homogeneity of Variance for the
variables and their groups.
</para></listitem></itemizedlist>
<para>The <literal>CONTRAST</literal> subcommand is used when you anticipate certain
differences between the groups.
The subcommand must be followed by a list of numerals which are the
coefficients of the groups to be tested.
The number of coefficients must correspond to the number of distinct
groups (or values of the independent variable).
If the total sum of the coefficients are not zero, then PSPP will
display a warning, but will proceed with the analysis.
The <literal>CONTRAST</literal> subcommand may be given up to 10 times in order
to specify different contrast tests.
The <literal>MISSING</literal> subcommand defines how missing values are handled.
If <literal>LISTWISE</literal> is specified then cases which have missing values for
the independent variable or any dependent variable are ignored.
If <literal>ANALYSIS</literal> is specified, then cases are ignored if the independent
variable is missing or if the dependent variable currently being
analysed is missing. The default is <literal>ANALYSIS</literal>.
A setting of <literal>EXCLUDE</literal> means that variables whose values are
user-missing are to be excluded from the analysis. A setting of
<literal>INCLUDE</literal> means they are to be included. The default is <literal>EXCLUDE</literal>.
</para>
<para>Using the <literal>POSTHOC</literal> subcommand you can perform multiple
pairwise comparisons on the data. The following comparison methods
are available:
</para><itemizedlist><listitem><para><literal>LSD</literal>
Least Significant Difference.
</para></listitem><listitem><para><literal>TUKEY</literal>
Tukey Honestly Significant Difference.
</para></listitem><listitem><para><literal>BONFERRONI</literal>
Bonferroni test.
</para></listitem><listitem><para><literal>SCHEFFE</literal>
Scheffé’s test.
</para></listitem><listitem><para><literal>SIDAK</literal>
Sidak test.
</para></listitem><listitem><para><literal>GH</literal>
The Games-Howell test.
</para></listitem></itemizedlist>
<para>Use the optional syntax <literal>ALPHA(<replaceable>value</replaceable>)</literal> to indicate that
<literal>ONEWAY</literal> should perform the posthoc tests at a confidence level of
<replaceable>value</replaceable>. If <literal>ALPHA(<replaceable>value</replaceable>)</literal> is not specified, then the
confidence level used is 0.05.
</para>
</sect1>
<sect1 label="15.15" id="QUICK-CLUSTER">
<title>QUICK CLUSTER</title>
<indexterm role="vr"><primary>QUICK CLUSTER</primary></indexterm>
<indexterm role="cp"><primary>K-means clustering</primary></indexterm>
<indexterm role="cp"><primary>clustering</primary></indexterm>
<literallayout>QUICK CLUSTER <replaceable>var_list</replaceable>
[/CRITERIA=CLUSTERS(<replaceable>k</replaceable>) [MXITER(<replaceable>max_iter</replaceable>)] CONVERGE(<replaceable>epsilon</replaceable>) [NOINITIAL]]
[/MISSING={EXCLUDE,INCLUDE} {LISTWISE, PAIRWISE}]
[/PRINT={INITIAL} {CLUSTER}]
[/SAVE[=[CLUSTER[(<replaceable>membership_var</replaceable>)]] [DISTANCE[(<replaceable>distance_var</replaceable>)]]]
</literallayout>
<para>The <literal>QUICK CLUSTER</literal> command performs k-means clustering on the
dataset. This is useful when you wish to allocate cases into clusters
of similar values and you already know the number of clusters.
</para>
<para>The minimum specification is ‘<literal>QUICK CLUSTER</literal>’ followed by the names
of the variables which contain the cluster data. Normally you will also
want to specify <literal>/CRITERIA=CLUSTERS(<replaceable>k</replaceable>)</literal> where <replaceable>k</replaceable> is the
number of clusters. If this is not specified, then <replaceable>k</replaceable> defaults to 2.
</para>
<para>If you use <literal>/CRITERIA=NOINITIAL</literal> then a naive algorithm to select
the initial clusters is used. This will provide for faster execution but
less well separated initial clusters and hence possibly an inferior final
result.
</para>
<para><literal>QUICK CLUSTER</literal> uses an iterative algorithm to select the clusters centers.
The subcommand <literal>/CRITERIA=MXITER(<replaceable>max_iter</replaceable>)</literal> sets the maximum number of iterations.
During classification, PSPP will continue iterating until until <replaceable>max_iter</replaceable>
iterations have been done or the convergence criterion (see below) is fulfilled.
The default value of <replaceable>max_iter</replaceable> is 2.
</para>
<para>If however, you specify <literal>/CRITERIA=NOUPDATE</literal> then after selecting the initial centers,
no further update to the cluster centers is done. In this case, <replaceable>max_iter</replaceable>, if specified.
is ignored.
</para>
<para>The subcommand <literal>/CRITERIA=CONVERGE(<replaceable>epsilon</replaceable>)</literal> is used
to set the convergence criterion. The value of convergence criterion is <replaceable>epsilon</replaceable>
times the minimum distance between the <emphasis>initial</emphasis> cluster centers. Iteration stops when
the mean cluster distance between one iteration and the next
is less than the convergence criterion. The default value of <replaceable>epsilon</replaceable> is zero.
</para>
<para>The <literal>MISSING</literal> subcommand determines the handling of missing variables.
If <literal>INCLUDE</literal> is set, then user-missing values are considered at their face
value and not as missing values.
If <literal>EXCLUDE</literal> is set, which is the default, user-missing
values are excluded as well as system-missing values.
</para>
<para>If <literal>LISTWISE</literal> is set, then the entire case is excluded from the analysis
whenever any of the clustering variables contains a missing value.
If <literal>PAIRWISE</literal> is set, then a case is considered missing only if all the
clustering variables contain missing values. Otherwise it is clustered
on the basis of the non-missing values.
The default is <literal>LISTWISE</literal>.
</para>
<para>The <literal>PRINT</literal> subcommand requests additional output to be printed.
If <literal>INITIAL</literal> is set, then the initial cluster memberships will
be printed.
If <literal>CLUSTER</literal> is set, the cluster memberships of the individual
cases are displayed (potentially generating lengthy output).
</para>
<para>You can specify the subcommand <literal>SAVE</literal> to ask that each case’s cluster membership
and the euclidean distance between the case and its cluster center be saved to
a new variable in the active dataset. To save the cluster membership use the
<literal>CLUSTER</literal> keyword and to save the distance use the <literal>DISTANCE</literal> keyword.
Each keyword may optionally be followed by a variable name in parentheses to specify
the new variable which is to contain the saved parameter. If no variable name is specified,
then PSPP will create one.
</para>
</sect1>
<sect1 label="15.16" id="RANK">
<title>RANK</title>
<indexterm role="vr"><primary>RANK</primary></indexterm>
<literallayout>RANK
[VARIABLES=] <replaceable>var_list</replaceable> [{A,D}] [BY <replaceable>var_list</replaceable>]
/TIES={MEAN,LOW,HIGH,CONDENSE}
/FRACTION={BLOM,TUKEY,VW,RANKIT}
/PRINT[={YES,NO}
/MISSING={EXCLUDE,INCLUDE}
/RANK [INTO <replaceable>var_list</replaceable>]
/NTILES(k) [INTO <replaceable>var_list</replaceable>]
/NORMAL [INTO <replaceable>var_list</replaceable>]
/PERCENT [INTO <replaceable>var_list</replaceable>]
/RFRACTION [INTO <replaceable>var_list</replaceable>]
/PROPORTION [INTO <replaceable>var_list</replaceable>]
/N [INTO <replaceable>var_list</replaceable>]
/SAVAGE [INTO <replaceable>var_list</replaceable>]
</literallayout>
<para>The <literal>RANK</literal> command ranks variables and stores the results into new
variables.
</para>
<para>The <literal>VARIABLES</literal> subcommand, which is mandatory, specifies one or
more variables whose values are to be ranked.
After each variable, ‘<literal>A</literal>’ or ‘<literal>D</literal>’ may appear, indicating that
the variable is to be ranked in ascending or descending order.
Ascending is the default.
If a <literal>BY</literal> keyword appears, it should be followed by a list of variables
which are to serve as group variables.
In this case, the cases are gathered into groups, and ranks calculated
for each group.
</para>
<para>The <literal>TIES</literal> subcommand specifies how tied values are to be treated. The
default is to take the mean value of all the tied cases.
</para>
<para>The <literal>FRACTION</literal> subcommand specifies how proportional ranks are to be
calculated. This only has any effect if <literal>NORMAL</literal> or <literal>PROPORTIONAL</literal> rank
functions are requested.
</para>
<para>The <literal>PRINT</literal> subcommand may be used to specify that a summary of the rank
variables created should appear in the output.
</para>
<para>The function subcommands are <literal>RANK</literal>, <literal>NTILES</literal>, <literal>NORMAL</literal>, <literal>PERCENT</literal>, <literal>RFRACTION</literal>,
<literal>PROPORTION</literal> and <literal>SAVAGE</literal>. Any number of function subcommands may appear.
If none are given, then the default is RANK.
The <literal>NTILES</literal> subcommand must take an integer specifying the number of
partitions into which values should be ranked.
Each subcommand may be followed by the <literal>INTO</literal> keyword and a list of
variables which are the variables to be created and receive the rank
scores. There may be as many variables specified as there are
variables named on the <literal>VARIABLES</literal> subcommand. If fewer are specified,
then the variable names are automatically created.
</para>
<para>The <literal>MISSING</literal> subcommand determines how user missing values are to be
treated. A setting of <literal>EXCLUDE</literal> means that variables whose values are
user-missing are to be excluded from the rank scores. A setting of
<literal>INCLUDE</literal> means they are to be included. The default is <literal>EXCLUDE</literal>.
</para>
<!-- PSPP - a program for statistical analysis. -->
<!-- Copyright (C) 2017, 2020 Free Software Foundation, Inc. -->
<!-- Permission is granted to copy, distribute and/or modify this document -->
<!-- under the terms of the GNU Free Documentation License, Version 1.3 -->
<!-- or any later version published by the Free Software Foundation; -->
<!-- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -->
<!-- A copy of the license is included in the section entitled "GNU -->
<!-- Free Documentation License". -->
<!-- -->
</sect1>
<sect1 label="15.17" id="REGRESSION">
<title>REGRESSION</title>
<indexterm role="cp"><primary>regression</primary></indexterm>
<indexterm role="cp"><primary>linear regression</primary></indexterm>
<para>The <literal>REGRESSION</literal> procedure fits linear models to data via least-squares
estimation. The procedure is appropriate for data which satisfy those
assumptions typical in linear regression:
</para>
<itemizedlist><listitem><para>The data set contains <inlineequation><mathphrase>n</mathphrase></inlineequation> observations of a dependent variable, say
<inlineequation><mathphrase>Y_1,…,Y_n</mathphrase></inlineequation>, and <inlineequation><mathphrase>n</mathphrase></inlineequation> observations of one or more explanatory
variables.
Let <inlineequation><mathphrase>X_{11}, X_{12}</mathphrase></inlineequation>, …, <inlineequation><mathphrase>X_{1n}</mathphrase></inlineequation> denote the <inlineequation><mathphrase>n</mathphrase></inlineequation> observations
of the first explanatory variable;
<inlineequation><mathphrase>X_{21}</mathphrase></inlineequation>,…,<inlineequation><mathphrase>X_{2n}</mathphrase></inlineequation> denote the <inlineequation><mathphrase>n</mathphrase></inlineequation> observations of the second
explanatory variable;
<inlineequation><mathphrase>X_{k1}</mathphrase></inlineequation>,…,<inlineequation><mathphrase>X_{kn}</mathphrase></inlineequation> denote the <inlineequation><mathphrase>n</mathphrase></inlineequation> observations of
the <inlineequation><mathphrase>k</mathphrase></inlineequation>th explanatory variable.
</para>
</listitem><listitem><para>The dependent variable <inlineequation><mathphrase>Y</mathphrase></inlineequation> has the following relationship to the
explanatory variables:
<inlineequation><mathphrase>Y_i = b_0 + b_1 X_{1i} + ... + b_k X_{ki} + Z_i</mathphrase></inlineequation>
where <inlineequation><mathphrase>b_0, b_1, …, b_k</mathphrase></inlineequation> are unknown
coefficients, and <inlineequation><mathphrase>Z_1,…,Z_n</mathphrase></inlineequation> are independent, normally
distributed <firstterm>noise</firstterm> terms with mean zero and common variance.
The noise, or <firstterm>error</firstterm> terms are unobserved.
This relationship is called the <firstterm>linear model</firstterm>.
</para></listitem></itemizedlist>
<para>The <literal>REGRESSION</literal> procedure estimates the coefficients
<inlineequation><mathphrase>b_0,…,b_k</mathphrase></inlineequation> and produces output relevant to inferences for the
linear model.
</para>
<sect2 label="15.17.1" id="Syntax">
<title>Syntax</title>
<indexterm role="vr"><primary>REGRESSION</primary></indexterm>
<literallayout>REGRESSION
/VARIABLES=<replaceable>var_list</replaceable>
/DEPENDENT=<replaceable>var_list</replaceable>
/STATISTICS={ALL, DEFAULTS, R, COEFF, ANOVA, BCOV, CI[<replaceable>conf</replaceable>, TOL]}
{ /ORIGIN | /NOORIGIN }
/SAVE={PRED, RESID}
</literallayout>
<para>The <literal>REGRESSION</literal> procedure reads the active dataset and outputs
statistics relevant to the linear model specified by the user.
</para>
<para>The <literal>VARIABLES</literal> subcommand, which is required, specifies the list of
variables to be analyzed. Keyword <literal>VARIABLES</literal> is required. The
<literal>DEPENDENT</literal> subcommand specifies the dependent variable of the linear
model. The <literal>DEPENDENT</literal> subcommand is required. All variables listed in
the <literal>VARIABLES</literal> subcommand, but not listed in the <literal>DEPENDENT</literal> subcommand,
are treated as explanatory variables in the linear model.
</para>
<para>All other subcommands are optional:
</para>
<para>The <literal>STATISTICS</literal> subcommand specifies which statistics are to be displayed.
The following keywords are accepted:
</para>
<variablelist><varlistentry><term><literal>ALL</literal>
</term><listitem><para>All of the statistics below.
</para></listitem></varlistentry><varlistentry><term><literal>R</literal>
</term><listitem><para>The ratio of the sums of squares due to the model to the total sums of
squares for the dependent variable.
</para></listitem></varlistentry><varlistentry><term><literal>COEFF</literal>
</term><listitem><para>A table containing the estimated model coefficients and their standard errors.
</para></listitem></varlistentry><varlistentry><term><literal>CI (<replaceable>conf</replaceable>)</literal>
</term><listitem><para>This item is only relevant if COEFF has also been selected. It specifies that the
confidence interval for the coefficients should be printed. The optional value <replaceable>conf</replaceable>,
which must be in parentheses, is the desired confidence level expressed as a percentage.
</para></listitem></varlistentry><varlistentry><term><literal>ANOVA</literal>
</term><listitem><para>Analysis of variance table for the model.
</para></listitem></varlistentry><varlistentry><term><literal>BCOV</literal>
</term><listitem><para>The covariance matrix for the estimated model coefficients.
</para></listitem></varlistentry><varlistentry><term><literal>TOL</literal>
</term><listitem><para>The variance inflation factor and its reciprocal. This has no effect unless COEFF is also given.
</para></listitem></varlistentry><varlistentry><term><literal>DEFAULT</literal>
</term><listitem><para>The same as if R, COEFF, and ANOVA had been selected.
This is what you get if the /STATISTICS command is not specified,
or if it is specified without any parameters.
</para></listitem></varlistentry></variablelist>
<para>The <literal>ORIGIN</literal> and <literal>NOORIGIN</literal> subcommands are mutually
exclusive. <literal>ORIGIN</literal> indicates that the regression should be
performed through the origin. You should use this option if, and
only if you have reason to believe that the regression does indeed
pass through the origin — that is to say, the value <inlineequation><mathphrase>b_0</mathphrase></inlineequation> above,
is zero. The default is <literal>NOORIGIN</literal>.
</para>
<para>The <literal>SAVE</literal> subcommand causes PSPP to save the residuals or predicted
values from the fitted
model to the active dataset. PSPP will store the residuals in a variable
called ‘<literal>RES1</literal>’ if no such variable exists, ‘<literal>RES2</literal>’ if ‘<literal>RES1</literal>’
already exists,
‘<literal>RES3</literal>’ if ‘<literal>RES1</literal>’ and ‘<literal>RES2</literal>’ already exist, etc. It will
choose the name of
the variable for the predicted values similarly, but with ‘<literal>PRED</literal>’ as a
prefix.
When <literal>SAVE</literal> is used, PSPP ignores <literal>FILTER</literal>, processing
every case, and <literal>TEMPORARY</literal>, treating temporary transformations as
permanent.
</para>
</sect2>
<sect2 label="15.17.2" id="Examples">
<title>Examples</title>
<para>The following PSPP syntax will generate the default output and save the
predicted values and residuals to the active dataset.
</para>
<screen>title 'Demonstrate REGRESSION procedure'.
data list / v0 1-2 (A) v1 v2 3-22 (10).
begin data.
b 7.735648 -23.97588
b 6.142625 -19.63854
a 7.651430 -25.26557
c 6.125125 -16.57090
a 8.245789 -25.80001
c 6.031540 -17.56743
a 9.832291 -28.35977
c 5.343832 -16.79548
a 8.838262 -29.25689
b 6.200189 -18.58219
end data.
list.
regression /variables=v0 v1 v2 /statistics defaults /dependent=v2
/save pred resid /method=enter.
</screen>
</sect2>
</sect1>
<sect1 label="15.18" id="RELIABILITY">
<title>RELIABILITY</title>
<indexterm role="vr"><primary>RELIABILITY</primary></indexterm>
<literallayout>RELIABILITY
/VARIABLES=<replaceable>var_list</replaceable>
/SCALE (<replaceable>name</replaceable>) = {<replaceable>var_list</replaceable>, ALL}
/MODEL={ALPHA, SPLIT[(<replaceable>n</replaceable>)]}
/SUMMARY={TOTAL,ALL}
/MISSING={EXCLUDE,INCLUDE}
</literallayout>
<indexterm role="cp"><primary>Cronbach’s Alpha</primary></indexterm>
<para>The <literal>RELIABILITY</literal> command performs reliability analysis on the data.
</para>
<para>The <literal>VARIABLES</literal> subcommand is required. It determines the set of variables
upon which analysis is to be performed.
</para>
<para>The <literal>SCALE</literal> subcommand determines the variables for which
reliability is to be calculated. If <literal>SCALE</literal> is omitted, then analysis for
all variables named in the <literal>VARIABLES</literal> subcommand are used.
Optionally, the <replaceable>name</replaceable> parameter may be specified to set a string name
for the scale.
</para>
<para>The <literal>MODEL</literal> subcommand determines the type of analysis. If <literal>ALPHA</literal> is specified,
then Cronbach’s Alpha is calculated for the scale. If the model is <literal>SPLIT</literal>,
then the variables are divided into 2 subsets. An optional parameter
<replaceable>n</replaceable> may be given, to specify how many variables to be in the first subset.
If <replaceable>n</replaceable> is omitted, then it defaults to one half of the variables in the
scale, or one half minus one if there are an odd number of variables.
The default model is <literal>ALPHA</literal>.
</para>
<para>By default, any cases with user missing, or system missing values for
any variables given in the <literal>VARIABLES</literal> subcommand are omitted
from the analysis. The <literal>MISSING</literal> subcommand determines whether
user missing values are included or excluded in the analysis.
</para>
<para>The <literal>SUMMARY</literal> subcommand determines the type of summary analysis to be performed.
Currently there is only one type: <literal>SUMMARY=TOTAL</literal>, which displays per-item
analysis tested against the totals.
</para>
<sect2 label="15.18.1">
<title>Example - Reliability</title>
<para>Before analysing the results of a survey – particularly for a multiple choice survey –
it is desireable to know whether the respondents have considered their answers
or simply provided random answers.
</para>
<para>In the following example the survey results from the file <filename>hotel.sav</filename> are used.
All five survey questions are included in the reliability analysis.
However, before running the analysis, the data must be preprocessed.
An examination of the survey questions reveals that two questions, <emphasis>viz:</emphasis> v3 and v5
are negatively worded, whereas the others are positively worded.
All questions must be based upon the same scale for the analysis to be meaningful.
One could use the <literal>RECODE</literal> command (see <link linkend="RECODE">RECODE</link>), however a simpler way is
to use <literal>COMPUTE</literal> (see <link linkend="COMPUTE">COMPUTE</link>) and this is what is done in <link linkend="reliability_003aex">reliability:ex</link>.
</para>
<anchor id="reliability_003aex"/>
<sidebar><screen>get file="hotel.sav".
* Recode V3 and V5 inverting the sense of the values.
compute v3 = 6 - v3.
compute v5 = 6 - v5.
reliability
/variables= all
/model=alpha.
</screen></sidebar>
<para>In this case, all variables in the data set are used. So we can use the special
keyword ‘<literal>ALL</literal>’ (see <link linkend="BNF">BNF</link>).
</para>
<anchor id="reliability_003asrc"/>
<sidebar></sidebar>
<para><link linkend="reliability_003ares">reliability:res</link> shows that Cronbach’s Alpha is 0.11 which is a value normally considered too
low to indicate consistency within the data. This is possibly due to the small number of
survey questions. The survey should be redesigned before serious use of the results are
applied.
</para>
<anchor id="reliability_003ares"/>
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen>Scale: ANY
Case Processing Summary
+--------+--+-------+
|Cases | N|Percent|
+--------+--+-------+
|Valid |17| 100.0%|
|Excluded| 0| .0%|
|Total |17| 100.0%|
+--------+--+-------+
Reliability Statistics
+----------------+----------+
|Cronbach's Alpha|N of Items|
+----------------+----------+
| .11| 5|
+----------------+----------+
</screen>
</sect2>
</sect1>
<sect1 label="15.19" id="ROC">
<title>ROC</title>
<indexterm role="vr"><primary>ROC</primary></indexterm>
<indexterm role="cp"><primary>Receiver Operating Characteristic</primary></indexterm>
<indexterm role="cp"><primary>Area under curve</primary></indexterm>
<literallayout>ROC <replaceable>var_list</replaceable> BY <replaceable>state_var</replaceable> (<replaceable>state_value</replaceable>)
/PLOT = { CURVE [(REFERENCE)], NONE }
/PRINT = [ SE ] [ COORDINATES ]
/CRITERIA = [ CUTOFF({INCLUDE,EXCLUDE}) ]
[ TESTPOS ({LARGE,SMALL}) ]
[ CI (<replaceable>confidence</replaceable>) ]
[ DISTRIBUTION ({FREE, NEGEXPO }) ]
/MISSING={EXCLUDE,INCLUDE}
</literallayout>
<para>The <literal>ROC</literal> command is used to plot the receiver operating characteristic curve
of a dataset, and to estimate the area under the curve.
This is useful for analysing the efficacy of a variable as a predictor of a state of nature.
</para>
<para>The mandatory <replaceable>var_list</replaceable> is the list of predictor variables.
The variable <replaceable>state_var</replaceable> is the variable whose values represent the actual states,
and <replaceable>state_value</replaceable> is the value of this variable which represents the positive state.
</para>
<para>The optional subcommand <literal>PLOT</literal> is used to determine if and how the <literal>ROC</literal> curve is drawn.
The keyword <literal>CURVE</literal> means that the <literal>ROC</literal> curve should be drawn, and the optional keyword <literal>REFERENCE</literal>,
which should be enclosed in parentheses, says that the diagonal reference line should be drawn.
If the keyword <literal>NONE</literal> is given, then no <literal>ROC</literal> curve is drawn.
By default, the curve is drawn with no reference line.
</para>
<para>The optional subcommand <literal>PRINT</literal> determines which additional
tables should be printed. Two additional tables are available. The
<literal>SE</literal> keyword says that standard error of the area under the
curve should be printed as well as the area itself. In addition, a
p-value for the null hypothesis that the area under the curve equals
0.5 is printed. The <literal>COORDINATES</literal> keyword says that a
table of coordinates of the <literal>ROC</literal> curve should be printed.
</para>
<para>The <literal>CRITERIA</literal> subcommand has four optional parameters:
</para><itemizedlist><listitem><para>The <literal>TESTPOS</literal> parameter may be <literal>LARGE</literal> or <literal>SMALL</literal>.
<literal>LARGE</literal> is the default, and says that larger values in the predictor variables are to be
considered positive. <literal>SMALL</literal> indicates that smaller values should be considered positive.
</para>
</listitem><listitem><para>The <literal>CI</literal> parameter specifies the confidence interval that should be printed.
It has no effect if the <literal>SE</literal> keyword in the <literal>PRINT</literal> subcommand has not been given.
</para>
</listitem><listitem><para>The <literal>DISTRIBUTION</literal> parameter determines the method to be used when estimating the area
under the curve.
There are two possibilities, <emphasis>viz</emphasis>: <literal>FREE</literal> and <literal>NEGEXPO</literal>.
The <literal>FREE</literal> method uses a non-parametric estimate, and the <literal>NEGEXPO</literal> method a bi-negative
exponential distribution estimate.
The <literal>NEGEXPO</literal> method should only be used when the number of positive actual states is
equal to the number of negative actual states.
The default is <literal>FREE</literal>.
</para>
</listitem><listitem><para>The <literal>CUTOFF</literal> parameter is for compatibility and is ignored.
</para></listitem></itemizedlist>
<para>The <literal>MISSING</literal> subcommand determines whether user missing values are to
be included or excluded in the analysis. The default behaviour is to
exclude them.
Cases are excluded on a listwise basis; if any of the variables in <replaceable>var_list</replaceable>
or if the variable <replaceable>state_var</replaceable> is missing, then the entire case is
excluded.
</para>
<!-- LocalWords: subcmd subcommand -->
<!-- PSPP - a program for statistical analysis. -->
<!-- Copyright (C) 2017, 2020, 2021 Free Software Foundation, Inc. -->
<!-- Permission is granted to copy, distribute and/or modify this document -->
<!-- under the terms of the GNU Free Documentation License, Version 1.3 -->
<!-- or any later version published by the Free Software Foundation; -->
<!-- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -->
<!-- A copy of the license is included in the section entitled "GNU -->
<!-- Free Documentation License". -->
<!-- -->
</sect1>
</chapter>
<chapter label="16" id="Matrices">
<title>Matrices</title>
<para>Some PSPP procedures work with matrices by producing numeric
matrices that report results of data analysis, or by consuming
matrices as a basis for further analysis. This chapter documents the
format of data files that store these matrices and commands for
working with them, as well as PSPP’s general-purpose facility for
matrix operations.
</para>
<sect1 label="16.1" id="Matrix-Files">
<title>Matrix Files</title>
<indexterm role="vr"><primary>Matrix file</primary></indexterm>
<para>A matrix file is an SPSS system file that conforms to the dictionary
and case structure described in this section. Procedures that read
matrices from files expect them to be in the matrix file format.
Procedures that write matrices also use this format.
</para>
<para>Text files that contain matrices can be converted to matrix file
format. See <link linkend="MATRIX-DATA">MATRIX DATA</link>, for a command to read a text file as a
matrix file.
</para>
<para>A matrix file’s dictionary must have the following variables in the
specified order:
</para>
<orderedlist numeration="arabic"><listitem><para>Zero or more numeric split variables. These are included by
procedures when <literal>SPLIT FILE</literal> is active. <literal>MATRIX DATA</literal> assigns
split variables format F4.0.
</para>
</listitem><listitem><para><literal>ROWTYPE_</literal>, a string variable with width 8. This variable
indicates the kind of matrix or vector that a given case represents.
The supported row types are listed below.
</para>
</listitem><listitem><para>Zero or more numeric factor variables. These are included by
procedures that divide data into cells. For within-cell data, factor
variables are filled with non-missing values; for pooled data, they
are missing. <literal>MATRIX DATA</literal> assigns factor variables format F4.0.
</para>
</listitem><listitem><para><literal>VARNAME_</literal>, a string variable. Matrix data includes one row per
continuous variable (see below), naming each continuous variable in
order. This column is blank for vector data. <literal>MATRIX DATA</literal> makes
<literal>VARNAME_</literal> wide enough for the name of any of the continuous
variables, but at least 8 bytes.
</para>
</listitem><listitem><para>One or more numeric continuous variables. These are the variables
whose data was analyzed to produce the matrices. <literal>MATRIX DATA</literal>
assigns continuous variables format F10.4.
</para></listitem></orderedlist>
<para>Case weights are ignored in matrix files.
</para>
<bridgehead renderas="sect2">Row Types</bridgehead>
<anchor id="Matrix-File-Row-Types"/>
<para>Matrix files support a fixed set of types of matrix and vector data.
The <literal>ROWTYPE_</literal> variable in each case of a matrix file indicates
its row type.
</para>
<para>The supported matrix row types are listed below. Each type is listed
with the keyword that identifies it in <literal>ROWTYPE_</literal>. All supported
types of matrices are square, meaning that each matrix must include
one row per continuous variable, with the <literal>VARNAME_</literal> variable
indicating each continuous variable in turn in the same order as the
dictionary.
</para>
<variablelist><varlistentry><term><literal>CORR</literal>
</term><listitem><para>Correlation coefficients.
</para>
</listitem></varlistentry><varlistentry><term><literal>COV</literal>
</term><listitem><para>Covariance coefficients.
</para>
</listitem></varlistentry><varlistentry><term><literal>MAT</literal>
</term><listitem><para>General-purpose matrix.
</para>
</listitem></varlistentry><varlistentry><term><literal>N_MATRIX</literal>
</term><listitem><para>Counts.
</para>
</listitem></varlistentry><varlistentry><term><literal>PROX</literal>
</term><listitem><para>Proximities matrix.
</para></listitem></varlistentry></variablelist>
<para>The supported vector row types are listed below, along with their
associated keyword. Vector row types only require a single row, whose
<literal>VARNAME_</literal> is blank:
</para>
<variablelist><varlistentry><term><literal>COUNT</literal>
</term><listitem><para>Unweighted counts.
</para>
</listitem></varlistentry><varlistentry><term><literal>DFE</literal>
</term><listitem><para>Degrees of freedom.
</para>
</listitem></varlistentry><varlistentry><term><literal>MEAN</literal>
</term><listitem><para>Means.
</para>
</listitem></varlistentry><varlistentry><term><literal>MSE</literal>
</term><listitem><para>Mean squared errors.
</para>
</listitem></varlistentry><varlistentry><term><literal>N</literal>
</term><listitem><para>Counts.
</para>
</listitem></varlistentry><varlistentry><term><literal>STDDEV</literal>
</term><listitem><para>Standard deviations.
</para></listitem></varlistentry></variablelist>
<para>Only the row types listed above may appear in matrix files. The
<literal>MATRIX DATA</literal> command, however, accepts the additional row types
listed below, which it changes into matrix file row types as part of
its conversion process:
</para>
<variablelist><varlistentry><term><literal>N_VECTOR</literal>
</term><listitem><para>Synonym for <literal>N</literal>.
</para>
</listitem></varlistentry><varlistentry><term><literal>SD</literal>
</term><listitem><para>Synonym for <literal>STDDEV</literal>.
</para>
</listitem></varlistentry><varlistentry><term><literal>N_SCALAR</literal>
</term><listitem><para>Accepts a single number from the <literal>MATRIX DATA</literal> input and writes
it as an <literal>N</literal> row with the number replicated across all the
continuous variables.
</para></listitem></varlistentry></variablelist>
</sect1>
<sect1 label="16.2" id="MATRIX-DATA">
<title>MATRIX DATA</title>
<indexterm role="vr"><primary>MATRIX DATA</primary></indexterm>
<literallayout>MATRIX DATA
VARIABLES=<replaceable>variables</replaceable>
[FILE={’<replaceable>file_name</replaceable>’ | INLINE}
[/FORMAT=[{LIST | FREE}]
[{UPPER | LOWER | FULL}]
[{DIAGONAL | NODIAGONAL}]]
[/SPLIT=<replaceable>split_vars</replaceable>]
[/FACTORS=<replaceable>factor_vars</replaceable>]
[/N=<replaceable>n</replaceable>]
The following subcommands are only needed when ROWTYPE_ is not
specified on the VARIABLES subcommand:
[/CONTENTS={CORR,COUNT,COV,DFE,MAT,MEAN,MSE,
N_MATRIX,N|N_VECTOR,N_SCALAR,PROX,SD|STDDEV}]
[/CELLS=<replaceable>n_cells</replaceable>]
</literallayout>
<para>The <literal>MATRIX DATA</literal> command convert matrices and vectors from text
format into the matrix file format (See <link linkend="Matrix-Files">Matrix Files</link>) for use by
procedures that read matrices. It reads a text file or inline data
and outputs to the active file, replacing any data already in the
active dataset. The matrix file may then be used by other commands
directly from the active file, or it may be written to a <filename>.sav</filename>
file using the <literal>SAVE</literal> command.
</para>
<para>The text data read by <literal>MATRIX DATA</literal> can be delimited by spaces or
commas. A plus or minus sign, except immediately following a ‘<literal>d</literal>’
or ‘<literal>e</literal>’, also begins a new value. Optionally, values may be
enclosed in single or double quotes.
</para>
<para><literal>MATRIX DATA</literal> can read the types of matrix and vector data
supported in matrix files (see <link linkend="Matrix-File-Row-Types">Matrix File Row Types</link>).
</para>
<para>The <literal>FILE</literal> subcommand specifies the source of the command’s
input. To read input from a text file, specify its name in quotes.
To supply input inline, omit <literal>FILE</literal> or specify <literal>INLINE</literal>.
Inline data must directly follow <literal>MATRIX DATA</literal>, inside <literal>BEGIN
DATA</literal> (see <link linkend="BEGIN-DATA">BEGIN DATA</link>).
</para>
<para><literal>VARIABLES</literal> is the only required subcommand. It names the
variables present in each input record in the order that they appear.
(<literal>MATRIX DATA</literal> reorders the variables in the matrix file it
produces, if needed to fit the matrix file format.) The variable list
must include split variables and factor variables, if they are present
in the data, in addition to the continuous variables that form matrix
rows and columns. It may also include a special variable named
<literal>ROWTYPE_</literal>.
</para>
<para>Matrix data may include split variables or factor variables or both.
List split variables, if any, on the <literal>SPLIT</literal> subcommand and
factor variables, if any, on the <literal>FACTORS</literal> subcommand. Split
and factor variables must be numeric. Split and factor variables must
also be listed on <literal>VARIABLES</literal>, with one exception: if
<literal>VARIABLES</literal> does not include <literal>ROWTYPE_</literal>, then
<literal>SPLIT</literal> may name a single variable that is not in
<literal>VARIABLES</literal> (see <link linkend="MATRIX-DATA-Example-8">MATRIX DATA Example 8</link>).
</para>
<para>The <literal>FORMAT</literal> subcommand accepts settings to describe the format
of the input data:
</para>
<variablelist><varlistentry><term><literal>LIST</literal> (default)
</term><term><literal>FREE</literal>
</term><listitem><para>LIST requires each row to begin at the start of a new input line.
FREE allows rows to begin in the middle of a line. Either setting
allows a single row to continue across multiple input lines.
</para>
</listitem></varlistentry><varlistentry><term><literal>LOWER</literal> (default)
</term><term><literal>UPPER</literal>
</term><term><literal>FULL</literal>
</term><listitem><para>With LOWER, only the lower triangle is read from the input data and
the upper triangle is mirrored across the main diagonal. UPPER
behaves similarly for the upper triangle. FULL reads the entire
matrix.
</para>
</listitem></varlistentry><varlistentry><term><literal>DIAGONAL</literal> (default)
</term><term><literal>NODIAGONAL</literal>
</term><listitem><para>With DIAGONAL, the main diagonal is read from the input data. With
NODIAGONAL, which is incompatible with FULL, the main diagonal is not
read from the input data but instead set to 1 for correlation matrices
and system-missing for others.
</para></listitem></varlistentry></variablelist>
<para>The <literal>N</literal> subcommand is a way to specify the size of the
population. It is equivalent to specifying an <literal>N</literal> vector with
the specified value for each split file.
</para>
<para><literal>MATRIX DATA</literal> supports two different ways to indicate the kinds of
matrices and vectors present in the data, depending on whether a
variable with the special name <literal>ROWTYPE_</literal> is present in
<literal>VARIABLES</literal>. The following subsections explain <literal>MATRIX DATA</literal>
syntax and behavior in each case.
</para>
<sect2 label="16.2.1" id="MATRIX-DATA-with-ROWTYPE_005f">
<title>With <literal>ROWTYPE_</literal></title>
<para>If <literal>VARIABLES</literal> includes <literal>ROWTYPE_</literal>, each case’s
<literal>ROWTYPE_</literal> indicates the type of data contained in the row.
See <link linkend="Matrix-File-Row-Types">Matrix File Row Types</link>, for a list of supported row types.
</para>
<bridgehead renderas="sect3">Example 1: Defaults with <literal>ROWTYPE_</literal></bridgehead>
<anchor id="MATRIX-DATA-Example-1"/>
<para>This example shows a simple use of <literal>MATRIX DATA</literal> with
<literal>ROWTYPE_</literal> plus 8 variables named <literal>var01</literal> through
<literal>var08</literal>.
</para>
<para>Because <literal>ROWTYPE_</literal> is the first variable in <literal>VARIABLES</literal>,
it appears first on each line. The first three lines in the example
data have <literal>ROWTYPE_</literal> values of ‘<literal>MEAN</literal>’, ‘<literal>SD</literal>’, and
‘<literal>N</literal>’. These indicate that these lines contain vectors of means,
standard deviations, and counts, respectively, for <literal>var01</literal>
through <literal>var08</literal> in order.
</para>
<para>The remaining 8 lines have a ROWTYPE_ of ‘<literal>CORR</literal>’ which indicates
that the values are correlation coefficients. Each of the lines
corresponds to a row in the correlation matrix: the first line is for
<literal>var01</literal>, the next line for <literal>var02</literal>, and so on. The input
only contains values for the lower triangle, including the diagonal,
since <literal>FORMAT=LOWER DIAGONAL</literal> is the default.
</para>
<para>With <literal>ROWTYPE_</literal>, the <literal>CONTENTS</literal> subcommand is optional and
the <literal>CELLS</literal> subcommand may not be used.
</para>
<screen>MATRIX DATA
VARIABLES=ROWTYPE_ var01 TO var08.
BEGIN DATA.
MEAN 24.3 5.4 69.7 20.1 13.4 2.7 27.9 3.7
SD 5.7 1.5 23.5 5.8 2.8 4.5 5.4 1.5
N 92 92 92 92 92 92 92 92
CORR 1.00
CORR .18 1.00
CORR -.22 -.17 1.00
CORR .36 .31 -.14 1.00
CORR .27 .16 -.12 .22 1.00
CORR .33 .15 -.17 .24 .21 1.00
CORR .50 .29 -.20 .32 .12 .38 1.00
CORR .17 .29 -.05 .20 .27 .20 .04 1.00
END DATA.
</screen>
<bridgehead renderas="sect3">Example 2: <literal>FORMAT=UPPER NODIAGONAL</literal></bridgehead>
<para>This syntax produces the same matrix file as example 1, but it uses
<literal>FORMAT=UPPER NODIAGONAL</literal> to specify the upper triangle and omit
the diagonal. Because the matrix’s <literal>ROWTYPE_</literal> is <literal>CORR</literal>,
PSPP automatically fills in the diagonal with 1.
</para>
<screen>MATRIX DATA
VARIABLES=ROWTYPE_ var01 TO var08
/FORMAT=UPPER NODIAGONAL.
BEGIN DATA.
MEAN 24.3 5.4 69.7 20.1 13.4 2.7 27.9 3.7
SD 5.7 1.5 23.5 5.8 2.8 4.5 5.4 1.5
N 92 92 92 92 92 92 92 92
CORR .17 .50 -.33 .27 .36 -.22 .18
CORR .29 .29 -.20 .32 .12 .38
CORR .05 .20 -.15 .16 .21
CORR .20 .32 -.17 .12
CORR .27 .12 -.24
CORR -.20 -.38
CORR .04
END DATA.
</screen>
<bridgehead renderas="sect3">Example 3: <literal>N</literal> subcommand</bridgehead>
<para>This syntax uses the <literal>N</literal> subcommand in place of an <literal>N</literal>
vector. It produces the same matrix file as examples 1 and 2.
</para>
<screen>MATRIX DATA
VARIABLES=ROWTYPE_ var01 TO var08
/FORMAT=UPPER NODIAGONAL
/N 92.
BEGIN DATA.
MEAN 24.3 5.4 69.7 20.1 13.4 2.7 27.9 3.7
SD 5.7 1.5 23.5 5.8 2.8 4.5 5.4 1.5
CORR .17 .50 -.33 .27 .36 -.22 .18
CORR .29 .29 -.20 .32 .12 .38
CORR .05 .20 -.15 .16 .21
CORR .20 .32 -.17 .12
CORR .27 .12 -.24
CORR -.20 -.38
CORR .04
END DATA.
</screen>
<bridgehead renderas="sect3">Example 4: Split variables</bridgehead>
<anchor id="MATRIX-DATA-Example-4"/>
<para>This syntax defines two matrices, using the variable ‘<literal>s1</literal>’ to
distinguish between them. Notice how the order of variables in the
input matches their order on <literal>VARIABLES</literal>. This example also
uses <literal>FORMAT=FULL</literal>.
</para>
<screen>MATRIX DATA
VARIABLES=s1 ROWTYPE_ var01 TO var04
/SPLIT=s1
/FORMAT=FULL.
BEGIN DATA.
0 MEAN 34 35 36 37
0 SD 22 11 55 66
0 N 99 98 99 92
0 CORR 1 .9 .8 .7
0 CORR .9 1 .6 .5
0 CORR .8 .6 1 .4
0 CORR .7 .5 .4 1
1 MEAN 44 45 34 39
1 SD 23 15 51 46
1 N 98 34 87 23
1 CORR 1 .2 .3 .4
1 CORR .2 1 .5 .6
1 CORR .3 .5 1 .7
1 CORR .4 .6 .7 1
END DATA.
</screen>
<bridgehead renderas="sect3">Example 5: Factor variables</bridgehead>
<anchor id="MATRIX-DATA-Example-5"/>
<para>This syntax defines a matrix file that includes a factor variable
‘<literal>f1</literal>’. The data includes mean, standard deviation, and count
vectors for two values of the factor variable, plus a correlation
matrix for pooled data.
</para>
<screen>MATRIX DATA
VARIABLES=ROWTYPE_ f1 var01 TO var04
/FACTOR=f1.
BEGIN DATA.
MEAN 0 34 35 36 37
SD 0 22 11 55 66
N 0 99 98 99 92
MEAN 1 44 45 34 39
SD 1 23 15 51 46
N 1 98 34 87 23
CORR . 1
CORR . .9 1
CORR . .8 .6 1
CORR . .7 .5 .4 1
END DATA.
</screen>
</sect2>
<sect2 label="16.2.2" id="MATRIX-DATA-without-ROWTYPE_005f">
<title>Without <literal>ROWTYPE_</literal></title>
<para>If <literal>VARIABLES</literal> does not contain <literal>ROWTYPE_</literal>, the
<literal>CONTENTS</literal> subcommand defines the row types that appear in the
file and their order. If <literal>CONTENTS</literal> is omitted,
<literal>CONTENTS=CORR</literal> is assumed.
</para>
<para>Factor variables without <literal>ROWTYPE_</literal> introduce special
requirements, illustrated below in Examples 8 and 9.
</para>
<bridgehead renderas="sect3">Example 6: Defaults without <literal>ROWTYPE_</literal></bridgehead>
<para>This example shows a simple use of <literal>MATRIX DATA</literal> with 8 variables
named <literal>var01</literal> through <literal>var08</literal>, without <literal>ROWTYPE_</literal>.
This yields the same matrix file as Example 1 (see <link linkend="MATRIX-DATA-Example-1">MATRIX DATA
Example 1</link>).
</para>
<screen>MATRIX DATA
VARIABLES=var01 TO var08
/CONTENTS=MEAN SD N CORR.
BEGIN DATA.
24.3 5.4 69.7 20.1 13.4 2.7 27.9 3.7
5.7 1.5 23.5 5.8 2.8 4.5 5.4 1.5
92 92 92 92 92 92 92 92
1.00
.18 1.00
-.22 -.17 1.00
.36 .31 -.14 1.00
.27 .16 -.12 .22 1.00
.33 .15 -.17 .24 .21 1.00
.50 .29 -.20 .32 .12 .38 1.00
.17 .29 -.05 .20 .27 .20 .04 1.00
END DATA.
</screen>
<bridgehead renderas="sect3">Example 7: Split variables with explicit values</bridgehead>
<para>This syntax defines two matrices, using the variable <literal>s1</literal> to
distinguish between them. Each line of data begins with <literal>s1</literal>.
This yields the same matrix file as Example 4 (see <link linkend="MATRIX-DATA-Example-4">MATRIX DATA
Example 4</link>).
</para>
<screen>MATRIX DATA
VARIABLES=s1 var01 TO var04
/SPLIT=s1
/FORMAT=FULL
/CONTENTS=MEAN SD N CORR.
BEGIN DATA.
0 34 35 36 37
0 22 11 55 66
0 99 98 99 92
0 1 .9 .8 .7
0 .9 1 .6 .5
0 .8 .6 1 .4
0 .7 .5 .4 1
1 44 45 34 39
1 23 15 51 46
1 98 34 87 23
1 1 .2 .3 .4
1 .2 1 .5 .6
1 .3 .5 1 .7
1 .4 .6 .7 1
END DATA.
</screen>
<bridgehead renderas="sect3">Example 8: Split variable with sequential values</bridgehead>
<anchor id="MATRIX-DATA-Example-8"/>
<para>Like this previous example, this syntax defines two matrices with
split variable <literal>s1</literal>. In this case, though, <literal>s1</literal> is not
listed in <literal>VARIABLES</literal>, which means that its value does not
appear in the data. Instead, <literal>MATRIX DATA</literal> reads matrix data
until the input is exhausted, supplying 1 for the first split, 2 for
the second, and so on.
</para>
<screen>MATRIX DATA
VARIABLES=var01 TO var04
/SPLIT=s1
/FORMAT=FULL
/CONTENTS=MEAN SD N CORR.
BEGIN DATA.
34 35 36 37
22 11 55 66
99 98 99 92
1 .9 .8 .7
.9 1 .6 .5
.8 .6 1 .4
.7 .5 .4 1
44 45 34 39
23 15 51 46
98 34 87 23
1 .2 .3 .4
.2 1 .5 .6
.3 .5 1 .7
.4 .6 .7 1
END DATA.
</screen>
<sect3 label="16.2.2.1">
<title>Factor variables without <literal>ROWTYPE_</literal></title>
<para>Without <literal>ROWTYPE_</literal>, factor variables introduce two new wrinkles
to <literal>MATRIX DATA</literal> syntax. First, the <literal>CELLS</literal> subcommand
must declare the number of combinations of factor variables present in
the data. If there is, for example, one factor variable for which the
data contains three values, one would write <literal>CELLS=3</literal>; if there
are two (or more) factor variables for which the data contains five
combinations, one would use <literal>CELLS=5</literal>; and so on.
</para>
<para>Second, the <literal>CONTENTS</literal> subcommand must distinguish within-cell
data from pooled data by enclosing within-cell row types in
parentheses. When different within-cell row types for a single factor
appear in subsequent lines, enclose the row types in a single set of
parentheses; when different factors’ values for a given within-cell
row type appear in subsequent lines, enclose each row type in
individual parentheses.
</para>
<para>Without <literal>ROWTYPE_</literal>, input lines for pooled data do not include
factor values, not even as missing values, but input lines for
within-cell data do.
</para>
<para>The following examples aim to clarify this syntax.
</para>
<bridgehead renderas="sect3">Example 9: Factor variables, grouping within-cell records by factor</bridgehead>
<para>This syntax defines the same matrix file as Example 5 (see <link linkend="MATRIX-DATA-Example-5">MATRIX
DATA Example 5</link>), without using <literal>ROWTYPE_</literal>. It declares
<literal>CELLS=2</literal> because the data contains two values (0 and 1) for
factor variable <literal>f1</literal>. Within-cell vector row types <literal>MEAN</literal>,
<literal>SD</literal>, and <literal>N</literal> are in a single set of parentheses on
<literal>CONTENTS</literal> because they are grouped together in subsequent
lines for a single factor value. The data lines with the pooled
correlation matrix do not have any factor values.
</para>
<screen>MATRIX DATA
VARIABLES=f1 var01 TO var04
/FACTOR=f1
/CELLS=2
/CONTENTS=(MEAN SD N) CORR.
BEGIN DATA.
0 34 35 36 37
0 22 11 55 66
0 99 98 99 92
1 44 45 34 39
1 23 15 51 46
1 98 34 87 23
1
.9 1
.8 .6 1
.7 .5 .4 1
END DATA.
</screen>
<bridgehead renderas="sect3">Example 10: Factor variables, grouping within-cell records by row type</bridgehead>
<para>This syntax defines the same matrix file as the previous example. The
only difference is that the within-cell vector rows are grouped
differently: two rows of means (one for each factor), followed by two
rows of standard deviations, followed by two rows of counts.
</para>
<screen>MATRIX DATA
VARIABLES=f1 var01 TO var04
/FACTOR=f1
/CELLS=2
/CONTENTS=(MEAN) (SD) (N) CORR.
BEGIN DATA.
0 34 35 36 37
1 44 45 34 39
0 22 11 55 66
1 23 15 51 46
0 99 98 99 92
1 98 34 87 23
1
.9 1
.8 .6 1
.7 .5 .4 1
END DATA.
</screen>
</sect3>
</sect2>
</sect1>
<sect1 label="16.3" id="MCONVERT">
<title>MCONVERT</title>
<indexterm role="vr"><primary>MCONVERT</primary></indexterm>
<literallayout>MCONVERT
[[MATRIX=]
[IN({‘<literal>*</literal>’|’<replaceable>file</replaceable>’})]
[OUT({‘<literal>*</literal>’|’<replaceable>file</replaceable>’})]]
[/{REPLACE,APPEND}].
</literallayout>
<para>The <literal>MCONVERT</literal> command converts matrix data from a correlation
matrix and a vector of standard deviations into a covariance matrix,
or vice versa.
</para>
<para>By default, <literal>MCONVERT</literal> both reads and writes the active file. Use
the <literal>MATRIX</literal> subcommand to specify other files. To read a matrix
file, specify its name inside parentheses following <literal>IN</literal>. To
write a matrix file, specify its name inside parentheses following
<literal>OUT</literal>. Use ‘<literal>*</literal>’ to explicitly specify the active file for
input or output.
</para>
<para>When <literal>MCONVERT</literal> reads the input, by default it substitutes a
correlation matrix and a vector of standard deviations each time it
encounters a covariance matrix, and vice versa. Specify
<literal>/APPEND</literal> to instead have <literal>MCONVERT</literal> add the other form of
data without removing the existing data. Use <literal>/REPLACE</literal> to
explicitly request removing the existing data.
</para>
<para>The <literal>MCONVERT</literal> command requires its input to be a matrix file.
Use <literal>MATRIX DATA</literal> to convert text input into matrix file format.
See <link linkend="MATRIX-DATA">MATRIX DATA</link>, for details.
</para>
</sect1>
<sect1 label="16.4" id="MATRIX">
<title>MATRIX</title>
<indexterm role="vr"><primary>MATRIX</primary></indexterm>
<indexterm role="vr"><primary>END MATRIX</primary></indexterm>
<literallayout><literal>MATRIX.</literal>
…<emphasis>matrix commands</emphasis>…
<literal>END MATRIX.</literal>
</literallayout>
<para>The following basic matrix commands are supported:
</para>
<literallayout><literal>COMPUTE</literal> <emphasis>variable</emphasis>[<literal>(</literal><emphasis>index</emphasis>[<literal>,</literal><emphasis>index</emphasis>]<literal>)</literal>]<literal>=</literal><emphasis>expression</emphasis><literal>.</literal>
<literal>CALL</literal> <emphasis>procedure</emphasis><literal>(</literal><emphasis>argument</emphasis><literal>,</literal> …).
<literal>PRINT</literal> [<emphasis>expression</emphasis>]
[<literal>/FORMAT</literal><literal>=</literal><emphasis>format</emphasis>]
[<literal>/TITLE</literal><literal>=</literal><emphasis>title</emphasis>]
[<literal>/SPACE</literal><literal>=</literal>{<literal>NEWPAGE</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <emphasis>n</emphasis>}]
[{<literal>/RLABELS</literal><literal>=</literal><emphasis>string</emphasis>… <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>/RNAMES</literal><literal>=</literal><emphasis>expression</emphasis>}]
[{<literal>/CLABELS</literal><literal>=</literal><emphasis>string</emphasis>… <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>/CNAMES</literal><literal>=</literal><emphasis>expression</emphasis>}]<literal>.</literal>
</literallayout>
<para>The following matrix commands offer support for flow control:
</para>
<literallayout><literal>DO IF</literal> <emphasis>expression</emphasis><literal>.</literal>
…<emphasis>matrix commands</emphasis>…
[<literal>ELSE IF</literal> <emphasis>expression</emphasis><literal>.</literal>
…<emphasis>matrix commands</emphasis>…]…
[<literal>ELSE</literal>
…<emphasis>matrix commands</emphasis>…]
<literal>END IF</literal><literal>.</literal>
<literal>LOOP</literal> [<emphasis>var</emphasis><literal>=</literal><emphasis>first</emphasis> <literal>TO</literal> <emphasis>last</emphasis> [<literal>BY</literal> <emphasis>step</emphasis>]] [<literal>IF</literal> <emphasis>expression</emphasis>]<literal>.</literal>
…<emphasis>matrix commands</emphasis>…
<literal>END LOOP</literal> [<literal>IF</literal> <emphasis>expression</emphasis>]<literal>.</literal>
<literal>BREAK</literal><literal>.</literal>
</literallayout>
<para>The following matrix commands support matrix input and output:
</para>
<literallayout><literal>READ</literal> <emphasis>variable</emphasis>[<literal>(</literal><emphasis>index</emphasis>[<literal>,</literal><emphasis>index</emphasis>]<literal>)</literal>]
[<literal>/FILE</literal><literal>=</literal><emphasis>file</emphasis>]
<literal>/FIELD</literal><literal>=</literal><emphasis>first</emphasis> <literal>TO</literal> <emphasis>last</emphasis> [<literal>BY</literal> <emphasis>width</emphasis>]
[<literal>/FORMAT</literal><literal>=</literal><emphasis>format</emphasis>]
[<literal>/SIZE</literal><literal>=</literal><emphasis>expression</emphasis>]
[<literal>/MODE</literal><literal>=</literal>{<literal>RECTANGULAR</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>SYMMETRIC</literal>}]
[<literal>/REREAD</literal>]<literal>.</literal>
<literal>WRITE</literal> <emphasis>expression</emphasis>
[<literal>/OUTFILE</literal><literal>=</literal><emphasis>file</emphasis>]
<literal>/FIELD</literal><literal>=</literal><emphasis>first</emphasis> <literal>TO</literal> <emphasis>last</emphasis> [<literal>BY</literal> <emphasis>width</emphasis>]
[<literal>/MODE</literal><literal>=</literal>{<literal>RECTANGULAR</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>TRIANGULAR</literal>}]
[<literal>/HOLD</literal>]
[<literal>/FORMAT</literal><literal>=</literal><emphasis>format</emphasis>]<literal>.</literal>
<literal>GET</literal> <emphasis>variable</emphasis>[<literal>(</literal><emphasis>index</emphasis>[<literal>,</literal><emphasis>index</emphasis>]<literal>)</literal>]
[<literal>/FILE</literal><literal>=</literal>{<emphasis>file</emphasis> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>*</literal>}]
[<literal>/VARIABLES</literal><literal>=</literal><emphasis>variable</emphasis>…]
[<literal>/NAMES</literal><literal>=</literal><emphasis>expression</emphasis>]
[<literal>/MISSING</literal><literal>=</literal>{<literal>ACCEPT</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>OMIT</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <emphasis>number</emphasis>}]
[<literal>/SYSMIS</literal><literal>=</literal>{<literal>OMIT</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <emphasis>number</emphasis>}]<literal>.</literal>
<literal>SAVE</literal> <emphasis>expression</emphasis>
[<literal>/OUTFILE</literal><literal>=</literal>{<emphasis>file</emphasis> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>*</literal>}]
[<literal>/VARIABLES</literal><literal>=</literal><emphasis>variable</emphasis>…]
[<literal>/NAMES</literal><literal>=</literal><emphasis>expression</emphasis>]
[<literal>/STRINGS</literal><literal>=</literal><emphasis>variable</emphasis>…]<literal>.</literal>
<literal>MGET</literal> [<literal>/FILE</literal><literal>=</literal><emphasis>file</emphasis>]
[<literal>/TYPE</literal><literal>=</literal>{<literal>COV</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>CORR</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>MEAN</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>STDDEV</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>N</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>COUNT</literal>}]<literal>.</literal>
<literal>MSAVE</literal> <emphasis>expression</emphasis>
<literal>/TYPE</literal><literal>=</literal>{<literal>COV</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>CORR</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>MEAN</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>STDDEV</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>N</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>COUNT</literal>}
[<literal>/OUTFILE</literal><literal>=</literal><emphasis>file</emphasis>]
[<literal>/VARIABLES</literal><literal>=</literal><emphasis>variable</emphasis>…]
[<literal>/SNAMES</literal><literal>=</literal><emphasis>variable</emphasis>…]
[<literal>/SPLIT</literal><literal>=</literal><emphasis>expression</emphasis>]
[<literal>/FNAMES</literal><literal>=</literal><emphasis>variable</emphasis>…]
[<literal>/FACTOR</literal><literal>=</literal><emphasis>expression</emphasis>]<literal>.</literal>
</literallayout>
<para>The following matrix commands provide additional support:
</para>
<literallayout><literal>DISPLAY</literal> [{<literal>DICTIONARY</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>STATUS</literal>}]<literal>.</literal>
<literal>RELEASE</literal> <emphasis>variable</emphasis>…<literal>.</literal>
</literallayout>
<para><literal>MATRIX</literal> and <literal>END MATRIX</literal> enclose a special PSPP
sub-language, called the matrix language. The matrix language does
not require an active dataset to be defined and only a few of the
matrix language commands work with any datasets that are defined.
Each instance of <literal>MATRIX</literal>…<literal>END MATRIX</literal> is a separate
program whose state is independent of any instance, so that variables
declared within a matrix program are forgotten at its end.
</para>
<para>The matrix language works with matrices, where a <firstterm>matrix</firstterm> is a
rectangular array of real numbers. An <inlineequation><mathphrase><replaceable>n</replaceable>×<replaceable>m</replaceable></mathphrase></inlineequation>
matrix has <replaceable>n</replaceable> rows and <replaceable>m</replaceable> columns. Some special cases are
important: a <inlineequation><mathphrase><replaceable>n</replaceable>×1</mathphrase></inlineequation> matrix is a <firstterm>column vector</firstterm>,
a <inlineequation><mathphrase>1×<replaceable>n</replaceable></mathphrase></inlineequation> is a <firstterm>row vector</firstterm>, and a
<inlineequation><mathphrase>1×1</mathphrase></inlineequation> matrix is a <firstterm>scalar</firstterm>.
</para>
<para>The matrix language also has limited support for matrices that contain
8-byte strings instead of numbers. Strings longer than 8 bytes are
truncated, and shorter strings are padded with spaces. String
matrices are mainly useful for labeling rows and columns when printing
numerical matrices with the <literal>MATRIX PRINT</literal> command. Arithmetic
operations on string matrices will not produce useful results. The
user should not mix strings and numbers within a matrix.
</para>
<para>The matrix language does not work with cases. A variable in the
matrix language represents a single matrix.
</para>
<para>The matrix language does not support missing values.
</para>
<para><literal>MATRIX</literal> is a procedure, so it cannot be enclosed inside <literal>DO
IF</literal>, <literal>LOOP</literal>, etc.
</para>
<para>Macros may be used within a matrix program, and macros may expand to
include entire matrix programs. The <literal>DEFINE</literal> command may not
appear within a matrix program. See <link linkend="DEFINE">DEFINE</link>, for more information
about macros.
</para>
<para>The following sections describe the details of the matrix language:
first, the syntax of matrix expressions, then each of the supported
commands. The <literal>COMMENT</literal> command (see <link linkend="COMMENT">COMMENT</link>) is also
supported.
</para>
<sect2 label="16.4.1" id="Matrix-Expressions">
<title>Matrix Expressions</title>
<para>Many matrix commands use expressions. A matrix expression may use the
following operators, listed in descending order of operator
precedence. Within a single level, operators associate from left to
right.
</para>
<itemizedlist><listitem><para>Function call <literal>()</literal> and matrix construction <literal>{}</literal>
</para>
</listitem><listitem><para>Indexing <literal>()</literal>
</para>
</listitem><listitem><para>Unary <literal>+</literal> and <literal>-</literal>
</para>
</listitem><listitem><para>Integer sequence <literal>:</literal>
</para>
</listitem><listitem><para>Exponentiation <literal>**</literal> and <literal>&**</literal>
</para>
</listitem><listitem><para>Multiplication <literal>*</literal> and <literal>&*</literal>, and division <literal>/</literal> and <literal>&/</literal>
</para>
</listitem><listitem><para>Addition <literal>+</literal> and subtraction <literal>-</literal>
</para>
</listitem><listitem><para>Relational <literal>< <= = >= > <></literal>
</para>
</listitem><listitem><para>Logical <literal>NOT</literal>
</para>
</listitem><listitem><para>Logical <literal>AND</literal>
</para>
</listitem><listitem><para>Logical <literal>OR</literal> and <literal>XOR</literal>
</para></listitem></itemizedlist>
<para>See <link linkend="Matrix-Functions">Matrix Functions</link>, for the available matrix functions. The
remaining operators are described in more detail below.
</para>
<indexterm role="cp"><primary>restricted expressions</primary></indexterm>
<para>Expressions appear in the matrix language in some contexts where there
would be ambiguity whether ‘<literal>/</literal>’ is an operator or a separator
between subcommands. In these contexts, only the operators with
higher precedence than ‘<literal>/</literal>’ are allowed outside parentheses.
Later sections call these <firstterm>restricted expressions</firstterm>.
</para>
<sect3 label="16.4.1.1" id="Matrix-Construction-Operator">
<title>Matrix Construction Operator <literal>{}</literal></title>
<para>Use the <literal>{</literal><literal>}</literal> operator to construct matrices. Within
the curly braces, commas separate elements within a row and semicolons
separate rows. The following examples show a <inlineequation><mathphrase>2×3</mathphrase></inlineequation>
matrix, a <inlineequation><mathphrase>1×4</mathphrase></inlineequation> row vector, a <inlineequation><mathphrase>3×1</mathphrase></inlineequation> column
vector, and a scalar.
</para>
<informaltable><tgroup cols="3"><colspec colwidth="40*"></colspec><colspec colwidth="5*"></colspec><colspec colwidth="40*"></colspec><tbody><row><entry><para><literal>{1, 2, 3; 4, 5, 6}</literal>
</para></entry><entry><para>⇒
</para></entry><entry><para><literal>[1 2 3]
[4 5 6]</literal>
 </para></entry></row><row><entry><para><literal>{3.14, 6.28, 9.24, 12.57}</literal>
</para></entry><entry><para>⇒
</para></entry><entry><para>[3.14 6.28 9.42 12.57]
 </para></entry></row><row><entry><para><literal>{1.41; 1.73; 2}</literal>
</para></entry><entry><para>⇒
</para></entry><entry><para><literal>[1.41]
[1.73]
[2.00]</literal>
 </para></entry></row><row><entry><para><literal>{5}</literal>
</para></entry><entry><para>⇒
</para></entry><entry><para>5
</para></entry></row></tbody></tgroup></informaltable>
<para>Curly braces are not limited to holding numeric literals. They can
contain calculations, and they can paste together matrices and vectors
in any way as long as the result is rectangular. For example, if
‘<literal>m</literal>’ is matrix <literal>{1, 2; 3, 4}</literal>, ‘<literal>r</literal>’ is row vector
<literal>{5, 6}</literal>, and ‘<literal>c</literal>’ is column vector <literal>{7, 8}</literal>, then
curly braces can be used as follows:
</para>
<informaltable><tgroup cols="3"><colspec colwidth="40*"></colspec><colspec colwidth="5*"></colspec><colspec colwidth="40*"></colspec><tbody><row><entry><para><literal>{m, c; r, 10}</literal>
</para></entry><entry><para>⇒
</para></entry><entry><para><literal>[1 2 7]
[3 4 8]
[5 6 10]</literal>
 </para></entry></row><row><entry><para><literal>{c, 2 * c, T(r)}</literal>
</para></entry><entry><para>⇒
</para></entry><entry><para><literal>[7 14 5]
[8 16 6]</literal>
</para></entry></row></tbody></tgroup></informaltable>
<para>The final example above uses the transposition function <literal>T</literal>.
</para>
</sect3>
<sect3 label="16.4.1.2" id="Matrix-Sequence-Operator">
<title>Integer Sequence Operator ‘<literal>:</literal>’</title>
<para>The syntax <literal><replaceable>first</replaceable>:<replaceable>last</replaceable>:<replaceable>step</replaceable></literal> yields a row
vector of consecutive integers from <replaceable>first</replaceable> to <replaceable>last</replaceable> counting
by <replaceable>step</replaceable>. The final <literal>:<replaceable>step</replaceable></literal> is optional and
defaults to 1 when omitted.
</para>
<para>Each of <replaceable>first</replaceable>, <replaceable>last</replaceable>, and <replaceable>step</replaceable> must be a scalar and
should be an integer (any fractional part is discarded). Because
‘<literal>:</literal>’ has a high precedence, operands other than numeric literals
must usually be parenthesized.
</para>
<para>When <replaceable>step</replaceable> is positive (or omitted) and <inlineequation><mathphrase><replaceable>end</replaceable> <
<replaceable>start</replaceable></mathphrase></inlineequation>, or if <replaceable>step</replaceable> is negative and <inlineequation><mathphrase><replaceable>end</replaceable> >
<replaceable>start</replaceable></mathphrase></inlineequation>, then the result is an empty matrix. If <replaceable>step</replaceable> is 0,
then PSPP reports an error.
</para>
<para>Here are some examples:
</para>
<informaltable><tgroup cols="3"><colspec colwidth="40*"></colspec><colspec colwidth="5*"></colspec><colspec colwidth="40*"></colspec><tbody><row><entry><para><literal>1:6</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{1, 2, 3, 4, 5, 6}</literal>
</para></entry></row><row><entry><para><literal>1:6:2</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{1, 3, 5}</literal>
</para></entry></row><row><entry><para><literal>-1:-5:-1</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{-1, -2, -3, -4, -5}</literal>
</para></entry></row><row><entry><para><literal>-1:-5</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{}</literal>
</para></entry></row><row><entry><para><literal>2:1:0</literal> </para></entry><entry><para>⇒ </para></entry><entry><para>(error)
</para></entry></row></tbody></tgroup></informaltable>
</sect3>
<sect3 label="16.4.1.3" id="Matrix-Index-Operator">
<title>Index Operator <literal>()</literal></title>
<para>The result of the submatrix or indexing operator, written
<literal><replaceable>m</replaceable>(<replaceable>rindex</replaceable>, <replaceable>cindex</replaceable>)</literal>, contains the rows of
<replaceable>m</replaceable> whose indexes are given in vector <replaceable>rindex</replaceable> and the columns
whose indexes are given in vector <replaceable>cindex</replaceable>.
</para>
<para>In the simplest case, if <replaceable>rindex</replaceable> and <replaceable>cindex</replaceable> are both
scalars, the result is also a scalar:
</para>
<informaltable><tgroup cols="3"><colspec colwidth="40*"></colspec><colspec colwidth="5*"></colspec><colspec colwidth="40*"></colspec><tbody><row><entry><para><literal>{10, 20; 30, 40}(1, 1)</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>10</literal>
</para></entry></row><row><entry><para><literal>{10, 20; 30, 40}(1, 2)</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>20</literal>
</para></entry></row><row><entry><para><literal>{10, 20; 30, 40}(2, 1)</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>30</literal>
</para></entry></row><row><entry><para><literal>{10, 20; 30, 40}(2, 2)</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>40</literal>
</para></entry></row></tbody></tgroup></informaltable>
<para>If the index arguments have multiple elements, then the result
includes multiple rows or columns:
</para>
<informaltable><tgroup cols="3"><colspec colwidth="40*"></colspec><colspec colwidth="5*"></colspec><colspec colwidth="40*"></colspec><tbody><row><entry><para><literal>{10, 20; 30, 40}(1:2, 1)</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{10; 30}</literal>
</para></entry></row><row><entry><para><literal>{10, 20; 30, 40}(2, 1:2)</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{30, 40}</literal>
</para></entry></row><row><entry><para><literal>{10, 20; 30, 40}(1:2, 1:2)</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{10, 20; 30, 40}</literal>
</para></entry></row></tbody></tgroup></informaltable>
<para>The special argument ‘<literal>:</literal>’ may stand in for all the rows or columns
in the matrix being indexed, like this:
</para>
<informaltable><tgroup cols="3"><colspec colwidth="40*"></colspec><colspec colwidth="5*"></colspec><colspec colwidth="40*"></colspec><tbody><row><entry><para><literal>{10, 20; 30, 40}(:, 1)</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{10; 30}</literal>
</para></entry></row><row><entry><para><literal>{10, 20; 30, 40}(2, :)</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{30, 40}</literal>
</para></entry></row><row><entry><para><literal>{10, 20; 30, 40}(:, :)</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{10, 20; 30, 40}</literal>
</para></entry></row></tbody></tgroup></informaltable>
<para>The index arguments do not have to be in order, and they may contain
repeated values, like this:
</para>
<informaltable><tgroup cols="3"><colspec colwidth="40*"></colspec><colspec colwidth="5*"></colspec><colspec colwidth="40*"></colspec><tbody><row><entry><para><literal>{10, 20; 30, 40}({2, 1}, 1)</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{30; 10}</literal>
</para></entry></row><row><entry><para><literal>{10, 20; 30, 40}(2, {2; 2; 1})</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{40, 40, 30}</literal>
</para></entry></row><row><entry><para><literal>{10, 20; 30, 40}(2:1:-1, :)</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{30, 40; 10, 20}</literal>
</para></entry></row></tbody></tgroup></informaltable>
<para>When the matrix being indexed is a row or column vector, only a single
index argument is needed, like this:
</para>
<informaltable><tgroup cols="3"><colspec colwidth="40*"></colspec><colspec colwidth="5*"></colspec><colspec colwidth="40*"></colspec><tbody><row><entry><para><literal>{11, 12, 13, 14, 15}(2:4)</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{12, 13, 14}</literal>
</para></entry></row><row><entry><para><literal>{11; 12; 13; 14; 15}(2:4)</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{12; 13; 14}</literal>
</para></entry></row></tbody></tgroup></informaltable>
<para>When an index is not an integer, PSPP discards the fractional part.
It is an error for an index to be less than 1 or greater than the
number of rows or columns:
</para>
<informaltable><tgroup cols="3"><colspec colwidth="40*"></colspec><colspec colwidth="5*"></colspec><colspec colwidth="40*"></colspec><tbody><row><entry><para><literal>{11, 12, 13, 14}({2.5, 4.6})</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{12, 14}</literal>
</para></entry></row><row><entry><para><literal>{11; 12; 13; 14}(0)</literal> </para></entry><entry><para>⇒ </para></entry><entry><para>(error)
</para></entry></row></tbody></tgroup></informaltable>
</sect3>
<sect3 label="16.4.1.4" id="Matrix-Unary-Operators">
<title>Unary Operators</title>
<para>The unary operators take a single operand of any dimensions and
operate on each of its elements independently. The unary operators
are:
</para>
<variablelist><varlistentry><term><literal>-</literal>
</term><listitem><para>Inverts the sign of each element.
</para>
</listitem></varlistentry><varlistentry><term><literal>+</literal>
</term><listitem><para>No change.
</para>
</listitem></varlistentry><varlistentry><term><literal>NOT</literal>
</term><listitem><para>Logical inversion: each positive value becomes 0 and each zero or
negative value becomes 1.
</para></listitem></varlistentry></variablelist>
<para>Examples:
</para>
<informaltable><tgroup cols="3"><colspec colwidth="40*"></colspec><colspec colwidth="5*"></colspec><colspec colwidth="40*"></colspec><tbody><row><entry><para><literal>-{1, -2; 3, -4}</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{-1, 2; -3, 4}</literal>
</para></entry></row><row><entry><para><literal>+{1, -2; 3, -4}</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{1, -2; 3, -4}</literal>
</para></entry></row><row><entry><para><literal>NOT {1, 0; -1, 1}</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{0, 1; 1, 0}</literal>
</para></entry></row></tbody></tgroup></informaltable>
</sect3>
<sect3 label="16.4.1.5" id="Matrix-Elementwise-Binary-Operators">
<title>Elementwise Binary Operators</title>
<para>The elementwise binary operators require their operands to be matrices
with the same dimensions. Alternatively, if one operand is a scalar,
then its value is treated as if it were duplicated to the dimensions
of the other operand. The result is a matrix of the same size as the
operands, in which each element is the result of the applying the
operator to the corresponding elements of the operands.
</para>
<para>The elementwise binary operators are listed below.
</para>
<itemizedlist><listitem><para>The arithmetic operators, for familiar arithmetic operations:
</para>
<variablelist><varlistentry><term><literal>+</literal>
</term><listitem><para>Addition.
</para>
</listitem></varlistentry><varlistentry><term><literal>-</literal>
</term><listitem><para>Subtraction.
</para>
</listitem></varlistentry><varlistentry><term><literal>*</literal>
</term><listitem><para>Multiplication, if one operand is a scalar. (Otherwise this is matrix
multiplication, described below.)
</para>
</listitem></varlistentry><varlistentry><term><literal>/</literal> or <literal>&/</literal>
</term><listitem><para>Division.
</para>
</listitem></varlistentry><varlistentry><term><literal>&*</literal>
</term><listitem><para>Multiplication.
</para>
</listitem></varlistentry><varlistentry><term><literal>&**</literal>
</term><listitem><para>Exponentiation.
</para></listitem></varlistentry></variablelist>
</listitem><listitem><para>The relational operators, whose results are 1 when a comparison is
true and 0 when it is false:
</para>
<variablelist><varlistentry><term><literal><</literal> or <literal>LT</literal>
</term><listitem><para>Less than.
</para>
</listitem></varlistentry><varlistentry><term><literal><=</literal> or <literal>LE</literal>
</term><listitem><para>Less than or equal.
</para>
</listitem></varlistentry><varlistentry><term><literal>=</literal> or <literal>EQ</literal>
</term><listitem><para>Equal.
</para>
</listitem></varlistentry><varlistentry><term><literal>></literal> or <literal>GT</literal>
</term><listitem><para>Greater than.
</para>
</listitem></varlistentry><varlistentry><term><literal>>=</literal> or <literal>GE</literal>
</term><listitem><para>Greater than or equal.
</para>
</listitem></varlistentry><varlistentry><term><literal><></literal> or <literal>~=</literal> or <literal>NE</literal>
</term><listitem><para>Not equal.
</para></listitem></varlistentry></variablelist>
</listitem><listitem><para>The logical operators, which treat positive operands as true and
nonpositive operands as false. They yield 0 for false and 1 for true:
</para>
<variablelist><varlistentry><term><literal>AND</literal>
</term><listitem><para>True if both operands are true.
</para>
</listitem></varlistentry><varlistentry><term><literal>OR</literal>
</term><listitem><para>True if at least one operand is true.
</para>
</listitem></varlistentry><varlistentry><term><literal>XOR</literal>
</term><listitem><para>True if exactly one operand is true.
</para></listitem></varlistentry></variablelist></listitem></itemizedlist>
<para>Examples:
</para>
<informaltable><tgroup cols="3"><colspec colwidth="40*"></colspec><colspec colwidth="5*"></colspec><colspec colwidth="40*"></colspec><tbody><row><entry><para><literal>1 + 2</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>3</literal>
</para></entry></row><row><entry><para><literal>1 + {3; 4}</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{4; 5}</literal>
</para></entry></row><row><entry><para><literal>{66, 77; 88, 99} + 5</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{71, 82; 93, 104}</literal>
</para></entry></row><row><entry><para><literal>{4, 8; 3, 7} + {1, 0; 5, 2}</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{5, 8; 8, 9}</literal>
</para></entry></row><row><entry><para><literal>{1, 2; 3, 4} < {4, 3; 2, 1}</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{1, 1; 0, 0}</literal>
</para></entry></row><row><entry><para><literal>{1, 3; 2, 4} >= 3</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{0, 1; 0, 1}</literal>
</para></entry></row><row><entry><para><literal>{0, 0; 1, 1} AND {0, 1; 0, 1}</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{0, 0; 0, 1}</literal>
</para></entry></row></tbody></tgroup></informaltable>
</sect3>
<sect3 label="16.4.1.6" id="Matrix-Multiplication-Operator">
<title>Matrix Multiplication Operator ‘<literal>*</literal>’</title>
<para>If <literal>A</literal> is an <inlineequation><mathphrase><replaceable>m</replaceable>×<replaceable>n</replaceable></mathphrase></inlineequation> matrix and <literal>B</literal> is
an <inlineequation><mathphrase><replaceable>n</replaceable>×<replaceable>p</replaceable></mathphrase></inlineequation> matrix, then <literal>A*B</literal> is the
<inlineequation><mathphrase><replaceable>m</replaceable>×<replaceable>p</replaceable></mathphrase></inlineequation> matrix multiplication product <literal>C</literal>.
PSPP reports an error if the number of columns in <literal>A</literal> differs
from the number of rows in <literal>B</literal>.
</para>
<para>The <literal>*</literal> operator performs elementwise multiplication (see above)
if one of its operands is a scalar.
</para>
<para>No built-in operator yields the inverse of matrix multiplication.
Instead, multiply by the result of <literal>INV</literal> or <literal>GINV</literal>.
</para>
<para>Some examples:
</para>
<informaltable><tgroup cols="3"><colspec colwidth="40*"></colspec><colspec colwidth="5*"></colspec><colspec colwidth="40*"></colspec><tbody><row><entry><para><literal>{1, 2, 3} * {4; 5; 6}</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>32</literal>
</para></entry></row><row><entry><para><literal>{4; 5; 6} * {1, 2, 3}</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{4,&#160;<!-- /@w --> 8, 12;
&#160;<!-- /@w -->5, 10, 15;
&#160;<!-- /@w -->6, 12, 18}</literal>
</para></entry></row></tbody></tgroup></informaltable>
</sect3>
<sect3 label="16.4.1.7" id="Matrix-Exponentiation-Operator">
<title>Matrix Exponentiation Operator <literal>**</literal></title>
<para>The result of <literal>A**B</literal> is defined as follows when <literal>A</literal> is a
square matrix and <literal>B</literal> is an integer scalar:
</para>
<itemizedlist><listitem><para>For <literal>B > 0</literal>, <literal>A**B</literal> is <literal>A*…*A</literal>, where there are
<literal>B</literal> ‘<literal>A</literal>’s. (PSPP implements this efficiently for large
<literal>B</literal>, using exponentiation by squaring.)
</para>
</listitem><listitem><para>For <literal>B < 0</literal>, <literal>A**B</literal> is <literal>INV(A**(-B))</literal>.
</para>
</listitem><listitem><para>For <literal>B = 0</literal>, <literal>A**B</literal> is the identity matrix.
</para></listitem></itemizedlist>
<para>PSPP reports an error if <literal>A</literal> is not square or <literal>B</literal> is not
an integer.
</para>
<para>Examples:
</para>
<informaltable><tgroup cols="3"><colspec colwidth="40*"></colspec><colspec colwidth="5*"></colspec><colspec colwidth="40*"></colspec><tbody><row><entry><para><literal>{2, 5; 1, 4}**3</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{48, 165; 33, 114}</literal>
</para></entry></row><row><entry><para><literal>{2, 5; 1, 4}**0</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{1, 0; 0, 1}</literal>
</para></entry></row><row><entry><para><literal>10*{4, 7; 2, 6}**-1</literal> </para></entry><entry><para>⇒ </para></entry><entry><para><literal>{6, -7; -2, 4}</literal>
</para></entry></row></tbody></tgroup></informaltable>
</sect3>
</sect2>
<sect2 label="16.4.2" id="Matrix-Functions">
<title>Matrix Functions</title>
<para>The matrix language support numerous functions in multiple categories.
The following subsections document each of the currently supported
functions. The first letter of each parameter’s name indicate the
required argument type:
</para>
<variablelist><varlistentry><term><replaceable>s</replaceable>
</term><listitem><para>A scalar.
</para>
</listitem></varlistentry><varlistentry><term><replaceable>n</replaceable>
</term><listitem><para>A nonnegative integer scalar. (Non-integers are accepted and silently
rounded down to the nearest integer.)
</para>
</listitem></varlistentry><varlistentry><term><replaceable>V</replaceable>
</term><listitem><para>A row or column vector.
</para>
</listitem></varlistentry><varlistentry><term><replaceable>M</replaceable>
</term><listitem><para>A matrix.
</para></listitem></varlistentry></variablelist>
<sect3 label="16.4.2.1" id="Matrix-Elementwise-Functions">
<title>Elementwise Functions</title>
<para>These functions act on each element of their argument independently,
like the elementwise operators (see <link linkend="Matrix-Elementwise-Binary-Operators">Matrix Elementwise Binary
Operators</link>).
</para>
<synopsis><indexterm role="fn"><primary>ABS</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>ABS</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><para>Takes the absolute value of each element of <replaceable>M</replaceable>.
</para>
<para><literal>ABS({-1, 2; -3, 0}) ⇒ {1, 2; 3, 0}</literal>
</para></blockquote>
<synopsis><indexterm role="fn"><primary>ARSIN</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>ARSIN</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>ARTAN</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>ARTAN</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><para>Computes the inverse sine or tangent, respectively, of each element in
<replaceable>M</replaceable>. The results are in radians, between <inlineequation><mathphrase>-\pi/2</mathphrase></inlineequation> and
<inlineequation><mathphrase>+\pi/2</mathphrase></inlineequation>, inclusive.
</para>
<para>The value of <inlineequation><mathphrase>\pi</mathphrase></inlineequation> can be computed as <literal>4*ARTAN(1)</literal>.
</para>
<para><literal>ARSIN({-1, 0, 1}) ⇒ {-1.57, 0, 1.57}</literal> (approximately)
</para>
<para><literal>ARTAN({-5, -1, 1, 5}) ⇒ {-1.37, -.79, .79, 1.37}</literal> (approximately)
</para></blockquote>
<synopsis><indexterm role="fn"><primary>COS</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>COS</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>SIN</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>SIN</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><para>Computes the cosine or sine, respectively, of each element in <replaceable>M</replaceable>,
which must be in radians.
</para>
<para><literal>COS({0.785, 1.57; 3.14, 1.57 + 3.14}) ⇒ {.71, 0; -1, 0}</literal> (approximately)
</para></blockquote>
<synopsis><indexterm role="fn"><primary>EXP</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>EXP</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><para>Computes <inlineequation><mathphrase>e^x</mathphrase></inlineequation> for each element <replaceable>x</replaceable> in <replaceable>M</replaceable>.
</para>
<para><literal>EXP({2, 3; 4, 5}) ⇒ {7.39, 20.09; 54.6, 148.4}</literal> (approximately)
</para></blockquote>
<synopsis><indexterm role="fn"><primary>LG10</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>LG10</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>LN</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>LN</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><para>Takes the logarithm with base 10 or base <inlineequation><mathphrase>e</mathphrase></inlineequation>, respectively, of
each element in <replaceable>M</replaceable>.
</para>
<para><literal>LG10({1, 10, 100, 1000}) ⇒ {0, 1, 2, 3}</literal>
<literal>LG10(0) ⇒</literal> (error)
</para>
<para><literal>LN({EXP(1), 1, 2, 3, 4}) ⇒ {1, 0, .69, 1.1, 1.39}</literal> (approximately)
<literal>LN(0) ⇒</literal> (error)
</para></blockquote>
<synopsis><indexterm role="fn"><primary>MOD</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>MOD</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>, <emphasis role="arg"><replaceable>s</replaceable></emphasis>)</synopsis>
<blockquote><para>Takes each element in <replaceable>M</replaceable> modulo nonzero scalar value <replaceable>s</replaceable>,
that is, the remainder of division by <replaceable>s</replaceable>. The sign of the result
is the same as the sign of the dividend.
</para>
<para><literal>MOD({5, 4, 3, 2, 1, 0}, 3) ⇒ {2, 1, 0, 2, 1, 0}</literal>
<literal>MOD({5, 4, 3, 2, 1, 0}, -3) ⇒ {2, 1, 0, 2, 1, 0}</literal>
<literal>MOD({-5, -4, -3, -2, -1, 0}, 3) ⇒ {-2, -1, 0, -2, -1, 0}</literal>
<literal>MOD({-5, -4, -3, -2, -1, 0}, -3) ⇒ {-2, -1, 0, -2, -1, 0}</literal>
<literal>MOD({5, 4, 3, 2, 1, 0}, 1.5) ⇒ {.5, 1.0, .0, .5, 1.0, .0}</literal>
<literal>MOD({5, 4, 3, 2, 1, 0}, 0) ⇒</literal> (error)
</para></blockquote>
<synopsis><indexterm role="fn"><primary>RND</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>RND</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>TRUNC</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>TRUNC</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><para>Rounds each element of <replaceable>M</replaceable> to an integer. <literal>RND</literal> rounds to
the nearest integer, with halves rounded to even integers, and
<literal>TRUNC</literal> rounds toward zero.
</para>
<para><literal>RND({-1.6, -1.5, -1.4}) ⇒ {-2, -2, -1}</literal>
<literal>RND({-.6, -.5, -.4}) ⇒ {-1, 0, 0}</literal>
<literal>RND({.4, .5, .6} ⇒ {0, 0, 1}</literal>
<literal>RND({1.4, 1.5, 1.6}) ⇒ {1, 2, 2}</literal>
</para>
<para><literal>TRUNC({-1.6, -1.5, -1.4}) ⇒ {-1, -1, -1}</literal>
<literal>TRUNC({-.6, -.5, -.4}) ⇒ {0, 0, 0}</literal>
<literal>TRUNC({.4, .5, .6} ⇒ {0, 0, 0}</literal>
<literal>TRUNC({1.4, 1.5, 1.6}) ⇒ {1, 1, 1}</literal>
</para></blockquote>
<synopsis><indexterm role="fn"><primary>SQRT</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>SQRT</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><para>Takes the square root of each element of <replaceable>M</replaceable>, which must not be
negative.
</para>
<para><literal>SQRT({0, 1, 2, 4, 9, 81}) ⇒ {0, 1, 1.41, 2, 3, 9}</literal> (approximately)
<literal>SQRT(-1) ⇒</literal> (error)
</para></blockquote>
</sect3>
<sect3 label="16.4.2.2" id="Matrix-Logical-Functions">
<title>Logical Functions</title>
<synopsis><indexterm role="fn"><primary>ALL</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>ALL</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns a scalar with value 1 if all of the elements in <replaceable>M</replaceable> are
nonzero, or 0 if at least one element is zero.
</para>
<para><literal>ALL({1, 2, 3} < {2, 3, 4}) ⇒ 1</literal>
<literal>ALL({2, 2, 3} < {2, 3, 4}) ⇒ 0</literal>
<literal>ALL({2, 3, 3} < {2, 3, 4}) ⇒ 0</literal>
<literal>ALL({2, 3, 4} < {2, 3, 4}) ⇒ 0</literal>
</para></blockquote>
<synopsis><indexterm role="fn"><primary>ANY</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>ANY</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns a scalar with value 1 if any of the elements in <replaceable>M</replaceable> is
nonzero, or 0 if all of them are zero.
</para>
<para><literal>ANY({1, 2, 3} < {2, 3, 4}) ⇒ 1</literal>
<literal>ANY({2, 2, 3} < {2, 3, 4}) ⇒ 1</literal>
<literal>ANY({2, 3, 3} < {2, 3, 4}) ⇒ 1</literal>
<literal>ANY({2, 3, 4} < {2, 3, 4}) ⇒ 0</literal>
</para></blockquote>
</sect3>
<sect3 label="16.4.2.3" id="Matrix-Construction-Functions">
<title>Matrix Construction Functions</title>
<synopsis><indexterm role="fn"><primary>BLOCK</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>BLOCK</function> (<emphasis role="arg"><replaceable>M1</replaceable></emphasis>, <emphasis role="arg">…</emphasis>, <emphasis role="arg"><replaceable>Mn</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns a block diagonal matrix with as many rows as the sum of its
arguments’ row counts and as many columns as the sum of their columns.
Each argument matrix is placed along the main diagonal of the result,
and all other elements are zero.
</para>
<literallayout><literal>BLOCK({1, 2; 3, 4}, 5, {7; 8; 9}, {10, 11}) ⇒
1 2 0 0 0 0
3 4 0 0 0 0
0 0 5 0 0 0
0 0 0 7 0 0
0 0 0 8 0 0
0 0 0 9 0 0
0 0 0 0 10 11</literal>
</literallayout></blockquote>
<synopsis><indexterm role="fn"><primary>IDENT</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>IDENT</function> (<emphasis role="arg"><replaceable>n</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>IDENT</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>IDENT</function> (<emphasis role="arg"><replaceable>nr</replaceable></emphasis>, <emphasis role="arg"><replaceable>nc</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns an identity matrix, whose main diagonal elements are one and
whose other elements are zero. The returned matrix has <replaceable>n</replaceable> rows
and columns or <replaceable>nr</replaceable> rows and <replaceable>nc</replaceable> columns, respectively.
</para>
<literallayout><literal>IDENT(1) ⇒ 1
IDENT(2) ⇒
1 0
0 1
IDENT(3, 5) ⇒
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
IDENT(5, 3) ⇒
1 0 0
0 1 0
0 0 1
0 0 0
0 0 0</literal>
</literallayout></blockquote>
<synopsis><indexterm role="fn"><primary>MAGIC</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>MAGIC</function> (<emphasis role="arg"><replaceable>n</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns an <inlineequation><mathphrase><replaceable>n</replaceable>×<replaceable>n</replaceable></mathphrase></inlineequation> matrix that contains each of
the integers <inlineequation><mathphrase>1…<replaceable>n</replaceable></mathphrase></inlineequation> once, in which each column, each
row, and each diagonal sums to <inlineequation><mathphrase>n(n^2+1)/2</mathphrase></inlineequation>. There are many
magic squares with given dimensions, but this function always returns
the same one for a given value of <replaceable>n</replaceable>.
</para>
<para><literal>MAGIC(3) ⇒ {8, 1, 6; 3, 5, 7; 4, 9, 2}</literal>
<literal>MAGIC(4) ⇒ {1, 5, 12, 16; 15, 11, 6, 2; 14, 8, 9, 3; 4, 10, 7, 13}</literal>
</para></blockquote>
<synopsis><indexterm role="fn"><primary>MAKE</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>MAKE</function> (<emphasis role="arg"><replaceable>nr</replaceable></emphasis>, <emphasis role="arg"><replaceable>nc</replaceable></emphasis>, <emphasis role="arg"><replaceable>s</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns an <inlineequation><mathphrase><replaceable>nr</replaceable>×<replaceable>nc</replaceable></mathphrase></inlineequation> matrix whose elements are
all <replaceable>s</replaceable>.
</para>
<para><literal>MAKE(1, 2, 3) ⇒ {3, 3}</literal>
<literal>MAKE(2, 1, 4) ⇒ {4; 4}</literal>
<literal>MAKE(2, 3, 5) ⇒ {5, 5, 5; 5, 5, 5}</literal>
</para></blockquote>
<synopsis><indexterm role="fn"><primary>MDIAG</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>MDIAG</function> (<emphasis role="arg"><replaceable>V</replaceable></emphasis>)</synopsis>
<blockquote><anchor id="MDIAG"/><para>Given <replaceable>n</replaceable>-element vector <replaceable>V</replaceable>, returns a
<inlineequation><mathphrase><replaceable>n</replaceable>×<replaceable>n</replaceable></mathphrase></inlineequation> matrix whose main diagonal is copied
from <replaceable>V</replaceable>. The other elements in the returned vector are zero.
</para>
<para>Use <literal>CALL SETDIAG</literal> (see <link linkend="CALL-SETDIAG">CALL SETDIAG</link>) to replace the main
diagonal of a matrix in-place.
</para>
<literallayout><literal>MDIAG({1, 2, 3, 4}) ⇒
1 0 0 0
0 2 0 0
0 0 3 0
0 0 0 4</literal>
</literallayout></blockquote>
<synopsis><indexterm role="fn"><primary>RESHAPE</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>RESHAPE</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>, <emphasis role="arg"><replaceable>nr</replaceable></emphasis>, <emphasis role="arg"><replaceable>nc</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns an <inlineequation><mathphrase><replaceable>nr</replaceable>×<replaceable>nc</replaceable></mathphrase></inlineequation> matrix whose elements come
from <replaceable>M</replaceable>, which must have the same number of elements as the new
matrix, copying elements from <replaceable>M</replaceable> to the new matrix row by row.
</para>
<literallayout><literal>RESHAPE(1:12, 1, 12) ⇒
1 2 3 4 5 6 7 8 9 10 11 12
RESHAPE(1:12, 2, 6) ⇒
1 2 3 4 5 6
7 8 9 10 11 12
RESHAPE(1:12, 3, 4) ⇒
1 2 3 4
5 6 7 8
9 10 11 12
RESHAPE(1:12, 4, 3) ⇒
1 2 3
4 5 6
7 8 9
10 11 12</literal>
</literallayout></blockquote>
<synopsis><indexterm role="fn"><primary>T</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>T</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>TRANSPOS</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>TRANSPOS</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns <replaceable>M</replaceable> with rows exchanged for columns.
</para>
<para><literal>T({1, 2, 3}) ⇒ {1; 2; 3}</literal>
<literal>T({1; 2; 3}) ⇒ {1, 2, 3}</literal>
</para></blockquote>
<synopsis><indexterm role="fn"><primary>UNIFORM</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>UNIFORM</function> (<emphasis role="arg"><replaceable>nr</replaceable></emphasis>, <emphasis role="arg"><replaceable>nc</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns a <inlineequation><mathphrase><replaceable>nr</replaceable>×<replaceable>nc</replaceable></mathphrase></inlineequation> matrix in which each element
is randomly chosen from a uniform distribution of real numbers between
0 and 1. Random number generation honors the current seed setting
(see <link linkend="SET-SEED">SET SEED</link>).
</para>
<para>The following example shows one possible output, but of course every
result will be different (given different seeds):
</para>
<literallayout><literal>UNIFORM(4, 5)*10 ⇒
7.71 2.99 .21 4.95 6.34
4.43 7.49 8.32 4.99 5.83
2.25 .25 1.98 7.09 7.61
2.66 1.69 2.64 .88 1.50</literal>
</literallayout></blockquote>
</sect3>
<sect3 label="16.4.2.4" id="Matrix-Minimum-and-Maximum-and-Sum-Functions">
<title>Minimum, Maximum, and Sum Functions</title>
<synopsis><indexterm role="fn"><primary>CMIN</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>CMIN</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>CMAX</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>CMAX</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>CSUM</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>CSUM</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>CSSQ</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>CSSQ</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns a row vector with the same number of columns as <replaceable>M</replaceable>, in
which each element is the minimum, maximum, sum, or sum of squares,
respectively, of the elements in the same column of <replaceable>M</replaceable>.
</para>
<para><literal>CMIN({1, 2, 3; 4, 5, 6; 7, 8, 9} ⇒ {1, 2, 3}</literal>
<literal>CMAX({1, 2, 3; 4, 5, 6; 7, 8, 9} ⇒ {7, 8, 9}</literal>
<literal>CSUM({1, 2, 3; 4, 5, 6; 7, 8, 9} ⇒ {12, 15, 18}</literal>
<literal>CSSQ({1, 2, 3; 4, 5, 6; 7, 8, 9} ⇒ {66, 93, 126}</literal>
</para></blockquote>
<synopsis><indexterm role="fn"><primary>MMIN</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>MMIN</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>MMAX</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>MMAX</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>MSUM</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>MSUM</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>MSSQ</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>MSSQ</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns the minimum, maximum, sum, or sum of squares, respectively, of
the elements of <replaceable>M</replaceable>.
</para>
<para><literal>MMIN({1, 2, 3; 4, 5, 6; 7, 8, 9} ⇒ 1</literal>
<literal>MMAX({1, 2, 3; 4, 5, 6; 7, 8, 9} ⇒ 9</literal>
<literal>MSUM({1, 2, 3; 4, 5, 6; 7, 8, 9} ⇒ 45</literal>
<literal>MSSQ({1, 2, 3; 4, 5, 6; 7, 8, 9} ⇒ 285</literal>
</para></blockquote>
<synopsis><indexterm role="fn"><primary>RMIN</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>RMIN</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RMAX</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>RMAX</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RSUM</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>RSUM</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>RSSQ</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>RSSQ</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns a column vector with the same number of rows as <replaceable>M</replaceable>, in
which each element is the minimum, maximum, sum, or sum of squares,
respectively, of the elements in the same row of <replaceable>M</replaceable>.
</para>
<para><literal>RMIN({1, 2, 3; 4, 5, 6; 7, 8, 9} ⇒ {1; 4; 7}</literal>
<literal>RMAX({1, 2, 3; 4, 5, 6; 7, 8, 9} ⇒ {3; 6; 9}</literal>
<literal>RSUM({1, 2, 3; 4, 5, 6; 7, 8, 9} ⇒ {6; 15; 24}</literal>
<literal>RSSQ({1, 2, 3; 4, 5, 6; 7, 8, 9} ⇒ {14; 77; 194}</literal>
</para></blockquote>
<synopsis><indexterm role="fn"><primary>SSCP</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>SSCP</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns <inlineequation><mathphrase><replaceable>M</replaceable>^T × <replaceable>M</replaceable></mathphrase></inlineequation>.
</para>
<para><literal>SSCP({1, 2, 3; 4, 5, 6}) ⇒ {17, 22, 27; 22, 29, 36; 27, 36, 45}</literal>
</para></blockquote>
<synopsis><indexterm role="fn"><primary>TRACE</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>TRACE</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns the sum of the elements along <replaceable>M</replaceable>’s main diagonal,
equivalent to <literal>MSUM(DIAG(<replaceable>M</replaceable>))</literal>.
</para>
<para><literal>TRACE(MDIAG(1:5)) ⇒ 15</literal>
</para></blockquote>
</sect3>
<sect3 label="16.4.2.5" id="Matrix-Property-Functions">
<title>Matrix Property Functions</title>
<synopsis><indexterm role="fn"><primary>NROW</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>NROW</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<synopsis><indexterm role="fn"><primary>NCOL</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>NCOL</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns the number of row or columns, respectively, in <replaceable>M</replaceable>.
</para>
<literallayout><literal>NROW({1, 0; -2, -3; 3, 3}) ⇒ 3
NROW(1:5) ⇒ 1
NCOL({1, 0; -2, -3; 3, 3}) ⇒ 2
NCOL(1:5) ⇒ 5</literal>
</literallayout></blockquote>
<synopsis><indexterm role="fn"><primary>DIAG</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>DIAG</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns a column vector containing a copy of <replaceable>M</replaceable>’s main diagonal.
The vector’s length is the lesser of <literal>NCOL(<replaceable>M</replaceable>)</literal> and
<literal>NROW(<replaceable>M</replaceable>)</literal>.
</para>
<para><literal>DIAG({1, 0; -2, -3; 3, 3}) ⇒ {1; -3}</literal>
</para></blockquote>
</sect3>
<sect3 label="16.4.2.6" id="Matrix-Rank-Ordering-Functions">
<title>Matrix Rank Ordering Functions</title>
<para>The <literal>GRADE</literal> and <literal>RANK</literal> functions each take a matrix <replaceable>M</replaceable>
and return a matrix <replaceable>r</replaceable> with the same dimensions. Each element in
<replaceable>r</replaceable> ranges between 1 and the number of elements <replaceable>n</replaceable> in
<replaceable>M</replaceable>, inclusive. When the elements in <replaceable>M</replaceable> all have unique
values, both of these functions yield the same results: the smallest
element in <replaceable>M</replaceable> corresponds to value 1 in <replaceable>r</replaceable>, the next
smallest to 2, and so on, up to the largest to <replaceable>n</replaceable>. When multiple
elements in <replaceable>M</replaceable> have the same value, these functions use different
rules for handling the ties.
</para>
<synopsis><indexterm role="fn"><primary>GRADE</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>GRADE</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns a ranking of <replaceable>M</replaceable>, turning duplicate values into sequential
ranks. The returned matrix always contains each of the integers 1
through the number of elements in the matrix exactly once.
</para>
<para><literal>GRADE({1, 0, 3; 3, 1, 2; 3, 0, 5})</literal> ⇒ <literal>{3, 1, 6; 7, 4, 5; 8, 2, 9}</literal>
</para></blockquote>
<synopsis><indexterm role="fn"><primary>RNKORDER</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>RNKORDER</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns a ranking of <replaceable>M</replaceable>, turning duplicate values into the mean
of their sequential ranks.
</para>
<para><literal>RNKORDER({1, 0, 3; 3, 1, 2; 3, 0, 5})</literal>
&#160;<!-- /@w -->⇒ <literal>{3.5, 1.5, 7; 7, 3.5, 5; 7, 1.5, 9}</literal>
</para></blockquote>
<para>One may use <literal>GRADE</literal> to sort a vector:
</para>
<screen>COMPUTE v(GRADE(v))=v. /* Sort v in ascending order.
COMPUTE v(GRADE(-v))=v. /* Sort v in descending order.
</screen>
</sect3>
<sect3 label="16.4.2.7" id="Matrix-Algebra-Functions">
<title>Matrix Algebra Functions</title>
<synopsis><indexterm role="fn"><primary>CHOL</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>CHOL</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><para>Matrix <replaceable>M</replaceable> must be an <inlineequation><mathphrase><replaceable>n</replaceable>×<replaceable>n</replaceable></mathphrase></inlineequation> symmetric
positive-definite matrix. Returns an <inlineequation><mathphrase><replaceable>n</replaceable>×<replaceable>n</replaceable></mathphrase></inlineequation>
matrix <replaceable>B</replaceable> such that <inlineequation><mathphrase><replaceable>B</replaceable>^T×<replaceable>B</replaceable>=<replaceable>M</replaceable></mathphrase></inlineequation>.
</para>
<literallayout><literal>CHOL({4, 12, -16; 12, 37, -43; -16, -43, 98}) ⇒
2 6 -8
0 1 5
0 0 3</literal>
</literallayout></blockquote>
<synopsis><indexterm role="fn"><primary>DESIGN</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>DESIGN</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns a design matrix for <replaceable>M</replaceable>. The design matrix has the same
number of rows as <replaceable>M</replaceable>. Each column <replaceable>c</replaceable> in <replaceable>M</replaceable>, from left
to right, yields a group of columns in the output. For each unique
value <replaceable>v</replaceable> in <replaceable>c</replaceable>, from top to bottom, add a column to the
output in which <replaceable>v</replaceable> becomes 1 and other values become 0.
</para>
<para>PSPP issues a warning if a column only contains a single unique value.
</para>
<literallayout><literal>DESIGN({1; 2; 3}) ⇒ {1, 0, 0; 0, 1, 0; 0, 0, 1}</literal>
<literal>DESIGN({5; 8; 5}) ⇒ {1, 0; 0, 1; 1, 0}</literal>
<literal>DESIGN({1, 5; 2, 8; 3, 5})</literal>
⇒ <literal>{1, 0, 0, 1, 0; 0, 1, 0, 0, 1; 0, 0, 1, 1, 0}</literal>
<literal>DESIGN({5; 5; 5})</literal> ⇒ (warning)
</literallayout></blockquote>
<synopsis><indexterm role="fn"><primary>DET</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>DET</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns the determinant of square matrix <replaceable>M</replaceable>.
</para>
<para><literal>DET({3, 7; 1, -4}) ⇒ -19</literal>
</para></blockquote>
<synopsis><indexterm role="fn"><primary>EVAL</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>EVAL</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><anchor id="EVAL"/><para>Returns a column vector containing the eigenvalues of symmetric matrix
<replaceable>M</replaceable>, sorted in ascending order.
</para>
<para>Use <literal>CALL EIGEN</literal> (see <link linkend="CALL-EIGEN">CALL EIGEN</link>) to compute eigenvalues and
eigenvectors of a matrix.
</para>
<para><literal>EVAL({2, 0, 0; 0, 3, 4; 0, 4, 9}) ⇒ {11; 2; 1}</literal>
</para></blockquote>
<synopsis><indexterm role="fn"><primary>GINV</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>GINV</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns the <inlineequation><mathphrase><replaceable>k</replaceable>×<replaceable>n</replaceable></mathphrase></inlineequation> matrix <replaceable>A</replaceable> that is the
<firstterm>generalized inverse</firstterm> of <inlineequation><mathphrase><replaceable>n</replaceable>×<replaceable>k</replaceable></mathphrase></inlineequation> matrix
<replaceable>M</replaceable>, defined such that
<inlineequation><mathphrase><replaceable>M</replaceable>×<replaceable>A</replaceable>×<replaceable>M</replaceable>=<replaceable>M</replaceable></mathphrase></inlineequation> and
<inlineequation><mathphrase><replaceable>A</replaceable>×<replaceable>M</replaceable>×<replaceable>A</replaceable>=<replaceable>A</replaceable></mathphrase></inlineequation>.
</para>
<para><literal>GINV({1, 2}) ⇒ {.2; .4}</literal> (approximately)
<literal>{1:9} * GINV(1:9) * {1:9} ⇒ {1:9}</literal> (approximately)
</para></blockquote>
<synopsis><indexterm role="fn"><primary>GSCH</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>GSCH</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><para><replaceable>M</replaceable> must be a <inlineequation><mathphrase><replaceable>n</replaceable>×<replaceable>m</replaceable></mathphrase></inlineequation> matrix, <inlineequation><mathphrase><replaceable>m</replaceable>
≥ <replaceable>n</replaceable></mathphrase></inlineequation>, with rank <replaceable>n</replaceable>. Returns an
<inlineequation><mathphrase><replaceable>n</replaceable>×<replaceable>n</replaceable></mathphrase></inlineequation> orthonormal basis for <replaceable>M</replaceable>, obtained
using the Gram-Schmidt process.
</para>
<para><literal>GSCH({3, 2; 1, 2}) * SQRT(10) ⇒ {3, -1; 1, 3}</literal> (approximately)
</para></blockquote>
<synopsis><indexterm role="fn"><primary>INV</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>INV</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns the <inlineequation><mathphrase><replaceable>n</replaceable>×<replaceable>n</replaceable></mathphrase></inlineequation> matrix <replaceable>A</replaceable> that is the
inverse of <inlineequation><mathphrase><replaceable>n</replaceable>×<replaceable>n</replaceable></mathphrase></inlineequation> matrix <replaceable>M</replaceable>, defined such
that <inlineequation><mathphrase><replaceable>M</replaceable>×<replaceable>A</replaceable> = <replaceable>A</replaceable>×<replaceable>M</replaceable> = I</mathphrase></inlineequation>, where
<replaceable>I</replaceable> is the identity matrix. <replaceable>M</replaceable> must not be singular, that
is, <inlineequation><mathphrase>\det(<replaceable>M</replaceable>) ≠0</mathphrase></inlineequation>.
</para>
<para><literal>INV({4, 7; 2, 6}) ⇒ {.6, -.7; -.2, .4}</literal> (approximately)
</para></blockquote>
<synopsis><indexterm role="fn"><primary>KRONEKER</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>KRONEKER</function> (<emphasis role="arg"><replaceable>Ma</replaceable></emphasis>, <emphasis role="arg"><replaceable>Mb</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns the <inlineequation><mathphrase><replaceable>pm</replaceable>×<replaceable>qn</replaceable></mathphrase></inlineequation> matrix <replaceable>P</replaceable> that is the
<firstterm>Kroneker product</firstterm> of <inlineequation><mathphrase><replaceable>m</replaceable>×<replaceable>n</replaceable></mathphrase></inlineequation> matrix
<replaceable>Ma</replaceable> and <inlineequation><mathphrase><replaceable>p</replaceable>×<replaceable>q</replaceable></mathphrase></inlineequation> matrix <replaceable>Mb</replaceable>. One may
view <replaceable>P</replaceable> as the concatenation of multiple
<inlineequation><mathphrase><replaceable>p</replaceable>×<replaceable>q</replaceable></mathphrase></inlineequation> blocks, each of which is the scalar
product of <replaceable>Mb</replaceable> by a different element of <replaceable>Ma</replaceable>. For example,
when <literal>A</literal> is a <inlineequation><mathphrase>2×2</mathphrase></inlineequation> matrix, <literal>KRONEKER(A, B)</literal> is
equivalent to <literal>{A(1,1)*B, A(1,2)*B; A(2,1)*B, A(2,2)*B}</literal>.
</para>
<literallayout><literal>KRONEKER({1, 2; 3, 4}, {0, 5; 6, 7}) ⇒
0 5 0 10
6 7 12 14
0 15 0 20
18 21 24 28</literal>
</literallayout></blockquote>
<synopsis><indexterm role="fn"><primary>RANK</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>RANK</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><para>Returns the rank of matrix <replaceable>M</replaceable>, an integer scalar whose value is
the dimension of the vector space spanned by its columns or,
equivalently, by its rows.
</para>
<literallayout><literal>RANK({1, 0, 1; -2, -3, 1; 3, 3, 0}) ⇒ 2
RANK({1, 1, 0, 2; -1, -1, 0, -2}) ⇒ 1
RANK({1, -1; 1, -1; 0, 0; 2, -2}) ⇒ 1
RANK({1, 2, 1; -2, -3, 1; 3, 5, 0}) ⇒ 2
RANK({1, 0, 2; 2, 1, 0; 3, 2, 1}) ⇒ 3</literal>
</literallayout></blockquote>
<synopsis><indexterm role="fn"><primary>SOLVE</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>SOLVE</function> (<emphasis role="arg"><replaceable>Ma</replaceable></emphasis>, <emphasis role="arg"><replaceable>Mb</replaceable></emphasis>)</synopsis>
<blockquote><para><replaceable>Ma</replaceable> must be an <inlineequation><mathphrase><replaceable>n</replaceable>×<replaceable>n</replaceable></mathphrase></inlineequation> matrix, with
<inlineequation><mathphrase>\det(<replaceable>Ma</replaceable>) ≠0</mathphrase></inlineequation>, and <replaceable>Mb</replaceable> an
<inlineequation><mathphrase><replaceable>n</replaceable>×<replaceable>k</replaceable></mathphrase></inlineequation> matrix. Returns an
<inlineequation><mathphrase><replaceable>n</replaceable>×<replaceable>k</replaceable></mathphrase></inlineequation> matrix <replaceable>X</replaceable> such that <inlineequation><mathphrase><replaceable>Ma</replaceable>
× <replaceable>X</replaceable> = <replaceable>Mb</replaceable></mathphrase></inlineequation>.
</para>
<para>All of the following examples show approximate results:
</para>
<literallayout><literal>SOLVE({2, 3; 4, 9}, {6, 2; 15, 5}) ⇒
1.50 .50
1.00 .33
SOLVE({1, 3, -2; 3, 5, 6; 2, 4, 3}, {5; 7; 8}) ⇒
-15.00
8.00
2.00
SOLVE({2, 1, -1; -3, -1, 2; -2, 1, 2}, {8; -11; -3}) ⇒
2.00
3.00
-1.00</literal>
</literallayout></blockquote>
<synopsis><indexterm role="fn"><primary>SVAL</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>SVAL</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>)</synopsis>
<blockquote><anchor id="SVAL"/>
<para>Given <inlineequation><mathphrase><replaceable>n</replaceable>×<replaceable>k</replaceable></mathphrase></inlineequation> matrix <replaceable>M</replaceable>, returns a
<inlineequation><mathphrase>\min(<replaceable>n</replaceable>,<replaceable>k</replaceable>)</mathphrase></inlineequation>-element column vector containing the
singular values of <replaceable>M</replaceable> in descending order.
</para>
<para>Use <literal>CALL SVD</literal> (see <link linkend="CALL-SVD">CALL SVD</link>) to compute the full singular
value decomposition of a matrix.
</para>
<literallayout><literal>SVAL({1, 1; 0, 0}) ⇒ {1.41; .00}
SVAL({1, 0, 1; 0, 1, 1; 0, 0, 0}) ⇒ {1.73; 1.00; .00}
SVAL({2, 4; 1, 3; 0, 0; 0, 0}) ⇒ {5.46; .37}</literal>
</literallayout></blockquote>
<synopsis><indexterm role="fn"><primary>SWEEP</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>SWEEP</function> (<emphasis role="arg"><replaceable>M</replaceable></emphasis>, <emphasis role="arg"><replaceable>nk</replaceable></emphasis>)</synopsis>
<blockquote><para>Given <inlineequation><mathphrase><replaceable>r</replaceable>×<replaceable>c</replaceable></mathphrase></inlineequation> matrix <replaceable>M</replaceable> and integer scalar
<inlineequation><mathphrase>k = <replaceable>nk</replaceable></mathphrase></inlineequation> such that <inlineequation><mathphrase>1 ≤ k ≤
\min(<replaceable>r</replaceable>,<replaceable>c</replaceable>)</mathphrase></inlineequation>, returns the <inlineequation><mathphrase><replaceable>r</replaceable>×<replaceable>c</replaceable></mathphrase></inlineequation>
sweep matrix <replaceable>A</replaceable>.
</para>
<para>If <inlineequation><mathphrase><replaceable>M</replaceable>_{kk} ≠0</mathphrase></inlineequation>, then:
</para>
<literallayout><inlineequation><mathphrase><replaceable>A</replaceable>_{kk} = 1/<replaceable>M</replaceable>_{kk}</mathphrase></inlineequation>,
<inlineequation><mathphrase><replaceable>A</replaceable>_{ik} = -<replaceable>M</replaceable>_{ik}/<replaceable>M</replaceable>_{kk} for i ≠k</mathphrase></inlineequation>,
<inlineequation><mathphrase><replaceable>A</replaceable>_{kj} = <replaceable>M</replaceable>_{kj}/<replaceable>M</replaceable>_{kk} for j ≠k, and</mathphrase></inlineequation>
<inlineequation><mathphrase><replaceable>A</replaceable>_{ij} = <replaceable>M</replaceable>_{ij} - <replaceable>M</replaceable>_{ik}<replaceable>M</replaceable>_{kj}/<replaceable>M</replaceable>_{kk} for i ≠k and j ≠k</mathphrase></inlineequation>.
</literallayout>
<para>If <inlineequation><mathphrase><replaceable>M</replaceable>_{kk} = 0</mathphrase></inlineequation>, then:
</para>
<literallayout><inlineequation><mathphrase><replaceable>A</replaceable>_{ik} = <replaceable>A</replaceable>_{ki} = 0 and</mathphrase></inlineequation>
<inlineequation><mathphrase><replaceable>A</replaceable>_{ij} = <replaceable>M</replaceable>_{ij}, for i ≠k and j ≠k</mathphrase></inlineequation>.
</literallayout>
<para>Given <literal>M = {0, 1, 2; 3, 4, 5; 6, 7, 8}</literal>, then (approximately):
</para>
<literallayout><literal>SWEEP(M, 1) ⇒
.00 .00 .00
.00 4.00 5.00
.00 7.00 8.00
SWEEP(M, 2) ⇒
-.75 -.25 .75
.75 .25 1.25
.75 -1.75 -.75
SWEEP(M, 3) ⇒
-1.50 -.75 -.25
-.75 -.38 -.63
.75 .88 .13</literal>
</literallayout></blockquote>
</sect3>
<sect3 label="16.4.2.8" id="Matrix-Statistical-Distribution-Functions">
<title>Matrix Statistical Distribution Functions</title>
<para>The matrix language can calculate several functions of standard
statistical distributions using the same syntax and semantics as in
PSPP transformation expressions. See <link linkend="Statistical-Distribution-Functions">Statistical Distribution
Functions</link>, for details.
</para>
<para>The matrix language extends the PDF, CDF, SIG, IDF, NPDF, and NCDF
functions by allowing the first parameters to each of these functions
to be a vector or matrix with any dimensions. In addition,
<literal>CDF.BVNOR</literal> and <literal>PDF.BVNOR</literal> allow either or both of their
first two parameters to be vectors or matrices; if both are non-scalar
then they must have the same dimensions. In each case, the result is
a matrix or vector with the same dimensions as the input populated
with elementwise calculations.
</para>
</sect3>
<sect3 label="16.4.2.9" id="Matrix-EOF-Function">
<title>EOF Function</title>
<para>This function works with files being used on the <literal>READ</literal> statement.
</para>
<synopsis><indexterm role="fn"><primary>EOF</primary></indexterm><phrase role="category"><emphasis role="bold">Matrix Function</emphasis>:</phrase> <function>EOF</function> (<emphasis role="arg"><replaceable>file</replaceable></emphasis>)</synopsis>
<blockquote><anchor id="EOF-Matrix-Function"/>
<para>Given a file handle or file name <replaceable>file</replaceable>, returns an integer scalar
1 if the last line in the file has been read or 0 if more lines are
available. Determining this requires attempting to read another line,
which means that <literal>REREAD</literal> on the next <literal>READ</literal> command
following <literal>EOF</literal> on the same file will be ineffective.
</para></blockquote>
<para>The <literal>EOF</literal> function gives a matrix program the flexibility to read
a file with text data without knowing the length of the file in
advance. For example, the following program will read all the lines
of data in <filename>data.txt</filename>, each consisting of three numbers, as rows
in matrix <literal>data</literal>:
</para>
<screen>MATRIX.
COMPUTE data={}.
LOOP IF NOT EOF('data.txt').
READ row/FILE='data.txt'/FIELD=1 TO 1000/SIZE={1,3}.
COMPUTE data={data; row}.
END LOOP.
PRINT data.
END MATRIX.
</screen>
</sect3>
</sect2>
<sect2 label="16.4.3" id="Matrix-COMPUTE-Command">
<title>The <literal>COMPUTE</literal> Command</title>
<literallayout><literal>COMPUTE</literal> <emphasis>variable</emphasis>[<literal>(</literal><emphasis>index</emphasis>[<literal>,</literal><emphasis>index</emphasis>]<literal>)</literal>]<literal>=</literal><emphasis>expression</emphasis><literal>.</literal>
</literallayout>
<para>The <literal>COMPUTE</literal> command evaluates an expression and assigns the
result to a variable or a submatrix of a variable. Assigning to a
submatrix uses the same syntax as the index operator (see <link linkend="Matrix-Index-Operator">Matrix
Index Operator</link>).
</para>
</sect2>
<sect2 label="16.4.4" id="Matrix-CALL-command">
<title>The <literal>CALL</literal> Command</title>
<para>A matrix function returns a single result. The <literal>CALL</literal> command
implements procedures, which take a similar syntactic form to
functions but yield results by modifying their arguments rather than
returning a value.
</para>
<para>Output arguments to a <literal>CALL</literal> procedure must be a single variable
name.
</para>
<para>The following procedures are implemented via <literal>CALL</literal> to allow them
to return multiple results. For these procedures, the output
arguments need not name existing variables; if they do, then their
previous values are replaced:
</para>
<variablelist><varlistentry><term><literal>CALL EIGEN(<replaceable>M</replaceable>, <replaceable>evec</replaceable>, <replaceable>eval</replaceable>)</literal>
</term><listitem><anchor id="CALL-EIGEN"/>
<para>Computes the eigenvalues and eigenvector of symmetric
<inlineequation><mathphrase><replaceable>n</replaceable>×<replaceable>n</replaceable></mathphrase></inlineequation> matrix <replaceable>M</replaceable>. Assigns the
eigenvectors of <replaceable>M</replaceable> to the columns of
<inlineequation><mathphrase><replaceable>n</replaceable>×<replaceable>n</replaceable></mathphrase></inlineequation> matrix <replaceable>evec</replaceable> and the eigenvalues in
descending order to <replaceable>n</replaceable>-element column vector <replaceable>eval</replaceable>.
</para>
<para>Use the <literal>EVAL</literal> function (see <link linkend="EVAL">EVAL</link>) to compute just the
eigenvalues of a symmetric matrix.
</para>
<para>For example, the following matrix language commands:
</para><screen>CALL EIGEN({1, 0; 0, 1}, evec, eval).
PRINT evec.
PRINT eval.
CALL EIGEN({3, 2, 4; 2, 0, 2; 4, 2, 3}, evec2, eval2).
PRINT evec2.
PRINT eval2.
</screen>
<para>yield this output:
</para>
<screen>evec
1 0
0 1
eval
1
1
evec2
-.6666666667 .0000000000 .7453559925
-.3333333333 -.8944271910 -.2981423970
-.6666666667 .4472135955 -.5962847940
eval2
8.0000000000
-1.0000000000
-1.0000000000
</screen>
</listitem></varlistentry><varlistentry><term><literal>CALL SVD(<replaceable>M</replaceable>, <replaceable>U</replaceable>, <replaceable>S</replaceable>, <replaceable>V</replaceable>)</literal>
</term><listitem><anchor id="CALL-SVD"/>
<para>Computes the singular value decomposition of
<inlineequation><mathphrase><replaceable>n</replaceable>×<replaceable>k</replaceable></mathphrase></inlineequation> matrix <replaceable>M</replaceable>, assigning <replaceable>S</replaceable> a
<inlineequation><mathphrase><replaceable>n</replaceable>×<replaceable>k</replaceable></mathphrase></inlineequation> diagonal matrix and to <replaceable>U</replaceable> and
<replaceable>V</replaceable> unitary <inlineequation><mathphrase><replaceable>k</replaceable>×<replaceable>k</replaceable></mathphrase></inlineequation> matrices such that
<inlineequation><mathphrase><replaceable>M</replaceable> = <replaceable>U</replaceable>×<replaceable>S</replaceable>×<replaceable>V</replaceable>^T</mathphrase></inlineequation>. The main
diagonal of <replaceable>Q</replaceable> contains the singular values of <replaceable>M</replaceable>.
</para>
<para>Use the <literal>SVAL</literal> function (see <link linkend="SVAL">SVAL</link>) to compute just the
singular values of a matrix.
</para>
<para>For example, the following matrix program:
</para>
<screen>CALL SVD({3, 2, 2; 2, 3, -2}, u, s, v).
PRINT (u * s * T(v))/FORMAT F5.1.
</screen>
<para>yields this output:
</para>
<screen>(u * s * T(v))
3.0 2.0 2.0
2.0 3.0 -2.0
</screen></listitem></varlistentry></variablelist>
<para>The final procedure is implemented via <literal>CALL</literal> to allow it to
modify a matrix instead of returning a modified version. For this
procedure, the output argument must name an existing variable.
</para>
<variablelist><varlistentry><term><literal>CALL SETDIAG(<replaceable>M</replaceable>, <replaceable>V</replaceable>)</literal>
</term><listitem><anchor id="CALL-SETDIAG"/>
<para>Replaces the main diagonal of <inlineequation><mathphrase><replaceable>n</replaceable>×<replaceable>p</replaceable></mathphrase></inlineequation> matrix
<replaceable>M</replaceable> by the contents of <replaceable>k</replaceable>-element vector <replaceable>V</replaceable>. If
<inlineequation><mathphrase><replaceable>k</replaceable> = 1</mathphrase></inlineequation>, so that <replaceable>V</replaceable> is a scalar, replaces all of the
diagonal elements of <replaceable>M</replaceable> by <replaceable>V</replaceable>. If <inlineequation><mathphrase><replaceable>k</replaceable> <
\min(<replaceable>n</replaceable>,<replaceable>p</replaceable>)</mathphrase></inlineequation>, only the upper <replaceable>k</replaceable> diagonal elements are
replaced; if <inlineequation><mathphrase><replaceable>k</replaceable> > \min(<replaceable>n</replaceable>,<replaceable>p</replaceable>)</mathphrase></inlineequation>, then the
extra elements of <replaceable>V</replaceable> are ignored.
</para>
<para>Use the <literal>MDIAG</literal> function (see <link linkend="MDIAG">MDIAG</link>) to construct a new
matrix with a specified main diagonal.
</para>
<para>For example, this matrix program:
</para>
<screen>COMPUTE x={1, 2, 3; 4, 5, 6; 7, 8, 9}.
CALL SETDIAG(x, 10).
PRINT x.
</screen>
<para>outputs the following:
</para>
<screen>x
10 2 3
4 10 6
7 8 10
</screen></listitem></varlistentry></variablelist>
</sect2>
<sect2 label="16.4.5" id="Matrix-PRINT-Command">
<title>The <literal>PRINT</literal> Command</title>
<literallayout><literal>PRINT</literal> [<emphasis>expression</emphasis>]
[<literal>/FORMAT</literal><literal>=</literal><emphasis>format</emphasis>]
[<literal>/TITLE</literal><literal>=</literal><emphasis>title</emphasis>]
[<literal>/SPACE</literal><literal>=</literal>{<literal>NEWPAGE</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <emphasis>n</emphasis>}]
[{<literal>/RLABELS</literal><literal>=</literal><emphasis>string</emphasis>… <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>/RNAMES</literal><literal>=</literal><emphasis>expression</emphasis>}]
[{<literal>/CLABELS</literal><literal>=</literal><emphasis>string</emphasis>… <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>/CNAMES</literal><literal>=</literal><emphasis>expression</emphasis>}]<literal>.</literal>
</literallayout>
<para>The <literal>PRINT</literal> command is commonly used to display a matrix. It
evaluates the restricted <replaceable>expression</replaceable>, if present, and outputs it
either as text or a pivot table, depending on the setting of
<literal>MDISPLAY</literal> (see <link linkend="SET-MDISPLAY">SET MDISPLAY</link>).
</para>
<para>Use the <literal>FORMAT</literal> subcommand to specify a format, such as
<literal>F8.2</literal>, for displaying the matrix elements. <literal>FORMAT</literal> is
optional for numerical matrices. When it is omitted, PSPP chooses
how to format entries automatically using <replaceable>m</replaceable>, the magnitude of
the largest-magnitude element in the matrix to be displayed:
</para>
<orderedlist numeration="arabic"><listitem><para>If <inlineequation><mathphrase><replaceable>m</replaceable> < 10^{11}</mathphrase></inlineequation> and the matrix’s elements are all
integers, PSPP chooses the narrowest <literal>F</literal> format that fits
<replaceable>m</replaceable> plus a sign. For example, if the matrix is <literal>{1:10}</literal>, then
<inlineequation><mathphrase>m = 10</mathphrase></inlineequation>, which fits in 3 columns with room for a sign, the
format is <literal>F3.0</literal>.
</para>
</listitem><listitem><para>Otherwise, if <inlineequation><mathphrase><replaceable>m</replaceable> ≥ 10^9</mathphrase></inlineequation> or <inlineequation><mathphrase><replaceable>m</replaceable> ≤
10^{-4}</mathphrase></inlineequation>, PSPP scales all of the numbers in the matrix by
<inlineequation><mathphrase>10^x</mathphrase></inlineequation>, where <replaceable>x</replaceable> is the exponent that would be used to
display <replaceable>m</replaceable> in scientific notation. For example, for
<inlineequation><mathphrase><replaceable>m</replaceable> = 5.123×10^{20}</mathphrase></inlineequation>, the scale factor is
<inlineequation><mathphrase>10^{20}</mathphrase></inlineequation>. PSPP displays the scaled values in format
<literal>F13.10</literal> and notes the scale factor in the output.
</para>
</listitem><listitem><para>Otherwise, PSPP displays the matrix values, without scaling, in
format <literal>F13.10</literal>.
</para></listitem></orderedlist>
<para>The optional <literal>TITLE</literal> subcommand specifies a title for the output
text or table, as a quoted string. When it is omitted, the syntax of
the matrix expression is used as the title.
</para>
<para>Use the <literal>SPACE</literal> subcommand to request extra space above the
matrix output. With a numerical argument, it adds the specified
number of lines of blank space above the matrix. With <literal>NEWPAGE</literal>
as an argument, it prints the matrix at the top of a new page. The
<literal>SPACE</literal> subcommand has no effect when a matrix is output as a
pivot table.
</para>
<para>The <literal>RLABELS</literal> and <literal>RNAMES</literal> subcommands, which are mutually
exclusive, can supply a label to accompany each row in the output.
With <literal>RLABELS</literal>, specify the labels as comma-separated strings or
other tokens. With <literal>RNAMES</literal>, specify a single expression that
evaluates to a vector of strings. Either way, if there are more
labels than rows, the extra labels are ignored, and if there are more
rows than labels, the extra rows are unlabeled. For output to a pivot
table with <literal>RLABELS</literal>, the labels can be any length; otherwise,
the labels are truncated to 8 bytes.
</para>
<para>The <literal>CLABELS</literal> and <literal>CNAMES</literal> subcommands work for labeling
columns as <literal>RLABELS</literal> and <literal>RNAMES</literal> do for labeling rows.
</para>
<para>When the <replaceable>expression</replaceable> is omitted, <literal>PRINT</literal> does not output a
matrix. Instead, it outputs only the text specified on <literal>TITLE</literal>,
if any, preceded by any space specified on the <literal>SPACE</literal>
subcommand, if any. Any other subcommands are ignored, and the
command acts as if <literal>MDISPLAY</literal> is set to <literal>TEXT</literal> regardless of
its actual setting.
</para>
<para>The following syntax demonstrates two different ways to label the rows
and columns of a matrix with <literal>PRINT</literal>:
</para>
<screen>MATRIX.
COMPUTE m={1, 2, 3; 4, 5, 6; 7, 8, 9}.
PRINT m/RLABELS=a, b, c/CLABELS=x, y, z.
COMPUTE rlabels={"a", "b", "c"}.
COMPUTE clabels={"x", "y", "z"}.
PRINT m/RNAMES=rlabels/CNAMES=clabels.
END MATRIX.
</screen>
<para>With <literal>MDISPLAY=TEXT</literal> (the default), this program outputs the
following (twice):
</para>
<screen>m
x y z
a 1 2 3
b 4 5 6
c 7 8 9
</screen>
<para>With ‘<literal>SET MDISPLAY=TABLES.</literal>’ added above ‘<literal>MATRIX.</literal>’, the
output becomes the following (twice):
</para>
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
<screen> m
+-+-+-+-+
| |x|y|z|
+-+-+-+-+
|a|1|2|3|
|b|4|5|6|
|c|7|8|9|
+-+-+-+-+
</screen>
</sect2>
<sect2 label="16.4.6" id="Matrix-DO-IF-Command">
<title>The <literal>DO IF</literal> Command</title>
<literallayout><literal>DO IF</literal> <emphasis>expression</emphasis><literal>.</literal>
…<emphasis>matrix commands</emphasis>…
[<literal>ELSE IF</literal> <emphasis>expression</emphasis><literal>.</literal>
…<emphasis>matrix commands</emphasis>…]…
[<literal>ELSE</literal>
…<emphasis>matrix commands</emphasis>…]
<literal>END IF</literal><literal>.</literal>
</literallayout>
<para>A <literal>DO IF</literal> command evaluates its expression argument. If the
<literal>DO IF</literal> expression evaluates to true, then PSPP executes the
associated commands. Otherwise, PSPP evaluates the expression on
each <literal>ELSE IF</literal> clause (if any) in order, and executes the
commands associated with the first one that yields a true value.
Finally, if the <literal>DO IF</literal> and all the <literal>ELSE IF</literal> expressions
all evaluate to false, PSPP executes the commands following the
<literal>ELSE</literal> clause (if any).
</para>
<para>Each expression on <literal>DO IF</literal> and <literal>ELSE IF</literal> must evaluate to a
scalar. Positive scalars are considered to be true, and scalars that
are zero or negative are considered to be false.
</para>
<para>The following matrix language fragment sets ‘<literal>b</literal>’ to the term
following ‘<literal>a</literal>’ in the
<ulink url="https://en.wikipedia.org/wiki/Juggler_sequence">Juggler
sequence</ulink>:
</para>
<screen>DO IF MOD(a, 2) = 0.
COMPUTE b = TRUNC(a &** (1/2)).
ELSE.
COMPUTE b = TRUNC(a &** (3/2)).
END IF.
</screen>
</sect2>
<sect2 label="16.4.7" id="Matrix-LOOP-and-BREAK-Commands">
<title>The <literal>LOOP</literal> and <literal>BREAK</literal> Commands</title>
<literallayout><literal>LOOP</literal> [<emphasis>var</emphasis><literal>=</literal><emphasis>first</emphasis> <literal>TO</literal> <emphasis>last</emphasis> [<literal>BY</literal> <emphasis>step</emphasis>]] [<literal>IF</literal> <emphasis>expression</emphasis>]<literal>.</literal>
…<emphasis>matrix commands</emphasis>…
<literal>END LOOP</literal> [<literal>IF</literal> <emphasis>expression</emphasis>]<literal>.</literal>
<literal>BREAK</literal><literal>.</literal>
</literallayout>
<para>The <literal>LOOP</literal> command executes a nested group of matrix commands,
called the loop’s <firstterm>body</firstterm>, repeatedly. It has three optional
clauses that control how many times the loop body executes.
Regardless of these clauses, the global <literal>MXLOOPS</literal> setting, which
defaults to 40, also limits the number of iterations of a loop. To
iterate more times, raise the maximum with <literal>SET MXLOOPS</literal> outside
of the <literal>MATRIX</literal> command (see <link linkend="SET-MXLOOPS">SET MXLOOPS</link>).
</para>
<para>The optional index clause causes <replaceable>var</replaceable> to be assigned successive
values on each trip through the loop: first <replaceable>first</replaceable>, then
<inlineequation><mathphrase><replaceable>first</replaceable> + <replaceable>step</replaceable></mathphrase></inlineequation>, then <inlineequation><mathphrase><replaceable>first</replaceable> + 2 ×
<replaceable>step</replaceable></mathphrase></inlineequation>, and so on. The loop ends when <inlineequation><mathphrase><replaceable>var</replaceable> >
<replaceable>last</replaceable></mathphrase></inlineequation>, for positive <replaceable>step</replaceable>, or <inlineequation><mathphrase><replaceable>var</replaceable> <
<replaceable>last</replaceable></mathphrase></inlineequation>, for negative <replaceable>step</replaceable>. If <replaceable>step</replaceable> is not specified,
it defaults to 1. All the index clause expressions must evaluate to
scalars, and non-integers are rounded toward zero. If <replaceable>step</replaceable>
evaluates as zero (or rounds to zero), then the loop body never
executes.
</para>
<para>The optional <literal>IF</literal> on <literal>LOOP</literal> is evaluated before each
iteration through the loop body. If its expression, which must
evaluate to a scalar, is zero or negative, then the loop terminates
without executing the loop body.
</para>
<para>The optional <literal>IF</literal> on <literal>END LOOP</literal> is evaluated after each
iteration through the loop body. If its expression, which must
evaluate to a scalar, is zero or negative, then the loop terminates.
</para>
<para>The following computes and prints <inlineequation><mathphrase>l(n)</mathphrase></inlineequation>, whose value is the
number of steps in the
<ulink url="https://en.wikipedia.org/wiki/Juggler_sequence">Juggler sequence</ulink>
for <inlineequation><mathphrase>n</mathphrase></inlineequation>, for <inlineequation><mathphrase>n</mathphrase></inlineequation> from 2 to 10 inclusive:
</para>
<screen>COMPUTE l = {}.
LOOP n = 2 TO 10.
COMPUTE a = n.
LOOP i = 1 TO 100.
DO IF MOD(a, 2) = 0.
COMPUTE a = TRUNC(a &** (1/2)).
ELSE.
COMPUTE a = TRUNC(a &** (3/2)).
END IF.
END LOOP IF a = 1.
COMPUTE l = {l; i}.
END LOOP.
PRINT l.
</screen>
<sect3 label="16.4.7.1" id="Matrix-BREAK-Command">
<title>The <literal>BREAK</literal> Command</title>
<para>The <literal>BREAK</literal> command may be used inside a loop body, ordinarily
within a <literal>DO IF</literal> command. If it is executed, then the loop
terminates immediately, jumping to the command just following
<literal>END LOOP</literal>. When multiple <literal>LOOP</literal> commands nest,
<literal>BREAK</literal> terminates the innermost loop.
</para>
<para>The following example is a revision of the one above that shows how
<literal>BREAK</literal> could substitute for the index and <literal>IF</literal> clauses on
<literal>LOOP</literal> and <literal>END LOOP</literal>:
</para>
<screen>COMPUTE l = {}.
LOOP n = 2 TO 10.
COMPUTE a = n.
COMPUTE i = 1.
LOOP.
DO IF MOD(a, 2) = 0.
COMPUTE a = TRUNC(a &** (1/2)).
ELSE.
COMPUTE a = TRUNC(a &** (3/2)).
END IF.
DO IF a = 1.
BREAK.
END IF.
COMPUTE i = i + 1.
END LOOP.
COMPUTE l = {l; i}.
END LOOP.
PRINT l.
</screen>
</sect3>
</sect2>
<sect2 label="16.4.8" id="Matrix-READ-and-WRITE-Commands">
<title>The <literal>READ</literal> and <literal>WRITE</literal> Commands</title>
<para>The <literal>READ</literal> and <literal>WRITE</literal> commands perform matrix input and
output with text files. They share the following syntax for
specifying how data is divided among input lines:
</para>
<literallayout><literal>/FIELD</literal><literal>=</literal><emphasis>first</emphasis> <literal>TO</literal> <emphasis>last</emphasis> [<literal>BY</literal> <emphasis>width</emphasis>]
[<literal>/FORMAT</literal><literal>=</literal><emphasis>format</emphasis>]
</literallayout>
<para>Both commands require the <literal>FIELD</literal> subcommand. It specifies the
range of columns, from <replaceable>first</replaceable> to <replaceable>last</replaceable>, inclusive, that the
data occupies on each line of the file. The leftmost column is column
1. The columns must be literal numbers, not expressions. To use
entire lines, even if they might be very long, specify a column range
such as <literal>1 TO 100000</literal>.
</para>
<para>The <literal>FORMAT</literal> subcommand is optional for numerical matrices. For
string matrix input and output, specify an <literal>A</literal> format. In
addition to <literal>FORMAT</literal>, the optional <literal>BY</literal> specification on
<literal>FIELD</literal> determine the meaning of each text line:
</para>
<itemizedlist><listitem><para>With neither <literal>BY</literal> nor <literal>FORMAT</literal>, the numbers in the text file
are in <literal>F</literal> format separated by spaces or commas. For
<literal>WRITE</literal>, PSPP uses as many digits of precision as needed to
accurately represent the numbers in the matrix.
</para>
</listitem><listitem><para><literal>BY <emphasis>width</emphasis></literal> divides the input area into fixed-width fields
with the given <emphasis>width</emphasis>. The input area must be a multiple of
<emphasis>width</emphasis> columns wide. Numbers are read or written as
<literal>F<emphasis>width</emphasis>.0</literal> format.
</para>
</listitem><listitem><para><literal>FORMAT="<emphasis>count</emphasis>F"</literal> divides the input area into integer <emphasis>count</emphasis>
equal-width fields per line. The input area must be a multiple of
<emphasis>count</emphasis> columns wide. Another format type may be substituted for
<literal>F</literal>.
</para>
</listitem><listitem><para><literal>FORMAT=F<emphasis>w</emphasis></literal>[<literal>.<emphasis>d</emphasis></literal>] divides the input area into fixed-width
fields with width <emphasis>w</emphasis>. The input area must be a multiple of <emphasis>w</emphasis>
columns wide. Another format type may be substituted for <literal>F</literal>.
The <literal>READ</literal> command disregards <emphasis>d</emphasis>.
</para>
</listitem><listitem><para><literal>FORMAT=F</literal> specifies format <literal>F</literal> without indicating a field
width. Another format type may be substituted for <literal>F</literal>. The
<literal>WRITE</literal> command accepts this form, but it has no effect unless
<literal>BY</literal> is also used to specify a field width.
</para></listitem></itemizedlist>
<para>If <literal>BY</literal> and <literal>FORMAT</literal> both specify or imply a field width,
then they must indicate the same field width.
</para>
<sect3 label="16.4.8.1" id="Matrix-READ-Command">
<title>The <literal>READ</literal> Command</title>
<literallayout><literal>READ</literal> <emphasis>variable</emphasis>[<literal>(</literal><emphasis>index</emphasis>[<literal>,</literal><emphasis>index</emphasis>]<literal>)</literal>]
[<literal>/FILE</literal><literal>=</literal><emphasis>file</emphasis>]
<literal>/FIELD</literal><literal>=</literal><emphasis>first</emphasis> <literal>TO</literal> <emphasis>last</emphasis> [<literal>BY</literal> <emphasis>width</emphasis>]
[<literal>/FORMAT</literal><literal>=</literal><emphasis>format</emphasis>]
[<literal>/SIZE</literal><literal>=</literal><emphasis>expression</emphasis>]
[<literal>/MODE</literal><literal>=</literal>{<literal>RECTANGULAR</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>SYMMETRIC</literal>}]
[<literal>/REREAD</literal>]<literal>.</literal>
</literallayout>
<para>The <literal>READ</literal> command reads from a text file into a matrix variable.
Specify the target variable just after the command name, either just a
variable name to create or replace an entire variable, or a variable
name followed by an indexing expression to replace a submatrix of an
existing variable.
</para>
<para>The <literal>FILE</literal> subcommand is required in the first <literal>READ</literal>
command that appears within <literal>MATRIX</literal>. It specifies the text file
to be read, either as a file name in quotes or a file handle
previously declared on <literal>FILE HANDLE</literal> (see <link linkend="FILE-HANDLE">FILE HANDLE</link>).
Later <literal>READ</literal> commands (in syntax order) use the previous
referenced file if <literal>FILE</literal> is omitted.
</para>
<para>The <literal>FIELD</literal> and <literal>FORMAT</literal> subcommands specify how input lines
are interpreted. <literal>FIELD</literal> is required, but <literal>FORMAT</literal> is
optional. See <link linkend="Matrix-READ-and-WRITE-Commands">Matrix READ and WRITE Commands</link>, for details.
</para>
<para>The <literal>SIZE</literal> subcommand is required for reading into an entire
variable. Its restricted expression argument should evaluate to a
2-element vector <literal>{<replaceable>n</replaceable>,&#160;<!-- /@w --><replaceable>m</replaceable>}</literal> or
<literal>{<replaceable>n</replaceable>;&#160;<!-- /@w --><replaceable>m</replaceable>}</literal>, which indicates a
<inlineequation><mathphrase><replaceable>n</replaceable>×<replaceable>m</replaceable></mathphrase></inlineequation> matrix destination. A scalar <replaceable>n</replaceable> is
also allowed and indicates a <inlineequation><mathphrase><replaceable>n</replaceable>×1</mathphrase></inlineequation> column vector
destination. When the destination is a submatrix, <literal>SIZE</literal> is
optional, and if it is present then it must match the size of the
submatrix.
</para>
<para>By default, or with <literal>MODE=RECTANGULAR</literal>, the command reads an
entry for every row and column. With <literal>MODE=SYMMETRIC</literal>, the
command reads only the entries on and below the matrix’s main
diagonal, and copies the entries above the main diagonal from the
corresponding symmetric entries below it. Only square matrices
may use <literal>MODE=SYMMETRIC</literal>.
</para>
<para>Ordinarily, each <literal>READ</literal> command starts from a new line in the
text file. Specify the <literal>REREAD</literal> subcommand to instead start from
the last line read by the previous <literal>READ</literal> command. This has no
effect for the first <literal>READ</literal> command to read from a particular
file. It is also ineffective just after a command that uses the
<literal>EOF</literal> matrix function (see <link linkend="EOF-Matrix-Function">EOF Matrix Function</link>) on a
particular file, because <literal>EOF</literal> has to try to read the next line
from the file to determine whether the file contains more input.
</para>
<bridgehead renderas="sect3">Example 1: Basic Use</bridgehead>
<para>The following matrix program reads the same matrix <literal>{1, 2, 4; 2,
3, 5; 4, 5, 6}</literal> into matrix variables <literal>v</literal>, <literal>w</literal>, and
<literal>x</literal>:
</para>
<screen>READ v /FILE='input.txt' /FIELD=1 TO 100 /SIZE={3, 3}.
READ w /FIELD=1 TO 100 /SIZE={3; 3} /MODE=SYMMETRIC.
READ x /FIELD=1 TO 100 BY 1/SIZE={3, 3} /MODE=SYMMETRIC.
</screen>
<para>given that <filename>input.txt</filename> contains the following:
</para>
<screen>1, 2, 4
2, 3, 5
4, 5, 6
1
2 3
4 5 6
1
23
456
</screen>
<para>The <literal>READ</literal> command will read as many lines of input as needed for
a particular row, so it’s also acceptable to break any of the lines
above into multiple lines. For example, the first line <literal>1, 2, 4</literal>
could be written with a line break following either or both commas.
</para>
<bridgehead renderas="sect3">Example 2: Reading into a Submatrix</bridgehead>
<para>The following reads a <inlineequation><mathphrase>5×5</mathphrase></inlineequation> matrix from <filename>input2.txt</filename>,
reversing the order of the rows:
</para>
<screen>COMPUTE m = MAKE(5, 5, 0).
LOOP r = 5 TO 1 BY -1.
READ m(r, :) /FILE='input2.txt' /FIELD=1 TO 100.
END LOOP.
</screen>
<bridgehead renderas="sect3">Example 3: Using <literal>REREAD</literal></bridgehead>
<para>Suppose each of the 5 lines in a file <filename>input3.txt</filename> starts with an
integer <replaceable>count</replaceable> followed by <replaceable>count</replaceable> numbers, e.g.:
</para>
<screen>1 5
3 1 2 3
5 6 -1 2 5 1
2 8 9
3 1 3 2
</screen>
<para>Then, the following reads this file into a matrix <literal>m</literal>:
</para>
<screen>COMPUTE m = MAKE(5, 5, 0).
LOOP i = 1 TO 5.
READ count /FILE='input3.txt' /FIELD=1 TO 1 /SIZE=1.
READ m(i, 1:count) /FIELD=3 TO 100 /REREAD.
END LOOP.
</screen>
</sect3>
<sect3 label="16.4.8.2" id="Matrix-WRITE-Command">
<title>The <literal>WRITE</literal> Command</title>
<literallayout><literal>WRITE</literal> <emphasis>expression</emphasis>
[<literal>/OUTFILE</literal><literal>=</literal><emphasis>file</emphasis>]
<literal>/FIELD</literal><literal>=</literal><emphasis>first</emphasis> <literal>TO</literal> <emphasis>last</emphasis> [<literal>BY</literal> <emphasis>width</emphasis>]
[<literal>/FORMAT</literal><literal>=</literal><emphasis>format</emphasis>]
[<literal>/MODE</literal><literal>=</literal>{<literal>RECTANGULAR</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>TRIANGULAR</literal>}]
[<literal>/HOLD</literal>]<literal>.</literal>
</literallayout>
<para>The <literal>WRITE</literal> command evaluates <emphasis>expression</emphasis> and writes its value
to a text file in a specified format. Write the expression to
evaluate just after the command name.
</para>
<para>The <literal>OUTFILE</literal> subcommand is required in the first <literal>WRITE</literal>
command that appears within <literal>MATRIX</literal>. It specifies the text file
to be written, either as a file name in quotes or a file handle
previously declared on <literal>FILE HANDLE</literal> (see <link linkend="FILE-HANDLE">FILE HANDLE</link>).
Later <literal>WRITE</literal> commands (in syntax order) use the previous
referenced file if <literal>FILE</literal> is omitted.
</para>
<para>The <literal>FIELD</literal> and <literal>FORMAT</literal> subcommands specify how output
lines are formed. <literal>FIELD</literal> is required, but <literal>FORMAT</literal> is
optional. See <link linkend="Matrix-READ-and-WRITE-Commands">Matrix READ and WRITE Commands</link>, for details.
</para>
<para>By default, or with <literal>MODE=RECTANGULAR</literal>, the command writes an
entry for every row and column. With <literal>MODE=TRIANGULAR</literal>, the
command writes only the entries on and below the matrix’s main
diagonal. Entries above the diagonal are not written. Only square
matrices may be written with <literal>MODE=TRIANGULAR</literal>.
</para>
<para>Ordinarily, each <literal>WRITE</literal> command writes complete lines to the
output file. With <literal>HOLD</literal>, the final line written by <literal>WRITE</literal>
will be held back for the next <literal>WRITE</literal> command to augment. This
can be useful to write more than one matrix on a single output line.
</para>
<bridgehead renderas="sect3">Example 1: Basic Usage</bridgehead>
<para>This matrix program:
</para>
<screen>WRITE {1, 2; 3, 4} /OUTFILE='matrix.txt' /FIELD=1 TO 80.
</screen>
<para>writes the following to <filename>matrix.txt</filename>:
</para>
<screen> 1 2
3 4
</screen>
<bridgehead renderas="sect3">Example 2: Triangular Matrix</bridgehead>
<para>This matrix program:
</para>
<screen>WRITE MAGIC(5) /OUTFILE='matrix.txt' /FIELD=1 TO 80 BY 5 /MODE=TRIANGULAR.
</screen>
<para>writes the following to <filename>matrix.txt</filename>:
</para>
<screen> 17
23 5
4 6 13
10 12 19 21
11 18 25 2 9
</screen>
</sect3>
</sect2>
<sect2 label="16.4.9" id="Matrix-GET-Command">
<title>The <literal>GET</literal> Command</title>
<literallayout><literal>GET</literal> <emphasis>variable</emphasis>[<literal>(</literal><emphasis>index</emphasis>[<literal>,</literal><emphasis>index</emphasis>]<literal>)</literal>]
[<literal>/FILE</literal><literal>=</literal>{<emphasis>file</emphasis> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>*</literal>}]
[<literal>/VARIABLES</literal><literal>=</literal><emphasis>variable</emphasis>…]
[<literal>/NAMES</literal><literal>=</literal><emphasis>variable</emphasis>]
[<literal>/MISSING</literal><literal>=</literal>{<literal>ACCEPT</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>OMIT</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <emphasis>number</emphasis>}]
[<literal>/SYSMIS</literal><literal>=</literal>{<literal>OMIT</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <emphasis>number</emphasis>}]<literal>.</literal>
</literallayout>
<para>The <literal>READ</literal> command reads numeric data from an SPSS system file,
SPSS/PC+ system file, or SPSS portable file into a matrix variable or
submatrix:
</para>
<itemizedlist><listitem><para>To read data into a variable, specify just its name following
<literal>GET</literal>. The variable need not already exist; if it does, it is
replaced. The variable will have as many columns as there are
variables specified on the <literal>VARIABLES</literal> subcommand and as many
rows as there are cases in the input file.
</para>
</listitem><listitem><para>To read data into a submatrix, specify the name of an existing
variable, followed by an indexing expression, just after <literal>GET</literal>.
The submatrix must have as many columns as variables specified on
<literal>VARIABLES</literal> and as many rows as cases in the input file.
</para></listitem></itemizedlist>
<para>Specify the name or handle of the file to be read on <literal>FILE</literal>. Use
‘<literal>*</literal>’, or simply omit the <literal>FILE</literal> subcommand, to read from the
active file. Reading from the active file is only permitted if it was
already defined outside <literal>MATRIX</literal>.
</para>
<para>List the variables to be read as columns in the matrix on the
<literal>VARIABLES</literal> subcommand. The list can use <literal>TO</literal> for
collections of variables or <literal>ALL</literal> for all variables. If
<literal>VARIABLES</literal> is omitted, all variables are read. Only numeric
variables may be read.
</para>
<para>If a variable is named on <literal>NAMES</literal>, then the names of the
variables read as data columns are stored in a string vector within
the given name, replacing any existing matrix variable with that name.
Variable names are truncated to 8 bytes.
</para>
<para>The <literal>MISSING</literal> and <literal>SYSMIS</literal> subcommands control the treatment
of missing values in the input file. By default, any user- or
system-missing data in the variables being read from the input causes
an error that prevents <literal>GET</literal> from executing. To accept missing
values, specify one of the following settings on <literal>MISSING</literal>:
</para>
<variablelist><varlistentry><term><literal>ACCEPT</literal>
</term><listitem><para>Accept user-missing values with no change.
</para>
<para>By default, system-missing values still yield an error. Use the
<literal>SYSMIS</literal> subcommand to change this treatment:
</para>
<variablelist><varlistentry><term><literal>OMIT</literal>
</term><listitem><para>Skip any case that contains a system-missing value.
</para>
</listitem></varlistentry><varlistentry><term><emphasis>number</emphasis>
</term><listitem><para>Recode the system-missing value to <emphasis>number</emphasis>.
</para></listitem></varlistentry></variablelist>
</listitem></varlistentry><varlistentry><term><literal>OMIT</literal>
</term><listitem><para>Skip any case that contains any user- or system-missing value.
</para>
</listitem></varlistentry><varlistentry><term><emphasis>number</emphasis>
</term><listitem><para>Recode all user- and system-missing values to <emphasis>number</emphasis>.
</para></listitem></varlistentry></variablelist>
<para>The <literal>SYSMIS</literal> subcommand has an effect only with
<literal>MISSING=ACCEPT</literal>.
</para>
</sect2>
<sect2 label="16.4.10" id="Matrix-SAVE-Command">
<title>The <literal>SAVE</literal> Command</title>
<literallayout><literal>SAVE</literal> <emphasis>expression</emphasis>
[<literal>/OUTFILE</literal><literal>=</literal>{<emphasis>file</emphasis> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>*</literal>}]
[<literal>/VARIABLES</literal><literal>=</literal><emphasis>variable</emphasis>…]
[<literal>/NAMES</literal><literal>=</literal><emphasis>expression</emphasis>]
[<literal>/STRINGS</literal><literal>=</literal><emphasis>variable</emphasis>…]<literal>.</literal>
</literallayout>
<para>The <literal>SAVE</literal> matrix command evaluates <emphasis>expression</emphasis> and writes the
resulting matrix to an SPSS system file. In the system file, each
matrix row becomes a case and each column becomes a variable.
</para>
<para>Specify the name or handle of the SPSS system file on the
<literal>OUTFILE</literal> subcommand, or ‘<literal>*</literal>’ to write the output as the new
active file. The <literal>OUTFILE</literal> subcommand is required on the first
<literal>SAVE</literal> command, in syntax order, within <literal>MATRIX</literal>. For
<literal>SAVE</literal> commands after the first, the default output file is the
same as the previous.
</para>
<para>When multiple <literal>SAVE</literal> commands write to one destination within a
single <literal>MATRIX</literal>, the later commands append to the same output
file. All the matrices written to the file must have the same number
of columns. The <literal>VARIABLES</literal>, <literal>NAMES</literal>, and <literal>STRINGS</literal>
subcommands are honored only for the first <literal>SAVE</literal> command that
writes to a given file.
</para>
<para>By default, <literal>SAVE</literal> names the variables in the output file
<literal>COL1</literal> through <literal>COL<emphasis>n</emphasis></literal>. Use <literal>VARIABLES</literal> or
<literal>NAMES</literal> to give the variables meaningful names. The
<literal>VARIABLES</literal> subcommand accepts a comma-separated list of variable
names. Its alternative, <literal>NAMES</literal>, instead accepts an expression
that must evaluate to a row or column string vector of names. The
number of names need not exactly match the number of columns in the
matrix to be written: extra names are ignored; extra columns use
default names.
</para>
<para>By default, <literal>SAVE</literal> assumes that the matrix to be written is all
numeric. To write string columns, specify a comma-separated list of
the string columns’ variable names on <literal>STRINGS</literal>.
</para>
</sect2>
<sect2 label="16.4.11" id="Matrix-MGET-Command">
<title>The <literal>MGET</literal> Command</title>
<literallayout><literal>MGET</literal> [<literal>/FILE</literal><literal>=</literal><emphasis>file</emphasis>]
[<literal>/TYPE</literal><literal>=</literal>{<literal>COV</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>CORR</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>MEAN</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>STDDEV</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>N</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>COUNT</literal>}]<literal>.</literal>
</literallayout>
<para>The <literal>MGET</literal> command reads the data from a matrix file
(see <link linkend="Matrix-Files">Matrix Files</link>) into matrix variables.
</para>
<para>All of <literal>MGET</literal>’s subcommands are optional. Specify the name or
handle of the matrix file to be read on the <literal>FILE</literal> subcommand; if
it is omitted, then the command reads the active file.
</para>
<para>By default, <literal>MGET</literal> reads all of the data from the matrix file.
Specify a space-delimited list of matrix types on <literal>TYPE</literal> to limit
the kinds of data to the one specified:
</para>
<variablelist><varlistentry><term><literal>COV</literal>
</term><listitem><para>Covariance matrix.
</para>
</listitem></varlistentry><varlistentry><term><literal>CORR</literal>
</term><listitem><para>Correlation coefficient matrix.
</para>
</listitem></varlistentry><varlistentry><term><literal>MEAN</literal>
</term><listitem><para>Vector of means.
</para>
</listitem></varlistentry><varlistentry><term><literal>STDDEV</literal>
</term><listitem><para>Vector of standard deviations.
</para>
</listitem></varlistentry><varlistentry><term><literal>N</literal>
</term><listitem><para>Vector of case counts.
</para>
</listitem></varlistentry><varlistentry><term><literal>COUNT</literal>
</term><listitem><para>Vector of counts.
</para></listitem></varlistentry></variablelist>
<para><literal>MGET</literal> reads the entire matrix file and automatically names,
creates, and populates matrix variables using its contents. It
constructs the name of each variable by concatenating the following:
</para>
<itemizedlist><listitem><para>A 2-character prefix that identifies the type of the matrix:
</para>
<variablelist><varlistentry><term><literal>CV</literal>
</term><listitem><para>Covariance matrix.
</para>
</listitem></varlistentry><varlistentry><term><literal>CR</literal>
</term><listitem><para>Correlation coefficient matrix.
</para>
</listitem></varlistentry><varlistentry><term><literal>MN</literal>
</term><listitem><para>Vector of means.
</para>
</listitem></varlistentry><varlistentry><term><literal>SD</literal>
</term><listitem><para>Vector of standard deviations.
</para>
</listitem></varlistentry><varlistentry><term><literal>NC</literal>
</term><listitem><para>Vector of case counts.
</para>
</listitem></varlistentry><varlistentry><term><literal>CN</literal>
</term><listitem><para>Vector of counts.
</para></listitem></varlistentry></variablelist>
</listitem><listitem><para>If the matrix file has factor variables, <literal>F<emphasis>n</emphasis></literal>, where <emphasis>n</emphasis> is
a number identifying a group of factors: <literal>F1</literal> for the first
group, <literal>F2</literal> for the second, and so on. This part is omitted for
pooled data (where the factors all have the system-missing value).
</para>
</listitem><listitem><para>If the matrix file has split file variables, <literal>S<emphasis>n</emphasis></literal>, where
<emphasis>n</emphasis> is a number identifying a split group: <literal>S1</literal> for the first
group, <literal>S2</literal> for the second, and so on.
</para></listitem></itemizedlist>
<para>If <literal>MGET</literal> chooses the name of an existing variable, it issues a
warning and does not change the variable.
</para>
</sect2>
<sect2 label="16.4.12" id="Matrix-MSAVE-Command">
<title>The <literal>MSAVE</literal> Command</title>
<literallayout><literal>MSAVE</literal> <emphasis>expression</emphasis>
<literal>/TYPE</literal><literal>=</literal>{<literal>COV</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>CORR</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>MEAN</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>STDDEV</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>N</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>COUNT</literal>}
[<literal>/FACTOR</literal><literal>=</literal><emphasis>expression</emphasis>]
[<literal>/SPLIT</literal><literal>=</literal><emphasis>expression</emphasis>]
[<literal>/OUTFILE</literal><literal>=</literal><emphasis>file</emphasis>]
[<literal>/VARIABLES</literal><literal>=</literal><emphasis>variable</emphasis>…]
[<literal>/SNAMES</literal><literal>=</literal><emphasis>variable</emphasis>…]
[<literal>/FNAMES</literal><literal>=</literal><emphasis>variable</emphasis>…]<literal>.</literal>
</literallayout>
<para>The <literal>MSAVE</literal> command evaluates the <emphasis>expression</emphasis> specified just
after the command name, and writes the resulting matrix to a matrix
file (see <link linkend="Matrix-Files">Matrix Files</link>).
</para>
<para>The <literal>TYPE</literal> subcommand is required. It specifies the
<literal>ROWTYPE_</literal> to write along with this matrix.
</para>
<para>The <literal>FACTOR</literal> and <literal>SPLIT</literal> subcommands are required on the
first <literal>MSAVE</literal> if and only if the matrix file has factor or split
variables, respectively. After that, their values are carried along
from one <literal>MSAVE</literal> command to the next in syntax order as defaults.
Each one takes an expression that must evaluate to a vector with the
same number of entries as the matrix has factor or split variables,
respectively. Each <literal>MSAVE</literal> only writes data for a single
combination of factor and split variables, so many <literal>MSAVE</literal>
commands (or one inside a loop) may be needed to write a complete set.
</para>
<para>The remaining <literal>MSAVE</literal> subcommands define the format of the matrix
file. All of the <literal>MSAVE</literal> commands within a given matrix program
write to the same matrix file, so these subcommands are only
meaningful on the first <literal>MSAVE</literal> command within a matrix program.
(If they are given again on later <literal>MSAVE</literal> commands, then they
must have the same values as on the first.)
</para>
<para>The <literal>OUTFILE</literal> subcommand specifies the name or handle of the
matrix file to be written. Output must go to an external file, not a
data set or the active file.
</para>
<para>The <literal>VARIABLES</literal> subcommand specifies a comma-separated list of
the names of the continuous variables to be written to the matrix
file. The <literal>TO</literal> keyword can be used to define variables named
with consecutive integer suffixes. These names become column names
and names that appear in <literal>VARNAME_</literal> in the matrix file.
<literal>ROWTYPE_</literal> and <literal>VARNAME_</literal> are not allowed on
<literal>VARIABLES</literal>. If <literal>VARIABLES</literal> is omitted, then PSPP uses
the names <literal>COL1</literal>, <literal>COL2</literal>, and so on.
</para>
<para>The <literal>FNAMES</literal> subcommand may be used to supply a comma-separated
list of factor variable names. The default names are <literal>FAC1</literal>,
<literal>FAC2</literal>, and so on.
</para>
<para>The <literal>SNAMES</literal> subcommand can supply a comma-separated list of
split variable names. The default names are <literal>SPL1</literal>, <literal>SPL2</literal>,
and so on.
</para>
</sect2>
<sect2 label="16.4.13" id="Matrix-DISPLAY-Command">
<title>The <literal>DISPLAY</literal> Command</title>
<literallayout><literal>DISPLAY</literal> [{<literal>DICTIONARY</literal> <inlineequation><mathphrase>|</mathphrase></inlineequation> <literal>STATUS</literal>}]<literal>.</literal>
</literallayout>
<para>The <literal>DISPLAY</literal> command makes PSPP display a table with the name
and dimensions of each matrix variable. The <literal>DICTIONARY</literal> and
<literal>STATUS</literal> keywords are accepted but have no effect.
</para>
</sect2>
<sect2 label="16.4.14" id="Matrix-RELEASE-Command">
<title>The <literal>RELEASE</literal> Command</title>
<literallayout><literal>RELEASE</literal> <emphasis>variable</emphasis>…<literal>.</literal>
</literallayout>
<para>The <literal>RELEASE</literal> command accepts a comma-separated list of matrix
variable names. It deletes each variable and releases the memory
associated with it.
</para>
<para>The <literal>END MATRIX</literal> command releases all matrix variables.
<!-- PSPP - a program for statistical analysis. -->
<!-- Copyright (C) 2017, 2020, 2023 Free Software Foundation, Inc. -->
<!-- Permission is granted to copy, distribute and/or modify this document -->
<!-- under the terms of the GNU Free Documentation License, Version 1.3 -->
<!-- or any later version published by the Free Software Foundation; -->
<!-- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -->
<!-- A copy of the license is included in the section entitled "GNU -->
<!-- Free Documentation License". -->
<!-- -->
</para></sect2>
</sect1>
</chapter>
<chapter label="17" id="Utilities">
<title>Utilities</title>
<para>Commands that don’t fit any other category are placed here.
</para>
<para>Most of these commands are not affected by commands like <literal>IF</literal> and
<literal>LOOP</literal>:
they take effect only once, unconditionally, at the time that they are
encountered in the input.
</para>
<sect1 label="17.1" id="ADD-DOCUMENT">
<title>ADD DOCUMENT</title>
<indexterm role="vr"><primary>ADD DOCUMENT</primary></indexterm>
<literallayout>ADD DOCUMENT
’line one’ ’line two’ … ’last line’ .
</literallayout>
<para><literal>ADD DOCUMENT</literal> adds one or more lines of descriptive commentary to
the active dataset. Documents added in this way are saved to system files.
They can be viewed using <literal>SYSFILE INFO</literal> or <literal>DISPLAY
DOCUMENTS</literal>. They can be removed from the active dataset with <literal>DROP
DOCUMENTS</literal>.
</para>
<para>Each line of documentary text must be enclosed in quotation marks, and
may not be more than 80 bytes long. See <link linkend="DOCUMENT">DOCUMENT</link>.
</para>
</sect1>
<sect1 label="17.2" id="CACHE">
<title>CACHE</title>
<indexterm role="vr"><primary>CACHE</primary></indexterm>
<literallayout>CACHE.
</literallayout>
<para>This command is accepted, for compatibility, but it has no effect.
</para>
</sect1>
<sect1 label="17.3" id="CD">
<title>CD</title>
<indexterm role="vr"><primary>CD</primary></indexterm>
<indexterm role="cp"><primary>directory</primary></indexterm>
<indexterm role="cp"><primary>changing directory</primary></indexterm>
<literallayout>CD ’new directory’ .
</literallayout>
<para><literal>CD</literal> changes the current directory. The new directory becomes
that specified by the command.
</para>
</sect1>
<sect1 label="17.4" id="COMMENT">
<title>COMMENT</title>
<indexterm role="vr"><primary>COMMENT</primary></indexterm>
<indexterm role="vr"><primary>*</primary></indexterm>
<literallayout>Comment commands:
COMMENT comment text … .
*comment text … .
Comments within a line of syntax:
FREQUENCIES /VARIABLES=v0 v1 v2. /* All our categorical variables.
</literallayout>
<para><literal>COMMENT</literal> is ignored. It is used to provide information to
the author and other readers of the PSPP syntax file.
</para>
<para><literal>COMMENT</literal> can extend over any number of lines. It ends at a dot
at the end of a line or a blank line. The comment may contain any
characters.
</para>
<para>PSPP also supports comments within a line of syntax, introduced with
‘<literal>/*</literal>’. These comments end at the first ‘<literal>*/</literal>’ or at the end of
the line, whichever comes first. A line that contains just this kind
of comment is considered blank and ends the current command.
</para>
</sect1>
<sect1 label="17.5" id="DOCUMENT">
<title>DOCUMENT</title>
<indexterm role="vr"><primary>DOCUMENT</primary></indexterm>
<literallayout>DOCUMENT <replaceable>documentary_text</replaceable>.
</literallayout>
<para><literal>DOCUMENT</literal> adds one or more lines of descriptive commentary to the
active dataset. Documents added in this way are saved to system files.
They can be viewed using <literal>SYSFILE INFO</literal> or <literal>DISPLAY
DOCUMENTS</literal>. They can be removed from the active dataset with <literal>DROP
DOCUMENTS</literal>.
</para>
<para>Specify the <replaceable>documentary text</replaceable> following the <literal>DOCUMENT</literal> keyword.
It is interpreted literally—any quotes or other punctuation marks
are included in the file.
You can extend the documentary text over as many lines as necessary,
including blank lines to separate paragraphs.
Lines are truncated at 80 bytes. Don’t forget to terminate
the command with a dot at the end of a line. See <link linkend="ADD-DOCUMENT">ADD DOCUMENT</link>.
</para>
</sect1>
<sect1 label="17.6" id="DISPLAY-DOCUMENTS">
<title>DISPLAY DOCUMENTS</title>
<indexterm role="vr"><primary>DISPLAY DOCUMENTS</primary></indexterm>
<literallayout>DISPLAY DOCUMENTS.
</literallayout>
<para><literal>DISPLAY DOCUMENTS</literal> displays the documents in the active dataset. Each
document is preceded by a line giving the time and date that it was
added. See <link linkend="DOCUMENT">DOCUMENT</link>.
</para>
</sect1>
<sect1 label="17.7" id="DISPLAY-FILE-LABEL">
<title>DISPLAY FILE LABEL</title>
<indexterm role="vr"><primary>DISPLAY FILE LABEL</primary></indexterm>
<literallayout>DISPLAY FILE LABEL.
</literallayout>
<para><literal>DISPLAY FILE LABEL</literal> displays the file label contained in the
active dataset,
if any. See <link linkend="FILE-LABEL">FILE LABEL</link>.
</para>
<para>This command is a PSPP extension.
</para>
</sect1>
<sect1 label="17.8" id="DROP-DOCUMENTS">
<title>DROP DOCUMENTS</title>
<indexterm role="vr"><primary>DROP DOCUMENTS</primary></indexterm>
<literallayout>DROP DOCUMENTS.
</literallayout>
<para><literal>DROP DOCUMENTS</literal> removes all documents from the active dataset.
New documents can be added with <literal>DOCUMENT</literal> (see <link linkend="DOCUMENT">DOCUMENT</link>).
</para>
<para><literal>DROP DOCUMENTS</literal> changes only the active dataset. It does not modify any
system files stored on disk.
</para>
</sect1>
<sect1 label="17.9" id="ECHO">
<title>ECHO</title>
<indexterm role="vr"><primary>ECHO</primary></indexterm>
<literallayout>ECHO ’arbitrary text’ .
</literallayout>
<para>Use <literal>ECHO</literal> to write arbitrary text to the output stream. The text should be enclosed in quotation marks following the normal rules for string tokens (see <link linkend="Tokens">Tokens</link>).
</para>
</sect1>
<sect1 label="17.10" id="ERASE">
<title>ERASE</title>
<indexterm role="vr"><primary>ERASE</primary></indexterm>
<literallayout>ERASE FILE <replaceable>file_name</replaceable>.
</literallayout>
<para><literal>ERASE FILE</literal> deletes a file from the local file system.
<replaceable>file_name</replaceable> must be quoted.
This command cannot be used if the SAFER (see <link linkend="SET">SET</link>) setting is active.
</para>
</sect1>
<sect1 label="17.11" id="EXECUTE">
<title>EXECUTE</title>
<indexterm role="vr"><primary>EXECUTE</primary></indexterm>
<literallayout>EXECUTE.
</literallayout>
<para><literal>EXECUTE</literal> causes the active dataset to be read and all pending
transformations to be executed.
</para>
</sect1>
<sect1 label="17.12" id="FILE-LABEL">
<title>FILE LABEL</title>
<indexterm role="vr"><primary>FILE LABEL</primary></indexterm>
<literallayout>FILE LABEL <replaceable>file_label</replaceable>.
</literallayout>
<para><literal>FILE LABEL</literal> provides a title for the active dataset. This
title is saved into system files and portable files that are
created during this PSPP run.
</para>
<para><replaceable>file_label</replaceable> should not be quoted.
If quotes are included, they are literally interpreted and become part of the file label.
</para>
</sect1>
<sect1 label="17.13" id="FINISH">
<title>FINISH</title>
<indexterm role="vr"><primary>FINISH</primary></indexterm>
<literallayout>FINISH.
</literallayout>
<para><literal>FINISH</literal> terminates the current PSPP session and returns
control to the operating system.
</para>
</sect1>
<sect1 label="17.14" id="HOST">
<title>HOST</title>
<indexterm role="vr"><primary>HOST</primary></indexterm>
<para>In the syntax below, the square brackets must be included in the
command syntax and do not indicate that that their contents are
optional.
</para>
<literallayout>HOST COMMAND=[’<replaceable>command</replaceable>’...]
TIMELIMIT=<replaceable>secs</replaceable>.
</literallayout>
<para><literal>HOST</literal> executes one or more commands, each provided as a string in
the required <literal>COMMAND</literal> subcommand, in the shell of the
underlying operating system. PSPP runs each command in a separate
shell process and waits for it to finish before running the next one.
If a command fails (with a nonzero exit status, or because it is
killed by a signal), then PSPP does not run any remaining commands.
</para>
<para>PSPP provides <filename>/dev/null</filename> as the shell’s standard input. If a
process needs to read from stdin, redirect from a file or device, or
use a pipe.
</para>
<para>PSPP displays the shell’s standard output and standard error as PSPP
output. Redirect to a file or <literal>/dev/null</literal> or another device if
this is not desired.
</para>
<para>The following example runs <literal>rsync</literal> to copy a file from a remote
server to the local file <filename>data.txt</filename>, writing <literal>rsync</literal>’s own
output to <filename>rsync-log.txt</filename>. PSPP displays the command’s error
output, if any. If <literal>rsync</literal> needs to prompt the user (<emphasis>e.g.</emphasis> to
obtain a password), the command fails. Only if the <literal>rsync</literal>
succeeds, PSPP then runs the <literal>sha512sum</literal> command.
</para>
<screen>HOST COMMAND=['rsync remote:data.txt data.txt > rsync-log.txt'
'sha512sum -c data.txt.sha512sum].
</screen>
<para>By default, PSPP waits as long as necessary for the series of commands
to complete. Use the optional <literal>TIMELIMIT</literal> subcommand to limit
the execution time to the specified number of seconds.
</para>
<para>PSPP built for mingw does not support all the features of
<literal>HOST</literal>.
</para>
<para>PSPP rejects this command if the SAFER (see <link linkend="SET">SET</link>) setting is
active.
</para>
</sect1>
<sect1 label="17.15" id="INCLUDE">
<title>INCLUDE</title>
<indexterm role="vr"><primary>INCLUDE</primary></indexterm>
<literallayout> INCLUDE [FILE=]’<replaceable>file_name</replaceable>’ [ENCODING=’<replaceable>encoding</replaceable>’].
</literallayout>
<para><literal>INCLUDE</literal> causes the PSPP command processor to read an
additional command file as if it were included bodily in the current
command file.
If errors are encountered in the included file, then command
processing stops and no more commands are processed.
Include files may be nested to any depth, up to the limit of available
memory.
</para>
<para>The <literal>INSERT</literal> command (see <link linkend="INSERT">INSERT</link>) is a more flexible
alternative to <literal>INCLUDE</literal>. An <literal>INCLUDE</literal> command acts the same as
<literal>INSERT</literal> with <literal>ERROR=STOP CD=NO SYNTAX=BATCH</literal> specified.
</para>
<para>The optional <literal>ENCODING</literal> subcommand has the same meaning as with <literal>INSERT</literal>.
</para>
</sect1>
<sect1 label="17.16" id="INSERT">
<title>INSERT</title>
<indexterm role="vr"><primary>INSERT</primary></indexterm>
<literallayout> INSERT [FILE=]’<replaceable>file_name</replaceable>’
[CD={NO,YES}]
[ERROR={CONTINUE,STOP}]
[SYNTAX={BATCH,INTERACTIVE}]
[ENCODING={LOCALE, ’<replaceable>charset_name</replaceable>’}].
</literallayout>
<para><literal>INSERT</literal> is similar to <literal>INCLUDE</literal> (see <link linkend="INCLUDE">INCLUDE</link>)
but somewhat more flexible.
It causes the command processor to read a file as if it were embedded in the
current command file.
</para>
<para>If <literal>CD=YES</literal> is specified, then before including the file, the
current directory becomes the directory of the included
file.
The default setting is ‘<literal>CD=NO</literal>’.
Note that this directory remains current until it is
changed explicitly (with the <literal>CD</literal> command, or a subsequent
<literal>INSERT</literal> command with the ‘<literal>CD=YES</literal>’ option).
It does not revert to its original setting even after the included
file is finished processing.
</para>
<para>If <literal>ERROR=STOP</literal> is specified, errors encountered in the
inserted file causes processing to immediately cease.
Otherwise processing continues at the next command.
The default setting is <literal>ERROR=CONTINUE</literal>.
</para>
<para>If <literal>SYNTAX=INTERACTIVE</literal> is specified then the syntax contained in
the included file must conform to interactive syntax
conventions. See <link linkend="Syntax-Variants">Syntax Variants</link>.
The default setting is <literal>SYNTAX=BATCH</literal>.
</para>
<para><literal>ENCODING</literal> optionally specifies the character set used by the included
file. Its argument, which is not case-sensitive, must be in one of
the following forms:
</para>
<variablelist><varlistentry><term><literal>LOCALE</literal>
</term><listitem><para>The encoding used by the system locale, or as overridden by the
<literal>SET</literal> command (see <link linkend="SET">SET</link>). On GNU/Linux and other Unix-like systems,
environment variables, <emphasis>e.g.</emphasis> <envar>LANG</envar> or <envar>LC_ALL</envar>, determine the
system locale.
</para>
</listitem></varlistentry><varlistentry><term><replaceable>charset_name</replaceable>
</term><listitem><para>One of the character set names listed by <acronym>IANA</acronym> at
<ulink url="http://www.iana.org/assignments/character-sets">http://www.iana.org/assignments/character-sets</ulink>. Some examples
are <literal>ASCII</literal> (United States), <literal>ISO-8859-1</literal> (western Europe),
<literal>EUC-JP</literal> (Japan), and <literal>windows-1252</literal> (Windows). Not all
systems support all character sets.
</para>
</listitem></varlistentry><varlistentry><term><literal>Auto,<replaceable>encoding</replaceable></literal>
</term><listitem><para>Automatically detects whether a syntax file is encoded in an Unicode
encoding such as UTF-8, UTF-16, or UTF-32. If it is not, then PSPP
generally assumes that the file is encoded in <replaceable>encoding</replaceable> (an <acronym>IANA</acronym>
character set name). However, if <replaceable>encoding</replaceable> is UTF-8, and the
syntax file is not valid UTF-8, PSPP instead assumes that the file
is encoded in <literal>windows-1252</literal>.
</para>
<para>For best results, <replaceable>encoding</replaceable> should be an <acronym>ASCII</acronym>-compatible
encoding (the most common locale encodings are all <acronym>ASCII</acronym>-compatible),
because encodings that are not <acronym>ASCII</acronym> compatible cannot be
automatically distinguished from UTF-8.
</para>
</listitem></varlistentry><varlistentry><term><literal>Auto</literal>
</term></varlistentry><varlistentry><term><literal>Auto,Locale</literal>
</term><listitem><para>Automatic detection, as above, with the default encoding taken from
the system locale or the setting on <literal>SET LOCALE</literal>.
</para></listitem></varlistentry></variablelist>
<para>When ENCODING is not specified, the default is taken from the
<option>--syntax-encoding</option> command option, if it was specified, and
otherwise it is <literal>Auto</literal>.
</para>
</sect1>
<sect1 label="17.17" id="OUTPUT">
<title>OUTPUT</title>
<indexterm role="vr"><primary>OUTPUT</primary></indexterm>
<indexterm role="cp"><primary>precision, of output</primary></indexterm>
<indexterm role="cp"><primary>decimal places</primary></indexterm>
<literallayout>OUTPUT MODIFY
/SELECT TABLES
/TABLECELLS SELECT = [ <replaceable>class</replaceable>... ]
FORMAT = <replaceable>fmt_spec</replaceable>.
</literallayout><blockquote><para><emphasis role="bold">Please note:</emphasis> In the above synopsis the characters ‘<literal>[</literal>’ and ‘<literal>]</literal>’ are literals.
They must appear in the syntax to be interpreted.
</para></blockquote>
<para><literal>OUTPUT</literal> changes the appearance of the tables in which results are
printed. In particular, it can be used to set the format and precision
to which results are displayed.
</para>
<para>After running this command, the default table appearance parameters
will have been modified and each new output table generated uses
the new parameters.
</para>
<para>Following <literal>/TABLECELLS SELECT =</literal> a list of cell classes must
appear, enclosed in square brackets. This list determines the classes
of values should be selected for modification. Each class can be:
</para>
<variablelist><varlistentry><term>RESIDUAL
</term><listitem><para>Residual values. Default: <literal>F40.2</literal>.
</para>
</listitem></varlistentry><varlistentry><term>CORRELATION
</term><listitem><para>Correlations. Default: <literal>F40.3</literal>.
</para>
</listitem></varlistentry><varlistentry><term>PERCENT
</term><listitem><para>Percentages. Default: <literal>PCT40.1</literal>.
</para>
</listitem></varlistentry><varlistentry><term>SIGNIFICANCE
</term><listitem><para>Significance of tests (p-values). Default: <literal>F40.3</literal>.
</para>
</listitem></varlistentry><varlistentry><term>COUNT
</term><listitem><para>Counts or sums of weights. For a weighted data set, the default is
the weight variable’s print format. For an unweighted data set, the
default is F40.0.
</para></listitem></varlistentry></variablelist>
<para>For most other numeric values that appear in tables, <literal>SET FORMAT</literal>
may be used to specify the format (see <link linkend="SET-FORMAT">SET FORMAT</link>).
</para>
<para>The value of <replaceable>fmt_spec</replaceable> must be a valid output format (see <link linkend="Input-and-Output-Formats">Input and Output Formats</link>).
Note that not all possible formats are meaningful for all classes.
</para>
</sect1>
<sect1 label="17.18" id="PERMISSIONS">
<title>PERMISSIONS</title>
<indexterm role="vr"><primary>PERMISSIONS</primary></indexterm>
<indexterm role="cp"><primary>mode</primary></indexterm>
<indexterm role="cp"><primary>file mode</primary></indexterm>
<indexterm role="cp"><primary>changing file permissions</primary></indexterm>
<literallayout>PERMISSIONS
FILE=’<replaceable>file_name</replaceable>’
/PERMISSIONS = {READONLY,WRITEABLE}.
</literallayout>
<para><literal>PERMISSIONS</literal> changes the permissions of a file.
There is one mandatory subcommand which specifies the permissions to
which the file should be changed.
If you set a file’s permission to <literal>READONLY</literal>, then the file
will become unwritable either by you or anyone else on the system.
If you set the permission to <literal>WRITEABLE</literal>, then the file becomes
writeable by you; the permissions afforded to others are unchanged.
This command cannot be used if the <literal>SAFER</literal> (see <link linkend="SET">SET</link>)
setting is active.
</para>
</sect1>
<sect1 label="17.19" id="PRESERVE-and-RESTORE">
<title>PRESERVE and RESTORE</title>
<indexterm role="vr"><primary>PRESERVE</primary></indexterm>
<indexterm role="vr"><primary>RESTORE</primary></indexterm>
<literallayout>PRESERVE.
…
RESTORE.
</literallayout>
<para><literal>PRESERVE</literal> saves all of the settings that <literal>SET</literal> (see <link linkend="SET">SET</link>)
can adjust. A later <literal>RESTORE</literal> command restores those settings.
</para>
<para><literal>PRESERVE</literal> can be nested up to five levels deep.
</para>
</sect1>
<sect1 label="17.20" id="SET">
<title>SET</title>
<indexterm role="vr"><primary>SET</primary></indexterm>
<literallayout>SET
(data input)
/BLANKS={SYSMIS,’.’,number}
/DECIMAL={DOT,COMMA}
/FORMAT=<replaceable>fmt_spec</replaceable>
/EPOCH={AUTOMATIC,<replaceable>year</replaceable>}
/RIB={NATIVE,MSBFIRST,LSBFIRST,VAX}
/RRB={NATIVE,ISL,ISB,IDL,IDB,VF,VD,VG,ZS,ZL}
(interaction)
/MXERRS=<replaceable>max_errs</replaceable>
/MXWARNS=<replaceable>max_warnings</replaceable>
/WORKSPACE=<replaceable>workspace_size</replaceable>
(syntax execution)
/LOCALE=’<replaceable>locale</replaceable>’
/MXLOOPS=<replaceable>max_loops</replaceable>
/SEED={RANDOM,<replaceable>seed_value</replaceable>}
/UNDEFINED={WARN,NOWARN}
/FUZZBITS=<replaceable>fuzzbits</replaceable>
/SCALEMIN=<replaceable>count</replaceable>
(data output)
/CC{A,B,C,D,E}={’<replaceable>npre</replaceable>,<replaceable>pre</replaceable>,<replaceable>suf</replaceable>,<replaceable>nsuf</replaceable>’,’<replaceable>npre</replaceable>.<replaceable>pre</replaceable>.<replaceable>suf</replaceable>.<replaceable>nsuf</replaceable>’}
/DECIMAL={DOT,COMMA}
/FORMAT=<replaceable>fmt_spec</replaceable>
/LEADZERO={ON,OFF}
/MDISPLAY={TEXT,TABLES}
/SMALL=<replaceable>number</replaceable>
/SUMMARY={NONE,<replaceable>comment</replaceable>}
/WIB={NATIVE,MSBFIRST,LSBFIRST,VAX}
/WRB={NATIVE,ISL,ISB,IDL,IDB,VF,VD,VG,ZS,ZL}
(output routing)
/ERRORS={ON,OFF,TERMINAL,LISTING,BOTH,NONE}
/MESSAGES={ON,OFF,TERMINAL,LISTING,BOTH,NONE}
/PRINTBACK={ON,OFF,TERMINAL,LISTING,BOTH,NONE}
/RESULTS={ON,OFF,TERMINAL,LISTING,BOTH,NONE}
(output driver options)
/HEADERS={NO,YES,BLANK}
/LENGTH={NONE,<replaceable>n_lines</replaceable>}
/WIDTH={NARROW,WIDTH,<replaceable>n_characters</replaceable>}
/TNUMBERS={VALUES,LABELS,BOTH}
/TVARS={NAMES,LABELS,BOTH}
/TLOOK={NONE,<replaceable>file</replaceable>}
(logging)
/JOURNAL={ON,OFF} [’<replaceable>file_name</replaceable>’]
(system files)
/SCOMPRESSION={ON,OFF}
(miscellaneous)
/SAFER=ON
/LOCALE=’<replaceable>string</replaceable>’
(macros)
/MEXPAND={ON,OFF}
/MPRINT={ON,OFF}
/MITERATE=<replaceable>number</replaceable>
/MNEST=<replaceable>number</replaceable>
(settings not yet implemented, but accepted and ignored)
/BASETEXTDIRECTION={AUTOMATIC,RIGHTTOLEFT,LEFTTORIGHT}
/BLOCK=’<replaceable>c</replaceable>’
/BOX={’<replaceable>xxx</replaceable>’,’<replaceable>xxxxxxxxxxx</replaceable>’}
/CACHE={ON,OFF}
/CELLSBREAK=<replaceable>number</replaceable>
/COMPRESSION={ON,OFF}
/CMPTRANS={ON,OFF}
/HEADER={NO,YES,BLANK}
</literallayout>
<para><literal>SET</literal> allows the user to adjust several parameters relating to
PSPP’s execution. Since there are many subcommands to this command, its
subcommands are examined in groups.
</para>
<para>For subcommands that take boolean values, <literal>ON</literal> and <literal>YES</literal> are synonymous,
as are <literal>OFF</literal> and <literal>NO</literal>, when used as subcommand values.
</para>
<para>The data input subcommands affect the way that data is read from data
files. The data input subcommands are
</para>
<variablelist><varlistentry><term>BLANKS
</term><listitem><anchor id="SET-BLANKS"/><para>This is the value assigned to an item data item that is empty or
contains only white space. An argument of SYSMIS or ’.’ causes the
system-missing value to be assigned to null items. This is the
default. Any real value may be assigned.
</para>
</listitem></varlistentry><varlistentry><term>DECIMAL
</term><listitem><anchor id="SET-DECIMAL"/><para>This value may be set to <literal>DOT</literal> or <literal>COMMA</literal>.
Setting it to <literal>DOT</literal> causes the decimal point character to be
‘<literal>.</literal>’ and the grouping character to be ‘<literal>,</literal>’.
Setting it to <literal>COMMA</literal>
causes the decimal point character to be ‘<literal>,</literal>’ and the grouping
character to be ‘<literal>.</literal>’.
If the setting is <literal>COMMA</literal>, then ‘<literal>,</literal>’ is not treated
as a field separator in the <literal>DATA LIST</literal> command (see <link linkend="DATA-LIST">DATA LIST</link>).
The default value is determined from the system locale.
</para>
</listitem></varlistentry><varlistentry><term>FORMAT
</term><listitem><anchor id="SET-FORMAT"/><para>Allows the default numeric input/output format to be specified. The
default is F8.2. See <link linkend="Input-and-Output-Formats">Input and Output Formats</link>.
</para>
</listitem></varlistentry><varlistentry><term>EPOCH
</term><listitem><anchor id="SET-EPOCH"/><para>Specifies the range of years used when a 2-digit year is read from a
data file or used in a date construction expression (see <link linkend="Date-Construction">Date
Construction</link>). If a 4-digit year is specified for the epoch, then
2-digit years are interpreted starting from that year, known as the
epoch. If <literal>AUTOMATIC</literal> (the default) is specified, then the epoch begins
69 years before the current date.
</para>
</listitem></varlistentry><varlistentry><term>RIB
</term><listitem><anchor id="SET-RIB"/>
<para>PSPP extension to set the byte ordering (endianness) used for reading
data in IB or PIB format (see <link linkend="Binary-and-Hexadecimal-Numeric-Formats">Binary and Hexadecimal Numeric
Formats</link>). In <literal>MSBFIRST</literal> ordering, the most-significant byte appears at
the left end of a IB or PIB field. In <literal>LSBFIRST</literal> ordering, the
least-significant byte appears at the left end. <literal>VAX</literal> ordering is like
<literal>MSBFIRST</literal>, except that each pair of bytes is in reverse order. <literal>NATIVE</literal>,
the default, is equivalent to <literal>MSBFIRST</literal> or <literal>LSBFIRST</literal> depending on the
native format of the machine running PSPP.
</para>
</listitem></varlistentry><varlistentry><term>RRB
</term><listitem><anchor id="SET-RRB"/>
<para>PSPP extension to set the floating-point format used for reading data in
RB format (see <link linkend="Binary-and-Hexadecimal-Numeric-Formats">Binary and Hexadecimal Numeric Formats</link>). The
possibilities are:
</para>
<variablelist><varlistentry><term>NATIVE
</term><listitem><para>The native format of the machine running PSPP. Equivalent to either IDL
or IDB.
</para>
</listitem></varlistentry><varlistentry><term>ISL
</term><listitem><para>32-bit IEEE 754 single-precision floating point, in little-endian byte
order.
</para>
</listitem></varlistentry><varlistentry><term>ISB
</term><listitem><para>32-bit IEEE 754 single-precision floating point, in big-endian byte
order.
</para>
</listitem></varlistentry><varlistentry><term>IDL
</term><listitem><para>64-bit IEEE 754 double-precision floating point, in little-endian byte
order.
</para>
</listitem></varlistentry><varlistentry><term>IDB
</term><listitem><para>64-bit IEEE 754 double-precision floating point, in big-endian byte
order.
</para>
</listitem></varlistentry><varlistentry><term>VF
</term><listitem><para>32-bit VAX F format, in VAX-endian byte order.
</para>
</listitem></varlistentry><varlistentry><term>VD
</term><listitem><para>64-bit VAX D format, in VAX-endian byte order.
</para>
</listitem></varlistentry><varlistentry><term>VG
</term><listitem><para>64-bit VAX G format, in VAX-endian byte order.
</para>
</listitem></varlistentry><varlistentry><term>ZS
</term><listitem><para>32-bit IBM Z architecture short format hexadecimal floating point, in
big-endian byte order.
</para>
</listitem></varlistentry><varlistentry><term>ZL
</term><listitem><para>64-bit IBM Z architecture long format hexadecimal floating point, in
big-endian byte order.
</para>
<para>Z architecture also supports IEEE 754 floating point. The ZS and ZL
formats are only for use with very old input files.
</para></listitem></varlistentry></variablelist><para>The default is NATIVE.
</para></listitem></varlistentry></variablelist>
<para>Interaction subcommands affect the way that PSPP interacts with an
online user. The interaction subcommands are
</para>
<variablelist><varlistentry><term>MXERRS
</term><listitem><para>The maximum number of errors before PSPP halts processing of the current
command file. The default is 50.
</para>
</listitem></varlistentry><varlistentry><term>MXWARNS
</term><listitem><para>The maximum number of warnings + errors before PSPP halts processing the
current command file.
The special value of zero means that all warning situations should be ignored.
No warnings are issued, except a single initial warning advising you
that warnings will not be given.
The default value is 100.
</para></listitem></varlistentry></variablelist>
<para>Syntax execution subcommands control the way that PSPP commands
execute. The syntax execution subcommands are
</para>
<variablelist><varlistentry><term>LOCALE
</term><listitem><para>Overrides the system locale for the purpose of reading and writing
syntax and data files. The argument should be a locale name in the
general form <literal><replaceable>language</replaceable>_<replaceable>country</replaceable>.<replaceable>encoding</replaceable></literal>, where <replaceable>language</replaceable>
and <replaceable>country</replaceable> are 2-character language and country abbreviations,
respectively, and <replaceable>encoding</replaceable> is an <acronym>IANA</acronym> character set name.
Example locales are <literal>en_US.UTF-8</literal> (UTF-8 encoded English as
spoken in the United States) and <literal>ja_JP.EUC-JP</literal> (EUC-JP encoded
Japanese as spoken in Japan).
</para>
</listitem></varlistentry><varlistentry><term>MXLOOPS
</term><listitem><anchor id="SET-MXLOOPS"/>
<para>The maximum number of iterations for an uncontrolled loop
(see <link linkend="LOOP">LOOP</link>), and for any loop in the matrix language (see <link linkend="Matrix-LOOP-and-BREAK-Commands">Matrix
LOOP and BREAK Commands</link>). The default <replaceable>max_loops</replaceable> is 40.
</para>
</listitem></varlistentry><varlistentry><term>SEED
</term><listitem><anchor id="SET-SEED"/><para>The initial pseudo-random number seed. Set it to a real number or to
RANDOM, to obtain an initial seed from the current time of day.
</para>
</listitem></varlistentry><varlistentry><term>UNDEFINED
</term><listitem><para>Currently not used.
</para>
</listitem></varlistentry><varlistentry><term>FUZZBITS
</term><listitem><anchor id="SET-FUZZBITS"/><para>The maximum number of bits of errors in the least-significant places
to accept for rounding up a value that is almost halfway between two
possibilities for rounding with the RND operator (see <link linkend="Miscellaneous-Mathematics">Miscellaneous
Mathematics</link>). The default <replaceable>fuzzbits</replaceable> is 6.
</para>
</listitem></varlistentry><varlistentry><term>SCALEMIN
</term><listitem><anchor id="SET-SCALEMIN"/><para>The minimum number of distinct valid values for PSPP to assume that
a variable has a scale measurement level. See <link linkend="Measurement-Level">Measurement Level</link>.
</para>
</listitem></varlistentry><varlistentry><term>WORKSPACE
</term><listitem><para>The maximum amount of memory (in kilobytes) that PSPP uses to
store data being processed. If memory in excess of the workspace size
is required, then PSPP starts to use temporary files to store
the data. Setting a higher value means that procedures
run faster, but may cause other applications to run slower.
On platforms without virtual memory management, setting a very large
workspace may cause PSPP to abort.
<indexterm role="cp"><primary>workspace</primary></indexterm>
<indexterm role="cp"><primary>memory, amount used to store cases</primary></indexterm>
</para></listitem></varlistentry></variablelist>
<para>Data output subcommands affect the format of output data. These
subcommands are
</para>
<variablelist><varlistentry><term>CCA
</term><term>CCB
</term><term>CCC
</term><term>CCD
</term><term>CCE
</term><listitem><anchor id="CCx-Settings"/>
<para>Set up custom currency formats. See <link linkend="Custom-Currency-Formats">Custom Currency Formats</link>, for
details.
</para>
</listitem></varlistentry><varlistentry><term>DECIMAL
</term><listitem><para>The default <literal>DOT</literal> setting causes the decimal point character to be
‘<literal>.</literal>’. A setting of <literal>COMMA</literal> causes the decimal point character to be
‘<literal>,</literal>’.
</para>
</listitem></varlistentry><varlistentry><term>FORMAT
</term><listitem><para>Allows the default numeric input/output format to be specified. The
default is F8.2. See <link linkend="Input-and-Output-Formats">Input and Output Formats</link>.
</para>
</listitem></varlistentry><varlistentry><term>LEADZERO
</term><listitem><anchor id="SET-LEADZERO"/>
<para>Controls whether numbers with magnitude less than one are displayed
with a zero before the decimal point. For example, with <literal>SET
LEADZERO=OFF</literal>, which is the default, one-half is shown as 0.5, and
with <literal>SET LEADZERO=ON</literal>, it is shown as .5. This setting affects
only the <literal>F</literal>, <literal>COMMA</literal>, and <literal>DOT</literal> formats.
</para>
</listitem></varlistentry><varlistentry><term>MDISPLAY
</term><listitem><anchor id="SET-MDISPLAY"/>
<para>Controls how the <literal>PRINT</literal> command within
<literal>MATRIX</literal>…<literal>END MATRIX</literal> outputs matrices. With the
default <literal>TEXT</literal>, <literal>PRINT</literal> outputs matrices as text. Change
this setting to <literal>TABLES</literal> to instead output matrices as pivot
tables. See <link linkend="Matrix-PRINT-Command">Matrix PRINT Command</link>, for more information.
</para>
</listitem></varlistentry><varlistentry><term>SMALL
</term><listitem><para>This controls how PSPP formats small numbers in pivot tables, in
cases where PSPP does not otherwise have a well-defined format for
the numbers. When such a number has a magnitude less than the value
set here, PSPP formats the number in scientific notation;
otherwise, it formats it in standard notation. The default is 0.0001.
Set a value of 0 to disable scientific notation.
</para>
</listitem></varlistentry><varlistentry><term>SUMMARY
</term><listitem><para>The <literal>SUMMARY</literal> option sets the comment string which will appear in all
generated tables until the next <literal>SUMMARY</literal> is issued. If the special
value <literal>NONE</literal> is specified, then no comment will appear.
These comment strings can be seen in the graphical user interface by placing
the pointer over the table.
If <replaceable>comment</replaceable> contains any of the following substrings, they will be
subsituted as follows:
</para><variablelist><varlistentry><term><literal>\n</literal>
</term><listitem><para>A line break.
</para></listitem></varlistentry><varlistentry><term><literal>)DATE</literal>
</term><listitem><para>The current date in the form ‘<literal>dd-mmm-yyyy</literal>’
</para></listitem></varlistentry><varlistentry><term><literal>)ADATE</literal>
</term><listitem><para>The current date in the form ‘<literal>mm/dd/yyyy</literal>’
</para></listitem></varlistentry><varlistentry><term><literal>)SDATE</literal>
</term><listitem><para>The current date in the form ‘<literal>yyyy/mm/dd</literal>’
</para></listitem></varlistentry><varlistentry><term><literal>)EDATE</literal>
</term><listitem><para>The current date in the form ‘<literal>dd.mm.yyyy</literal>’
</para></listitem></varlistentry><varlistentry><term><literal>)TIME</literal>
</term><listitem><para>The current 12 hour clock time in the form ‘<literal>hh:mm:ss</literal>’
</para></listitem></varlistentry><varlistentry><term><literal>)ETIME</literal>
</term><listitem><para>The current 24 hour clock time in the form ‘<literal>hh:mm:ss</literal>’
</para></listitem></varlistentry></variablelist>
</listitem></varlistentry><varlistentry><term>WIB
</term><listitem><anchor id="SET-WIB"/>
<para>PSPP extension to set the byte ordering (endianness) used for writing
data in IB or PIB format (see <link linkend="Binary-and-Hexadecimal-Numeric-Formats">Binary and Hexadecimal Numeric
Formats</link>). In <literal>MSBFIRST</literal> ordering, the most-significant byte appears at
the left end of a IB or PIB field. In <literal>LSBFIRST</literal> ordering, the
least-significant byte appears at the left end. <literal>VAX</literal> ordering is like
<literal>MSBFIRST</literal>, except that each pair of bytes is in reverse order. <literal>NATIVE</literal>,
the default, is equivalent to <literal>MSBFIRST</literal> or <literal>LSBFIRST</literal> depending on the
native format of the machine running PSPP.
</para>
</listitem></varlistentry><varlistentry><term>WRB
</term><listitem><anchor id="SET-WRB"/>
<para>PSPP extension to set the floating-point format used for writing data in
RB format (see <link linkend="Binary-and-Hexadecimal-Numeric-Formats">Binary and Hexadecimal Numeric Formats</link>). The choices
are the same as <literal>SET RIB</literal>. The default is <literal>NATIVE</literal>.
</para></listitem></varlistentry></variablelist>
<para>In the PSPP text-based interface, the output routing subcommands
affect where output is sent. The following values are allowed for
each of these subcommands:
</para>
<variablelist><varlistentry><term>OFF
</term></varlistentry><varlistentry><term>NONE
</term><listitem><para>Discard this kind of output.
</para>
</listitem></varlistentry><varlistentry><term>TERMINAL
</term><listitem><para>Write this output to the terminal, but not to listing files and other
output devices.
</para>
</listitem></varlistentry><varlistentry><term>LISTING
</term><listitem><para>Write this output to listing files and other output devices, but not
to the terminal.
</para>
</listitem></varlistentry><varlistentry><term>ON
</term><term>BOTH
</term><listitem><para>Write this type of output to all output devices.
</para></listitem></varlistentry></variablelist>
<para>These output routing subcommands are:
</para>
<variablelist><varlistentry><term>ERRORS
</term><listitem><para>Applies to error and warning messages. The default is <literal>BOTH</literal>.
</para>
</listitem></varlistentry><varlistentry><term>MESSAGES
</term><listitem><para>Applies to notes. The default is <literal>BOTH</literal>.
</para>
</listitem></varlistentry><varlistentry><term>PRINTBACK
</term><listitem><para>Determines whether the syntax used for input is printed back as part
of the output. The default is <literal>NONE</literal>.
</para>
</listitem></varlistentry><varlistentry><term>RESULTS
</term><listitem><para>Applies to everything not in one of the above categories, such as the
results of statistical procedures. The default is <literal>BOTH</literal>.
</para></listitem></varlistentry></variablelist>
<para>These subcommands have no effect on output in the PSPP GUI
environment.
</para>
<para>Output driver option subcommands affect output drivers’ settings. These
subcommands are
</para>
<variablelist><varlistentry><term>HEADERS
</term><term>LENGTH
</term><term>WIDTH
</term><term>TNUMBERS
</term><listitem><para>The <literal>TNUMBERS</literal> option sets the way in which values are displayed in output tables.
The valid settings are <literal>VALUES</literal>, <literal>LABELS</literal> and <literal>BOTH</literal>.
If <literal>TNUMBERS</literal> is set to <literal>VALUES</literal>, then all values are displayed with their literal value
(which for a numeric value is a number and for a string value an alphanumeric string).
If <literal>TNUMBERS</literal> is set to <literal>LABELS</literal>, then values are displayed using their assigned labels if any.
(See <link linkend="VALUE-LABELS">VALUE LABELS</link>.)
If the value has no label, then the literal value is used for display.
If <literal>TNUMBERS</literal> is set to <literal>BOTH</literal>, then values are displayed with both their label
(if any) and their literal value in parentheses.
</para></listitem></varlistentry><varlistentry><term>TVARS
</term><listitem><anchor id="SET-TVARS"/><para>The <literal>TVARS</literal> option sets the way in which variables are displayed in output tables.
The valid settings are <literal>NAMES</literal>, <literal>LABELS</literal> and <literal>BOTH</literal>.
If <literal>TVARS</literal> is set to <literal>NAMES</literal>, then all variables are displayed using their names.
If <literal>TVARS</literal> is set to <literal>LABELS</literal>, then variables are displayed using their label if one
has been set. If no label has been set, then the name is used.
(See <link linkend="VARIABLE-LABELS">VARIABLE LABELS</link>.)
If <literal>TVARS</literal> is set to <literal>BOTH</literal>, then variables are displayed with both their label
(if any) and their name in parentheses.
</para></listitem></varlistentry><varlistentry><term>TLOOK
</term><listitem><para>The <literal>TLOOK</literal> option sets the style used for subsequent table
output. Specifying <literal>NONE</literal> makes PSPP use the default
built-in style. Otherwise, specifying <replaceable>file</replaceable> makes PSPP search
for an <filename>.stt</filename> or <filename>.tlo</filename> file in the same way as specifying
<option>--table-look=<replaceable>file</replaceable></option> the PSPP command line (see <link linkend="Main-Options">Main
Options</link>).
</para></listitem></varlistentry></variablelist>
<indexterm role="cp"><primary>headers</primary></indexterm>
<indexterm role="cp"><primary>length</primary></indexterm>
<indexterm role="cp"><primary>pager</primary></indexterm>
<indexterm role="cp"><primary>width</primary></indexterm>
<indexterm role="cp"><primary>tnumbers</primary></indexterm>
<para>These subcommands affect journaling, also called logging. When
journaling is enabled, PSPP writes the commands that it executes,
plus any errors or other diagostics that it outputs, to a text file,
called the <firstterm>journal</firstterm> file.
</para>
<para>PSPP enables journaling by default when it runs interactively in a
terminal or in the PSPPIRE GUI. In the GUI, use Edit
→ Options… to view or override the default location or
to disable journaling. From syntax, use <literal>SHOW JOURNAL</literal> to see
the journal’s location and whether it is enabled.
</para>
<variablelist><varlistentry><term>JOURNAL
</term><term>LOG
</term><listitem><para>Specify <literal>ON</literal> to enable the journal and <literal>OFF</literal> to disable
it. Specify a file name to set the name of the journal file.
</para></listitem></varlistentry></variablelist>
<para>System file subcommands affect the default format of system files
produced by PSPP. These subcommands are
</para>
<variablelist><varlistentry><term>SCOMPRESSION
</term><listitem><para>Whether system files created by <literal>SAVE</literal> or <literal>XSAVE</literal> are
compressed by default. The default is <literal>ON</literal>.
</para></listitem></varlistentry></variablelist>
<para>Security subcommands affect the operations that commands are allowed to
perform. The security subcommands are
</para>
<variablelist><varlistentry><term>SAFER
</term><listitem><para>Setting this option disables the following operations:
</para>
<itemizedlist><listitem><para>The <literal>ERASE</literal> command.
</para></listitem><listitem><para>The <literal>HOST</literal> command.
</para></listitem><listitem><para>The <literal>PERMISSIONS</literal> command.
</para></listitem><listitem><para>Pipes (file names beginning or ending with ‘<literal>|</literal>’).
</para></listitem></itemizedlist>
<para>Be aware that this setting does not guarantee safety (commands can still
overwrite files, for instance) but it is an improvement.
When set, this setting cannot be reset during the same session, for
obvious security reasons.
</para>
</listitem></varlistentry><varlistentry><term>LOCALE
</term><listitem><indexterm role="cp"><primary>locale</primary></indexterm>
<indexterm role="cp"><primary>encoding, characters</primary></indexterm>
<para>This item is used to set the default character encoding.
The encoding may be specified either as an encoding name or alias
(see <ulink url="http://www.iana.org/assignments/character-sets">http://www.iana.org/assignments/character-sets</ulink>), or
as a locale name.
If given as a locale name, only the character encoding of the
locale is relevant.
</para>
<para>System files written by PSPP use this encoding.
System files read by PSPP, for which the encoding is unknown, are
interpreted using this encoding.
</para>
<para>The full list of valid encodings and locale names/alias are operating system
dependent.
The following are all examples of acceptable syntax on common GNU/Linux
systems.
</para><screen>SET LOCALE='iso-8859-1'.
SET LOCALE='ru_RU.cp1251'.
SET LOCALE='japanese'.
</screen>
<para>Contrary to intuition, this command does not affect any aspect
of the system’s locale.
</para></listitem></varlistentry></variablelist>
<para>The following subcommands affect the interpretation of macros.
</para>
<variablelist><varlistentry><term>MEXPAND
</term><listitem><anchor id="SET-MEXPAND"/><para>Controls whether macros are expanded. The default is ON.
</para>
</listitem></varlistentry><varlistentry><term>MPRINT
</term><listitem><anchor id="SET-MPRINT"/><para>Controls whether the expansion of macros is included in output. This
is separate from whether command syntax in general is included in
output. The default is OFF.
</para>
</listitem></varlistentry><varlistentry><term>MITERATE
</term><listitem><anchor id="SET-MITERATE"/><para>Limits the number of iterations executed in <literal>!DO</literal> loops within
macros. This does not affect other language constructs such as
<literal>LOOP</literal>. This must be set to a positive integer. The default is
1000.
</para>
</listitem></varlistentry><varlistentry><term>MNEST
</term><listitem><anchor id="SET-MNEST"/><para>Limits the number of levels of nested macro expansions. This must be
set to a positive integer. The default is 50.
</para></listitem></varlistentry></variablelist>
<para>The following subcommands are not yet implemented, but PSPP accepts
them and ignores the settings.
</para>
<variablelist><varlistentry><term>BASETEXTDIRECTION
</term><term>BLOCK
</term><term>BOX
</term><term>CACHE
</term><term>CELLSBREAK
</term><term>COMPRESSION
</term><term>CMPTRANS
</term><term>HEADER
</term></varlistentry></variablelist>
</sect1>
<sect1 label="17.21" id="SHOW">
<title>SHOW</title>
<indexterm role="vr"><primary>SHOW</primary></indexterm>
<literallayout>SHOW
[ALL]
[BLANKS]
[CC]
[CCA]
[CCB]
[CCC]
[CCD]
[CCE]
[COPYING]
[DECIMAL]
[DIRECTORY]
[ENVIRONMENT]
[FORMAT]
[FUZZBITS]
[LENGTH]
[MEXPAND]
[MPRINT]
[MITERATE]
[MNEST]
[MXERRS]
[MXLOOPS]
[MXWARNS]
[N]
[SCOMPRESSION]
[SYSTEM]
[TEMPDIR]
[UNDEFINED]
[VERSION]
[WARRANTY]
[WEIGHT]
[WIDTH]
</literallayout>
<para><literal>SHOW</literal> can be used to display the current state of PSPP’s execution
parameters. Parameters that can be changed using <literal>SET</literal>
(see <link linkend="SET">SET</link>), can be examined using <literal>SHOW</literal> using the subcommand
with the same name. <literal>SHOW</literal> supports the following additional
subcommands:
</para>
<variablelist><varlistentry><term><literal>ALL</literal>
</term><listitem><para>Show all settings.
</para></listitem></varlistentry><varlistentry><term><literal>CC</literal>
</term><listitem><para>Show all custom currency settings (<literal>CCA</literal> through <literal>CCE</literal>).
</para></listitem></varlistentry><varlistentry><term><literal>DIRECTORY</literal>
</term><listitem><para>Shows the current working directory.
</para></listitem></varlistentry><varlistentry><term><literal>ENVIRONMENT</literal>
</term><listitem><para>Shows the operating system details.
</para></listitem></varlistentry><varlistentry><term><literal>N</literal>
</term><listitem><para>Reports the number of cases in the active dataset. The reported number is not
weighted. If no dataset is defined, then ‘<literal>Unknown</literal>’ is reported.
</para></listitem></varlistentry><varlistentry><term><literal>SYSTEM</literal>
</term><listitem><para>Shows information about how PSPP was built. This information is
useful in bug reports. See <link linkend="Bugs">Bugs</link>, for details.
</para></listitem></varlistentry><varlistentry><term><literal>TEMPDIR</literal>
</term><listitem><para>Shows the path of the directory where temporary files are stored.
</para></listitem></varlistentry><varlistentry><term><literal>VERSION</literal>
</term><listitem><para>Shows the version of this installation of PSPP.
</para></listitem></varlistentry><varlistentry><term><literal>WARRANTY</literal>
</term><listitem><para>Show details of the lack of warranty for PSPP.
</para></listitem></varlistentry><varlistentry><term><literal>COPYING</literal> / <literal>LICENSE</literal>
</term><listitem><para>Display the terms of PSPP’s copyright licence (see <link linkend="License">License</link>).
</para></listitem></varlistentry></variablelist>
<para>Specifying <literal>SHOW</literal> without any subcommands is equivalent to <literal>SHOW ALL</literal>.
</para>
</sect1>
<sect1 label="17.22" id="SUBTITLE">
<title>SUBTITLE</title>
<indexterm role="vr"><primary>SUBTITLE</primary></indexterm>
<literallayout>SUBTITLE ’<replaceable>subtitle_string</replaceable>’.
or
SUBTITLE <replaceable>subtitle_string</replaceable>.
</literallayout>
<para><literal>SUBTITLE</literal> provides a subtitle to a particular PSPP
run. This subtitle appears at the top of each output page below the
title, if headers are enabled on the output device.
</para>
<para>Specify a subtitle as a string in quotes. The alternate syntax that did
not require quotes is now obsolete. If it is used then the subtitle is
converted to all uppercase.
</para>
</sect1>
<sect1 label="17.23" id="TITLE">
<title>TITLE</title>
<indexterm role="vr"><primary>TITLE</primary></indexterm>
<literallayout>TITLE ’<replaceable>title_string</replaceable>’.
or
TITLE <replaceable>title_string</replaceable>.
</literallayout>
<para><literal>TITLE</literal> provides a title to a particular PSPP run.
This title appears at the top of each output page, if headers are enabled
on the output device.
</para>
<para>Specify a title as a string in quotes. The alternate syntax that did
not require quotes is now obsolete. If it is used then the title is
converted to all uppercase.
</para>
<!-- PSPP - a program for statistical analysis. -->
<!-- Copyright (C) 2017, 2020 Free Software Foundation, Inc. -->
<!-- Permission is granted to copy, distribute and/or modify this document -->
<!-- under the terms of the GNU Free Documentation License, Version 1.3 -->
<!-- or any later version published by the Free Software Foundation; -->
<!-- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -->
<!-- A copy of the license is included in the section entitled "GNU -->
<!-- Free Documentation License". -->
<!-- -->
</sect1>
</chapter>
<chapter label="18" id="Invoking-pspp_002dconvert">
<title>Invoking <command>pspp-convert</command></title>
<indexterm role="cp"><primary>Invocation</primary></indexterm>
<indexterm role="cp"><primary><command>pspp-convert</command></primary></indexterm>
<para><command>pspp-convert</command> is a command-line utility accompanying
PSPP. It reads an SPSS or SPSS/PC+ system file or SPSS portable
file or encrypted SPSS syntax file <replaceable>input</replaceable> and
writes a copy of it to another <replaceable>output</replaceable> in a different format.
Synopsis:
</para>
<literallayout><literal>pspp-convert</literal> [<replaceable>options</replaceable>] <replaceable>input</replaceable> <replaceable>output</replaceable>
<literal>pspp-convert --<!-- /@w -->help</literal>
<literal>pspp-convert --<!-- /@w -->version</literal>
</literallayout>
<para>The format of <replaceable>input</replaceable> is automatically detected, when possible.
The character encoding of old SPSS system files cannot always be
guessed correctly, and SPSS/PC+ system files do not include any
indication of their encoding. Use <literal>-e <replaceable>encoding</replaceable></literal> to specify
the encoding in this case.
</para>
<para>By default, the intended format for <replaceable>output</replaceable> is inferred based on its
extension:
</para>
<variablelist><varlistentry><term><literal>csv</literal>
</term><term><literal>txt</literal>
</term><listitem><para>Comma-separated value. Each value is formatted according to its
variable’s print format. The first line in the file contains variable
names.
</para>
</listitem></varlistentry><varlistentry><term><literal>sav</literal>
</term></varlistentry><varlistentry><term><literal>sys</literal>
</term><listitem><para>SPSS system file.
</para>
</listitem></varlistentry><varlistentry><term><literal>por</literal>
</term><listitem><para>SPSS portable file.
</para>
</listitem></varlistentry><varlistentry><term><literal>sps</literal>
</term><listitem><para>SPSS syntax file. (Only encrypted syntax files may be converted to
this format.)
</para></listitem></varlistentry></variablelist>
<para><command>pspp-convert</command> can convert most input formats to most output
formats. Encrypted SPSS file formats are exceptions: if the input
file is in an encrypted format, then the output file will be the same
format (decrypted). To decrypt such a file, specify the encrypted
file as <replaceable>input</replaceable>. The output will be the equivalent plaintext
file. Options for the output format are ignored in this case.
</para>
<para>The password for encrypted files can be specified a few different
ways. If the password is known, use the <option>-p</option> option
(documented below) or allow <command>pspp-convert</command> to prompt for it.
If the password is unknown, use the <option>-a</option> and <option>-l</option>
options to specify how to search for it, or <option>--password-list</option>
to specify a file of passwords to try.
</para>
<para>Use <literal>-O <replaceable>format</replaceable></literal> to override the inferred format or to
specify the format for unrecognized extensions.
</para>
<para><command>pspp-convert</command> accepts the following general options:
</para>
<variablelist><varlistentry><term><option><option>-O <replaceable>format</replaceable></option></option>
</term><term><option><option>--output-format=<replaceable>format</replaceable></option></option>
</term><listitem><para>Sets the output format, where <replaceable>format</replaceable> is one of the extensions
listed above, <emphasis>e.g.</emphasis>: <option>-O csv</option>. Use <option>--help</option> to list
the supported output formats.
</para>
</listitem></varlistentry><varlistentry><term><option>-c <replaceable>maxcases</replaceable></option>
</term><term><option>--cases=<replaceable>maxcases</replaceable></option>
</term><listitem><para>By default, all cases are copied from <replaceable>input</replaceable> to <replaceable>output</replaceable>.
Specifying this option to limit the number of cases written to
<replaceable>output</replaceable> to <replaceable>maxcases</replaceable>.
</para>
</listitem></varlistentry><varlistentry><term><option>-e <replaceable>charset</replaceable></option>
</term><term><option>--encoding=<replaceable>charset</replaceable></option>
</term><listitem><para>Overrides the encoding in which character strings in <replaceable>input</replaceable> are
interpreted. This option is necessary because old SPSS system files,
and SPSS/PC+ system files, do not self-identify their encoding.
</para>
</listitem></varlistentry><varlistentry><term><option>-k <replaceable>variable</replaceable>…</option>
</term><term><option>--keep=<replaceable>variable</replaceable>…</option>
</term><listitem><para>By default, <command>pspp-convert</command> includes all the variables from the
input file. Use this option to list specific variables to include;
any variables not listed will be dropped. The variables in the output
file will also be reordered into the given order. The variable list
may use <literal>TO</literal> in the same way as in PSPP syntax, <emphasis>e.g.</emphasis> if the
dictionary contains consecutive variables <literal>a</literal>, <literal>b</literal>,
<literal>c</literal>, and <literal>d</literal>, then <option>--keep='a to d'</option> will include all
of them (and no others).
</para>
</listitem></varlistentry><varlistentry><term><option>-d <replaceable>variable</replaceable>…</option>
</term><term><option>--drop=<replaceable>variable</replaceable>…</option>
</term><listitem><para>Drops the specified variables from the output.
</para>
<para>When <option>--keep</option> and <option>--drop</option> are used together,
<option>--keep</option> is processed first.
</para>
</listitem></varlistentry><varlistentry><term><option>-h</option>
</term><term><option>--help</option>
</term><listitem><para>Prints a usage message on stdout and exits.
</para>
</listitem></varlistentry><varlistentry><term><option>-v</option>
</term><term><option>--version</option>
</term><listitem><para>Prints version information on stdout and exits.
</para></listitem></varlistentry></variablelist>
<para>The following options affect CSV output:
</para>
<variablelist><varlistentry><term><option>--recode</option>
</term><listitem><para>By default, <command>pspp-convert</command> writes user-missing values to CSV
output files as their regular values. With this option,
<command>pspp-convert</command> recodes them to system-missing values (which
are written as a single space).
</para>
</listitem></varlistentry><varlistentry><term><option>--no-var-names</option>
</term><listitem><para>By default, <command>pspp-convert</command> writes the variable names as the
first line of output. With this option, <command>pspp-convert</command> omits
this line.
</para>
</listitem></varlistentry><varlistentry><term><option>--labels</option>
</term><listitem><para>By default, <command>pspp-convert</command> writes variables’ values to CSV
output files. With this option, <command>pspp-convert</command> writes value
labels.
</para>
</listitem></varlistentry><varlistentry><term><option>--print-formats</option>
</term><listitem><para>By default, <command>pspp-convert</command> writes numeric variables as plain
numbers. This option makes <command>pspp-convert</command> honor variables’
print formats.
</para>
</listitem></varlistentry><varlistentry><term><option>--decimal=<replaceable>decimal</replaceable></option>
</term><listitem><para>This option sets the character used as a decimal point in output. The
default is ‘<literal>.</literal>’.
</para>
</listitem></varlistentry><varlistentry><term><option>--delimiter=<replaceable>delimiter</replaceable></option>
</term><listitem><para>This option sets the character used to separate fields in output. The
default is ‘<literal>,</literal>’, unless the decimal point is ‘<literal>,</literal>’, in which
case ‘<literal>;</literal>’ is used.
</para>
</listitem></varlistentry><varlistentry><term><option>--qualifier=<replaceable>qualifier</replaceable></option>
</term><listitem><para>The option sets the character used to quote fields that contain the
delimiter. The default is ‘<literal>"</literal>’.
</para></listitem></varlistentry></variablelist>
<para>The following options specify how to obtain the password for encrypted
files:
</para>
<variablelist><varlistentry><term><option>-p <replaceable>password</replaceable></option>
</term></varlistentry><varlistentry><term><option>--password=<replaceable>password</replaceable></option>
</term><listitem><para>Specifies the password to use to decrypt an encrypted SPSS system file
or syntax file. If this option is not specified,
<command>pspp-convert</command> will prompt interactively for the password as
necessary.
</para>
<para>Be aware that command-line options, including passwords, may be
visible to other users on multiuser systems.
</para>
<para>When used with <option>-a</option> (or <option>--password-alphabet</option>) and
<option>-l</option> (or <option>--password-length</option>), this option specifies the
starting point for the search. This can be used to restart a search
that was interrupted.
</para>
</listitem></varlistentry><varlistentry><term><option>-a <replaceable>alphabet</replaceable></option>
</term></varlistentry><varlistentry><term><option>--password-alphabet=<replaceable>alphabet</replaceable></option>
</term><listitem><para>Specifies the alphabet of symbols over which to search for an
encrypted file’s password. <replaceable>alphabet</replaceable> may include individual
characters and ranges delimited by ‘<literal>-</literal>’. For example, <option>-a
a-z</option> searches lowercase letters, <option>-a A-Z0-9</option> searches uppercase
letters and digits, and <option>-a ' -~'</option> searches all printable ASCII
characters.
</para>
</listitem></varlistentry><varlistentry><term><option>-l <replaceable>max-length</replaceable></option>
</term></varlistentry><varlistentry><term><option>--password-length=<replaceable>max-length</replaceable></option>
</term><listitem><para>Specifies the maximum length of the passwords to try.
</para>
</listitem></varlistentry><varlistentry><term><option>--password-list=<replaceable>file</replaceable></option>
</term><listitem><para>Specifies a file to read containing a list of passwords to try, one
per line. If <replaceable>file</replaceable> is <filename>-</filename>, reads from stdin.
</para></listitem></varlistentry></variablelist><!-- PSPP - a program for statistical analysis. -->
<!-- Copyright (C) 2019, 2020 Free Software Foundation, Inc. -->
<!-- Permission is granted to copy, distribute and/or modify this document -->
<!-- under the terms of the GNU Free Documentation License, Version 1.3 -->
<!-- or any later version published by the Free Software Foundation; -->
<!-- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -->
<!-- A copy of the license is included in the section entitled "GNU -->
<!-- Free Documentation License". -->
<!-- -->
</chapter>
<chapter label="19" id="Invoking-pspp_002doutput">
<title>Invoking <command>pspp-output</command></title>
<indexterm role="cp"><primary>Invocation</primary></indexterm>
<indexterm role="cp"><primary><command>pspp-output</command></primary></indexterm>
<para><command>pspp-output</command> is a command-line utility accompanying PSPP.
It supports multiple operations on SPSS viewer or <filename>.spv</filename> files,
here called SPV files. SPSS 16 and later writes SPV files to
represent the contents of its output editor.
</para>
<para>SPSS 15 and earlier versions instead use <filename>.spo</filename> files.
<command>pspp-output</command> does not support this format.
</para>
<para><command>pspp-options</command> may be invoked in the following ways:
</para>
<literallayout><literal>pspp-output</literal> <literal>detect</literal> <replaceable>file</replaceable>
<literal>pspp-output</literal> [<replaceable>options</replaceable>] <literal>dir</literal> <replaceable>file</replaceable>
<literal>pspp-output</literal> [<replaceable>options</replaceable>] <literal>convert</literal> <replaceable>source</replaceable> <replaceable>destination</replaceable>
<literal>pspp-output</literal> [<replaceable>options</replaceable>] <literal>get-table-look</literal> <replaceable>source</replaceable> <replaceable>destination</replaceable>
<literal>pspp-output</literal> [<replaceable>options</replaceable>] <literal>convert-table-look</literal> <replaceable>source</replaceable> <replaceable>destination</replaceable>
<literal>pspp-output --<!-- /@w -->help</literal>
<literal>pspp-output --<!-- /@w -->version</literal>
</literallayout>
<para>Each of these forms is documented separately below.
<command>pspp-output</command> also has several undocumented command forms that
developers may find useful for debugging.
</para>
<sect1 label="19.1" id="The-pspp_002doutput-detect-Command">
<title>The <literal>detect</literal> Command</title>
<literallayout><literal>pspp-output</literal> <literal>detect</literal> <replaceable>file</replaceable>
</literallayout>
<para>When <replaceable>file</replaceable> is an SPV file, <command>pspp-output</command> exits
successfully without outputting anything. When <replaceable>file</replaceable> is not an
SPV file or some other error occurs, <command>pspp-output</command> prints an
error message and exits with a failure indication.
</para>
</sect1>
<sect1 label="19.2" id="The-pspp_002doutput-dir-Command">
<title>The <literal>dir</literal> Command</title>
<literallayout><literal>pspp-output</literal> [<replaceable>options</replaceable>] <literal>dir</literal> <replaceable>file</replaceable>
</literallayout>
<para>Prints on stdout a table of contents for SPV file <replaceable>file</replaceable>. By
default, this table lists every object in the file, except for hidden
objects. See <link linkend="Input-Selection-Options">Input Selection Options</link>, for information on the
options available to select a subset of objects.
</para>
<para>The following additional option for <command>dir</command> is intended mainly
for use by PSPP developers:
</para>
<variablelist><varlistentry><term><option>--member-names</option>
</term><listitem><para>Also show the names of the Zip members associated with each object.
</para></listitem></varlistentry></variablelist>
</sect1>
<sect1 label="19.3" id="The-pspp_002doutput-convert-Command">
<title>The <literal>convert</literal> Command</title>
<literallayout><literal>pspp-output</literal> [<replaceable>options</replaceable>] <literal>convert</literal> <replaceable>source</replaceable> <replaceable>destination</replaceable>
</literallayout>
<para>Reads SPV file <replaceable>source</replaceable> and converts it to another format, writing
the output to <replaceable>destination</replaceable>.
</para>
<para>By default, the intended format for <replaceable>destination</replaceable> is inferred
based on its extension, in the same way that the <command>pspp</command>
program does for its output files. See <link linkend="Invoking-PSPP">Invoking PSPP</link>, for details.
</para>
<para>See <link linkend="Input-Selection-Options">Input Selection Options</link>, for information on the options
available to select a subset of objects to include in the output. The
following additional options are accepted:
</para>
<variablelist><varlistentry><term><option>-O format=<replaceable>format</replaceable></option>
</term><listitem><para>Overrides the format inferred from the output file’s extension. Use
<option>--help</option> to list the available formats. See <link linkend="Invoking-PSPP">Invoking PSPP</link>,
for details of the available output formats.
</para>
</listitem></varlistentry><varlistentry><term><option>-O <replaceable>option</replaceable>=<replaceable>value</replaceable></option>
</term><listitem><para>Sets an option for the output file format. See <link linkend="Invoking-PSPP">Invoking PSPP</link>, for
details of the available output options.
</para>
</listitem></varlistentry><varlistentry><term><option>-F</option>
</term><term><option>--force</option>
</term><listitem><para>By default, if the source is corrupt or otherwise cannot be processed,
the destination is not written. With <option>-F</option> or <option>--force</option>,
the destination is written as best it can, even with errors.
</para>
</listitem></varlistentry><varlistentry><term><option>--table-look=<replaceable>file</replaceable></option>
</term><listitem><para>Reads a table style from <replaceable>file</replaceable> and applies it to all of the
output tables. The file should be a TableLook <filename>.stt</filename> or
<filename>.tlo</filename> file.
</para>
</listitem></varlistentry><varlistentry><term><option>--use-page-setup</option>
</term><listitem><para>By default, the <literal>convert</literal> command uses the default page setup
(for example, page size and margins) for <replaceable>destination</replaceable>, or the one
specified with <option>-O</option> options, if any. Specify this option to
ignore these sources of page setup in favor of the one embedded in the
SPV, if any.
</para></listitem></varlistentry></variablelist>
</sect1>
<sect1 label="19.4" id="The-pspp_002doutput-get_002dtable_002dlook-Command">
<title>The <literal>get-table-look</literal> Command</title>
<literallayout><literal>pspp-output</literal> [<replaceable>options</replaceable>] <literal>get-table-look</literal> <replaceable>source</replaceable> <replaceable>destination</replaceable>
</literallayout>
<para>Reads SPV file <replaceable>source</replaceable>, applies any selection options
(see <link linkend="Input-Selection-Options">Input Selection Options</link>), picks the first table from the
selected object, extracts the TableLook from that table, and writes it
to <replaceable>destination</replaceable> (typically with an <filename>.stt</filename> extension) in the
TableLook XML format.
</para>
<para>Use ‘<literal>-</literal>’ for <replaceable>source</replaceable> to instead write the default look to
<replaceable>destination</replaceable>.
</para>
<para>The user may use the TableLook file to change the style of tables in
other files, by passing it to the <option>--table-look</option> option on the
<literal>convert</literal> command.
</para>
</sect1>
<sect1 label="19.5" id="The-pspp_002doutput-convert_002dtable_002dlook-Command">
<title>The <literal>convert-table-look</literal> Command</title>
<literallayout><literal>pspp-output</literal> [<replaceable>options</replaceable>] <literal>convert-table-look</literal> <replaceable>source</replaceable> <replaceable>destination</replaceable>
</literallayout>
<para>Reads <filename>.stt</filename> or <filename>.tlo</filename> file <replaceable>source</replaceable>, and writes it back
to <replaceable>destination</replaceable> (typically with an <filename>.stt</filename> extension) in the
TableLook XML format. This is useful for converting a TableLook
<filename>.tlo</filename> file from SPSS 15 or earlier into the newer <filename>.stt</filename>
format.
</para>
</sect1>
<sect1 label="19.6" id="Input-Selection-Options">
<title>Input Selection Options</title>
<para>The <command>dir</command> and <command>convert</command> commands, by default, operate
on all of the objects in the source SPV file, except for objects that
are not visible in the output viewer window. The user may specify
these options to select a subset of the input objects. When multiple
options are used, only objects that satisfy all of them are selected:
</para>
<variablelist><varlistentry><term><option>--select=[^]<replaceable>class</replaceable>…</option>
</term><listitem><para>Include only objects of the given <replaceable>class</replaceable>; with leading ‘<literal>^</literal>’,
include only objects not in the class. Use commas to separate
multiple classes. The supported classes are:
</para>
<blockquote><para><literal>charts headings logs models tables texts trees warnings
outlineheaders pagetitle notes unknown other</literal>
</para></blockquote>
<para>Use <option>--select=help</option> to print this list of classes.
</para>
</listitem></varlistentry><varlistentry><term><option>--commands=[^]<replaceable>command</replaceable>…</option>
</term><term><option>--subtypes=[^]<replaceable>subtype</replaceable>…</option>
</term><term><option>--labels=[^]<replaceable>label</replaceable>…</option>
</term><listitem><para>Include only objects with the specified <replaceable>command</replaceable>, <replaceable>subtype</replaceable>,
or <replaceable>label</replaceable>. With a leading ‘<literal>^</literal>’, include only the objects
that do not match. Multiple values may be specified separated by
commas. An asterisk at the end of a value acts as a wildcard.
</para>
<para>The <option>--command</option> option matches command identifiers, case
insensitively. All of the objects produced by a single command use
the same, unique command identifier. Command identifiers are always
in English regardless of the language used for output. They often
differ from the command name in PSPP syntax. Use the
<command>pspp-output</command> program’s <command>dir</command> command to print command
identifiers in particular output.
</para>
<para>The <option>--subtypes</option> option matches particular tables within a
command, case insensitively. Subtypes are not necessarily unique: two
commands that produce similar output tables may use the same subtype.
Subtypes are always in English and <command>dir</command> will print them.
</para>
<para>The <option>--labels</option> option matches the labels in table output (that
is, the table titles). Labels are affected by the output language,
variable names and labels, split file settings, and other factors.
</para>
</listitem></varlistentry><varlistentry><term><option>--nth-commands=<replaceable>n</replaceable>…</option>
</term><listitem><para>Include only objects from the <replaceable>n</replaceable>th command that matches
<option>--command</option> (or the <replaceable>n</replaceable>th command overall if
<option>--command</option> is not specified), where <replaceable>n</replaceable> is 1 for the first
command, 2 for the second, and so on.
</para>
</listitem></varlistentry><varlistentry><term><option>--instances=<replaceable>instance</replaceable>…</option>
</term><listitem><para>Include the specified <replaceable>instance</replaceable> of an object that matches the
other criteria within a single command. The <replaceable>instance</replaceable> may be a
number (1 for the first instance, 2 for the second, and so on) or
<literal>last</literal> for the last instance.
</para>
</listitem></varlistentry><varlistentry><term><option>--show-hidden</option>
</term><listitem><para>Include hidden output objects in the output. By default, they are
excluded.
</para>
</listitem></varlistentry><varlistentry><term><option>--or</option>
</term><listitem><para>Separates two sets of selection options. Objects selected by either
set of options are included in the output.
</para></listitem></varlistentry></variablelist>
<para>The following additional input selection options are intended mainly
for use by PSPP developers:
</para>
<variablelist><varlistentry><term><option>--errors</option>
</term><listitem><para>Include only objects that cause an error when read. With the
<command>convert</command> command, this is most useful in conjunction with the
<option>--force</option> option.
</para>
</listitem></varlistentry><varlistentry><term><option>--members=<replaceable>member</replaceable>…</option>
</term><listitem><para>Include only the objects that include a listed Zip file <replaceable>member</replaceable>.
More than one name may be included, comma-separated. The members in
an SPV file may be listed with the <command>dir</command> command by adding the
<option>--show-members</option> option or with the <command>zipinfo</command> program
included with many operating systems. Error messages that
<command>pspp-output</command> prints when it reads SPV files also often
include member names.
</para>
</listitem></varlistentry><varlistentry><term><option>--member-names</option>
</term><listitem><para>Displays the name of the Zip member or members associated with each
object just above the object itself.
</para></listitem></varlistentry></variablelist><!-- PSPP - a program for statistical analysis. -->
<!-- Copyright (C) 2017, 2020 Free Software Foundation, Inc. -->
<!-- Permission is granted to copy, distribute and/or modify this document -->
<!-- under the terms of the GNU Free Documentation License, Version 1.3 -->
<!-- or any later version published by the Free Software Foundation; -->
<!-- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -->
<!-- A copy of the license is included in the section entitled "GNU -->
<!-- Free Documentation License". -->
<!-- -->
</sect1>
</chapter>
<chapter label="20" id="Invoking-pspp_002ddump_002dsav">
<title>Invoking <command>pspp-dump-sav</command></title>
<indexterm role="cp"><primary>Invocation</primary></indexterm>
<indexterm role="cp"><primary><command>pspp-dump-sav</command></primary></indexterm>
<para><command>pspp-dump-sav</command> is a command-line utility accompanying
PSPP. It is not installed by default, so it may be missing
from your PSPP installation.
It reads one or more SPSS system files and prints their
contents. The output format is useful for debugging system file
readers and writers and for discovering how to interpret unknown or
poorly understood records. End users may find the output useful for
providing the PSPP developers information about system files that PSPP
does not accurately read.
</para>
<para>Synopsis:
</para>
<literallayout><literal>pspp-dump-sav</literal> [<literal>-d</literal>[<replaceable>maxcases</replaceable>] | <literal>--<!-- /@w -->data</literal>[<literal>=</literal><replaceable>maxcases</replaceable>]] <replaceable>file</replaceable>…
<literal>pspp-dump-sav --<!-- /@w -->help</literal> | <literal>-h</literal>
<literal>pspp-dump-sav --<!-- /@w -->version</literal> | <literal>-v</literal>
</literallayout>
<para>The following options are accepted:
</para>
<variablelist><varlistentry><term><literal>-d</literal>[<replaceable>maxcases</replaceable>]
</term></varlistentry><varlistentry><term><literal>--<!-- /@w -->data</literal>[<literal>=</literal><replaceable>maxcases</replaceable>]
</term><listitem><para>By default, <command>pspp-dump-sav</command> does not print any of the data in a
system file, only the file headers. Specify this option to print the
data as well. If <replaceable>maxcases</replaceable> is specified, then it limits the
number of cases printed.
</para>
</listitem></varlistentry><varlistentry><term><literal>-h</literal>
</term><term><literal>--<!-- /@w -->help</literal>
</term><listitem><para>Prints a usage message on stdout and exits.
</para>
</listitem></varlistentry><varlistentry><term><literal>-v</literal>
</term><term><literal>--<!-- /@w -->version</literal>
</term><listitem><para>Prints version information on stdout and exits.
</para></listitem></varlistentry></variablelist>
<para>Some errors that prevent files from being interpreted successfully
cause <command>pspp-dump-sav</command> to exit without reading any additional
files given on the command line.
<!-- PSPP - a program for statistical analysis. -->
<!-- Copyright (C) 2017, 2020 Free Software Foundation, Inc. -->
<!-- Permission is granted to copy, distribute and/or modify this document -->
<!-- under the terms of the GNU Free Documentation License, Version 1.3 -->
<!-- or any later version published by the Free Software Foundation; -->
<!-- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -->
<!-- A copy of the license is included in the section entitled "GNU -->
<!-- Free Documentation License". -->
<!-- -->
</para></chapter>
<chapter label="21" id="Not-Implemented">
<title>Not Implemented</title>
<para>This chapter lists parts of the PSPP language that are not yet
implemented.
</para>
<indexterm role="cp"><primary>unimplemented commands</primary></indexterm>
<indexterm role="cp"><primary>commands, unimplemented</primary></indexterm>
<!-- Generated from ../src/language/command.def by get-commands.py -->
<!-- Do not modify! -->
<variablelist><varlistentry><term><literal>2SLS</literal>
</term><listitem><para>Two stage least squares regression
</para>
</listitem></varlistentry><varlistentry><term><literal>ACF</literal>
</term><listitem><para>Autocorrelation function
</para>
</listitem></varlistentry><varlistentry><term><literal>ALSCAL</literal>
</term><listitem><para>Multidimensional scaling
</para>
</listitem></varlistentry><varlistentry><term><literal>ANACOR</literal>
</term><listitem><para>Correspondence analysis
</para>
</listitem></varlistentry><varlistentry><term><literal>ANOVA</literal>
</term><listitem><para>Factorial analysis of variance
</para>
</listitem></varlistentry><varlistentry><term><literal>CASEPLOT</literal>
</term><listitem><para>Plot time series
</para>
</listitem></varlistentry><varlistentry><term><literal>CASESTOVARS</literal>
</term><listitem><para>Restructure complex data
</para>
</listitem></varlistentry><varlistentry><term><literal>CATPCA</literal>
</term><listitem><para>Categorical principle components analysis
</para>
</listitem></varlistentry><varlistentry><term><literal>CATREG</literal>
</term><listitem><para>Categorical regression
</para>
</listitem></varlistentry><varlistentry><term><literal>CCF</literal>
</term><listitem><para>Time series cross correlation
</para>
</listitem></varlistentry><varlistentry><term><literal>CLEAR TRANSFORMATIONS</literal>
</term><listitem><para>Clears transformations from active dataset
</para>
</listitem></varlistentry><varlistentry><term><literal>CLUSTER</literal>
</term><listitem><para>Hierarchical clustering
</para>
</listitem></varlistentry><varlistentry><term><literal>CONJOINT</literal>
</term><listitem><para>Analyse full concept data
</para>
</listitem></varlistentry><varlistentry><term><literal>CORRESPONDENCE</literal>
</term><listitem><para>Show correspondence
</para>
</listitem></varlistentry><varlistentry><term><literal>COXREG</literal>
</term><listitem><para>Cox proportional hazards regression
</para>
</listitem></varlistentry><varlistentry><term><literal>CREATE</literal>
</term><listitem><para>Create time series data
</para>
</listitem></varlistentry><varlistentry><term><literal>CSDESCRIPTIVES</literal>
</term><listitem><para>Complex samples descriptives
</para>
</listitem></varlistentry><varlistentry><term><literal>CSGLM</literal>
</term><listitem><para>Complex samples GLM
</para>
</listitem></varlistentry><varlistentry><term><literal>CSLOGISTIC</literal>
</term><listitem><para>Complex samples logistic regression
</para>
</listitem></varlistentry><varlistentry><term><literal>CSPLAN</literal>
</term><listitem><para>Complex samples design
</para>
</listitem></varlistentry><varlistentry><term><literal>CSSELECT</literal>
</term><listitem><para>Select complex samples
</para>
</listitem></varlistentry><varlistentry><term><literal>CSTABULATE</literal>
</term><listitem><para>Tabulate complex samples
</para>
</listitem></varlistentry><varlistentry><term><literal>CURVEFIT</literal>
</term><listitem><para>Fit curve to line plot
</para>
</listitem></varlistentry><varlistentry><term><literal>DATE</literal>
</term><listitem><para>Create time series data
</para>
</listitem></varlistentry><varlistentry><term><literal>DETECTANOMALY</literal>
</term><listitem><para>Find unusual cases
</para>
</listitem></varlistentry><varlistentry><term><literal>DISCRIMINANT</literal>
</term><listitem><para>Linear discriminant analysis
</para>
</listitem></varlistentry><varlistentry><term><literal>EDIT</literal>
</term><listitem><para>obsolete
</para>
</listitem></varlistentry><varlistentry><term><literal>END FILE TYPE</literal>
</term><listitem><para>Ends complex data input
</para>
</listitem></varlistentry><varlistentry><term><literal>FILE TYPE</literal>
</term><listitem><para>Complex data input
</para>
</listitem></varlistentry><varlistentry><term><literal>FIT</literal>
</term><listitem><para>Goodness of Fit
</para>
</listitem></varlistentry><varlistentry><term><literal>GENLOG</literal>
</term><listitem><para>Categorical model fitting
</para>
</listitem></varlistentry><varlistentry><term><literal>GET TRANSLATE</literal>
</term><listitem><para>Read other file formats
</para>
</listitem></varlistentry><varlistentry><term><literal>GGRAPH</literal>
</term><listitem><para>Custom defined graphs
</para>
</listitem></varlistentry><varlistentry><term><literal>HILOGLINEAR</literal>
</term><listitem><para>Hierarchical loglinear models
</para>
</listitem></varlistentry><varlistentry><term><literal>HOMALS</literal>
</term><listitem><para>Homogeneity analysis
</para>
</listitem></varlistentry><varlistentry><term><literal>IGRAPH</literal>
</term><listitem><para>Interactive graphs
</para>
</listitem></varlistentry><varlistentry><term><literal>INFO</literal>
</term><listitem><para>Local Documentation
</para>
</listitem></varlistentry><varlistentry><term><literal>KEYED DATA LIST</literal>
</term><listitem><para>Read nonsequential data
</para>
</listitem></varlistentry><varlistentry><term><literal>KM</literal>
</term><listitem><para>Kaplan-Meier
</para>
</listitem></varlistentry><varlistentry><term><literal>LOGLINEAR</literal>
</term><listitem><para>General model fitting
</para>
</listitem></varlistentry><varlistentry><term><literal>MANOVA</literal>
</term><listitem><para>Multivariate analysis of variance
</para>
</listitem></varlistentry><varlistentry><term><literal>MAPS</literal>
</term><listitem><para>Geographical display
</para>
</listitem></varlistentry><varlistentry><term><literal>MIXED</literal>
</term><listitem><para>Mixed linear models
</para>
</listitem></varlistentry><varlistentry><term><literal>MODEL CLOSE</literal>
</term><listitem><para>Close server connection
</para>
</listitem></varlistentry><varlistentry><term><literal>MODEL HANDLE</literal>
</term><listitem><para>Define server connection
</para>
</listitem></varlistentry><varlistentry><term><literal>MODEL LIST</literal>
</term><listitem><para>Show existing models
</para>
</listitem></varlistentry><varlistentry><term><literal>MODEL NAME</literal>
</term><listitem><para>Specify model label
</para>
</listitem></varlistentry><varlistentry><term><literal>MULTIPLE CORRESPONDENCE</literal>
</term><listitem><para>Multiple correspondence analysis
</para>
</listitem></varlistentry><varlistentry><term><literal>MULT RESPONSE</literal>
</term><listitem><para>Multiple response analysis
</para>
</listitem></varlistentry><varlistentry><term><literal>MVA</literal>
</term><listitem><para>Missing value analysis
</para>
</listitem></varlistentry><varlistentry><term><literal>NAIVEBAYES</literal>
</term><listitem><para>Small sample bayesian prediction
</para>
</listitem></varlistentry><varlistentry><term><literal>NLR</literal>
</term><listitem><para>Non Linear Regression
</para>
</listitem></varlistentry><varlistentry><term><literal>NOMREG</literal>
</term><listitem><para>Multinomial logistic regression
</para>
</listitem></varlistentry><varlistentry><term><literal>NONPAR CORR</literal>
</term><listitem><para>Nonparametric correlation
</para>
</listitem></varlistentry><varlistentry><term><literal>NUMBERED</literal>
</term><listitem>
</listitem></varlistentry><varlistentry><term><literal>OLAP CUBES</literal>
</term><listitem><para>On-line analytical processing
</para>
</listitem></varlistentry><varlistentry><term><literal>OMS</literal>
</term><listitem><para>Output management
</para>
</listitem></varlistentry><varlistentry><term><literal>ORTHOPLAN</literal>
</term><listitem><para>Orthogonal effects design
</para>
</listitem></varlistentry><varlistentry><term><literal>OVERALS</literal>
</term><listitem><para>Nonlinear canonical correlation
</para>
</listitem></varlistentry><varlistentry><term><literal>PACF</literal>
</term><listitem><para>Partial autocorrelation
</para>
</listitem></varlistentry><varlistentry><term><literal>PARTIAL CORR</literal>
</term><listitem><para>Partial correlation
</para>
</listitem></varlistentry><varlistentry><term><literal>PLANCARDS</literal>
</term><listitem><para>Conjoint analysis planning
</para>
</listitem></varlistentry><varlistentry><term><literal>PLUM</literal>
</term><listitem><para>Estimate ordinal regression models
</para>
</listitem></varlistentry><varlistentry><term><literal>POINT</literal>
</term><listitem><para>Marker in keyed file
</para>
</listitem></varlistentry><varlistentry><term><literal>PPLOT</literal>
</term><listitem><para>Plot time series variables
</para>
</listitem></varlistentry><varlistentry><term><literal>PREDICT</literal>
</term><listitem><para>Specify forecast period
</para>
</listitem></varlistentry><varlistentry><term><literal>PREFSCAL</literal>
</term><listitem><para>Multidimensional unfolding
</para>
</listitem></varlistentry><varlistentry><term><literal>PRINCALS</literal>
</term><listitem><para>PCA by alternating least squares
</para>
</listitem></varlistentry><varlistentry><term><literal>PROBIT</literal>
</term><listitem><para>Probit analysis
</para>
</listitem></varlistentry><varlistentry><term><literal>PROCEDURE OUTPUT</literal>
</term><listitem><para>Specify output file
</para>
</listitem></varlistentry><varlistentry><term><literal>PROXIMITIES</literal>
</term><listitem><para>Pairwise similarity
</para>
</listitem></varlistentry><varlistentry><term><literal>PROXSCAL</literal>
</term><listitem><para>Multidimensional scaling of proximity data
</para>
</listitem></varlistentry><varlistentry><term><literal>RATIO STATISTICS</literal>
</term><listitem><para>Descriptives of ratios
</para>
</listitem></varlistentry><varlistentry><term><literal>READ MODEL</literal>
</term><listitem><para>Read new model
</para>
</listitem></varlistentry><varlistentry><term><literal>RECORD TYPE</literal>
</term><listitem><para>Defines a type of record within FILE TYPE
</para>
</listitem></varlistentry><varlistentry><term><literal>REFORMAT</literal>
</term><listitem><para>Read obsolete files
</para>
</listitem></varlistentry><varlistentry><term><literal>REPEATING DATA</literal>
</term><listitem><para>Specify multiple cases per input record
</para>
</listitem></varlistentry><varlistentry><term><literal>REPORT</literal>
</term><listitem><para>Pretty print working file
</para>
</listitem></varlistentry><varlistentry><term><literal>RMV</literal>
</term><listitem><para>Replace missing values
</para>
</listitem></varlistentry><varlistentry><term><literal>SCRIPT</literal>
</term><listitem><para>Run script file
</para>
</listitem></varlistentry><varlistentry><term><literal>SEASON</literal>
</term><listitem><para>Estimate seasonal factors
</para>
</listitem></varlistentry><varlistentry><term><literal>SELECTPRED</literal>
</term><listitem><para>Select predictor variables
</para>
</listitem></varlistentry><varlistentry><term><literal>SPCHART</literal>
</term><listitem><para>Plot control charts
</para>
</listitem></varlistentry><varlistentry><term><literal>SPECTRA</literal>
</term><listitem><para>Plot spectral density
</para>
</listitem></varlistentry><varlistentry><term><literal>STEMLEAF</literal>
</term><listitem><para>Plot stem-and-leaf display
</para>
</listitem></varlistentry><varlistentry><term><literal>SUMMARIZE</literal>
</term><listitem><para>Univariate statistics
</para>
</listitem></varlistentry><varlistentry><term><literal>SURVIVAL</literal>
</term><listitem><para>Survival analysis
</para>
</listitem></varlistentry><varlistentry><term><literal>TDISPLAY</literal>
</term><listitem><para>Display active models
</para>
</listitem></varlistentry><varlistentry><term><literal>TREE</literal>
</term><listitem><para>Create classification tree
</para>
</listitem></varlistentry><varlistentry><term><literal>TSAPPLY</literal>
</term><listitem><para>Apply time series model
</para>
</listitem></varlistentry><varlistentry><term><literal>TSET</literal>
</term><listitem><para>Set time sequence variables
</para>
</listitem></varlistentry><varlistentry><term><literal>TSHOW</literal>
</term><listitem><para>Show time sequence variables
</para>
</listitem></varlistentry><varlistentry><term><literal>TSMODEL</literal>
</term><listitem><para>Estimate time series model
</para>
</listitem></varlistentry><varlistentry><term><literal>TSPLOT</literal>
</term><listitem><para>Plot time sequence variables
</para>
</listitem></varlistentry><varlistentry><term><literal>TWOSTEP CLUSTER</literal>
</term><listitem><para>Cluster observations
</para>
</listitem></varlistentry><varlistentry><term><literal>UNIANOVA</literal>
</term><listitem><para>Univariate analysis
</para>
</listitem></varlistentry><varlistentry><term><literal>UNNUMBERED</literal>
</term><listitem><para>obsolete
</para>
</listitem></varlistentry><varlistentry><term><literal>VALIDATEDATA</literal>
</term><listitem><para>Identify suspicious cases
</para>
</listitem></varlistentry><varlistentry><term><literal>VARCOMP</literal>
</term><listitem><para>Estimate variance
</para>
</listitem></varlistentry><varlistentry><term><literal>VARSTOCASES</literal>
</term><listitem><para>Restructure complex data
</para>
</listitem></varlistentry><varlistentry><term><literal>VERIFY</literal>
</term><listitem><para>Report time series
</para>
</listitem></varlistentry><varlistentry><term><literal>WLS</literal>
</term><listitem><para>Weighted least squares regression
</para>
</listitem></varlistentry><varlistentry><term><literal>XGRAPH</literal>
</term><listitem><para>High resolution charts
</para>
</listitem></varlistentry></variablelist><!-- Local Variables: -->
<!-- buffer-read-only: t -->
<!-- End: -->
<!-- PSPP - a program for statistical analysis. -->
<!-- Copyright (C) 2017, 2020 Free Software Foundation, Inc. -->
<!-- Permission is granted to copy, distribute and/or modify this document -->
<!-- under the terms of the GNU Free Documentation License, Version 1.3 -->
<!-- or any later version published by the Free Software Foundation; -->
<!-- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -->
<!-- A copy of the license is included in the section entitled "GNU -->
<!-- Free Documentation License". -->
<!-- -->
</chapter>
<chapter label="22" id="Bugs">
<title>Bugs</title>
<indexterm role="cp"><primary>bugs</primary></indexterm>
<indexterm role="cp"><primary>troubleshooting</primary></indexterm>
<para>Occasionally you may encounter a bug in PSPP.
</para>
<para>If you believe you have found a bug, please
make sure that it really is a bug. Sometimes, what may appear
to be a bug, turns out to be a misunderstanding of how to use the program.
If you are unsure, ask for advice on the pspp-users mailing list.
Information about the mailing list is at <ulink url="http://lists.gnu.org/mailman/listinfo/pspp-users">http://lists.gnu.org/mailman/listinfo/pspp-users</ulink>.
</para>
<para>It is also valuable to try the newest version of PSPP, since the
problem may have already been fixed. You can always find the newest
version of PSPP by visiting <ulink url="https://www.gnu.org/s/pspp">the PSPP
website</ulink>. You might have obtained PSPP from a downstream packager,
such as a GNU/Linux distribution; if your downstream package is not
up-to-date, please ask the distributor to update to the newest
version.
</para>
<para>If the problem persists in the up-to-date version, check to see if it
has already been reported. Reported issues are listed at
<ulink url="http://savannah.gnu.org/bugs/?group=pspp">http://savannah.gnu.org/bugs/?group=pspp</ulink>. If it has already
been reported, you might consider adding a comment with additional
information or even just to mention that you are also experiencing the
problem, since the PSPP developers are often inclined to work on
issues that are important to a large number of users.
</para>
<para>For known issues in individual language features, see the relevant section in see <link linkend="Language">Language</link>.
</para>
<para>If the problem exists in a recent version and it has not already
been reported, then please report it.
</para>
<sect1 label="22.1">
<title>How to report bugs</title>
<para>The best way to send a bug report is using the web page at
<ulink url="http://savannah.gnu.org/bugs/?group=pspp">http://savannah.gnu.org/bugs/?group=pspp</ulink>.
Alternatively, bug reports may be sent by email
to <email>bug-gnu-pspp@gnu.org</email>.
</para>
<para>A high-quality bug report allows the developers to understand,
reproduce, and ultimately fix the problem. We recommend
including the following:
</para>
<itemizedlist><listitem><para>The version of PSPP in which you encountered the problem. It also
often helps to know some information about how PSPP was built.
</para>
<para>With PSPP command syntax, <literal>SHOW SYSTEM.</literal> will output
everything we ordinarily need. In the PSPPIRE GUI,
Help → System Info produces the same output.
</para>
</listitem><listitem><para>The operating system and type of computer on which it is running.
</para>
</listitem><listitem><para>A sample of the syntax which causes the problem or, if it is a user
interface problem, the sequence of steps required to reproduce it.
Screenshots can be helpful for reporting bugs in the graphical user
interface, especially since GUI bugs can arise on some systems but
not others, but they do not usually help fixing other kinds of bugs.
</para>
</listitem><listitem><para>A description of what you think is wrong: What happened that you
didn’t expect, and what did you expect to happen? Include any error
messages that PSPP output.
</para></listitem></itemizedlist>
<para>Here is one example of a bug report that includes all of the elements above:
</para>
<sidebar><screen>I'm running PSPP on a system where <literal>SHOW SYSTEM.</literal> outputs the
following:
<!-- Use @image for Info and for plaintext output. -->
<!-- Use HTML for HTML output. -->
<!-- Use the Texi-fied version of the plaintext output for other output formats. -->
<!-- Some of these could do better, but we have not yet implemented it. -->
</screen><screen> System Information
+----------------+------------------------------------+
|Version |GNU pspp 2.1.1 |
|Host System |x86_64-pc-linux-gnu |
|Build System |x86_64-pc-linux-gnu |
|Locale Directory|/usr/local/share/locale |
|Journal File |/home/blp/.local/state/pspp/pspp.jnl|
|Compiler Version|15.2.1 20251111 (Red Hat 15.2.1-4) |
+----------------+------------------------------------+
</screen><screen>
The bug I'm seeing is that executing the following syntax:
DATA LIST FREE /x *.
BEGIN DATA.
1 2 3
END DATA.
LIST.
results in:
4
5
6
but I think the output should be:
1
2
3
</screen></sidebar>
<para>The following bug report, on the other hand, does not provide enough
information for PSPP developers to understand the problem. This means
that the developers cannot identify or fix the problem without
additional rounds of questions, which is more work for both the
reporter and the developer:
</para>
<sidebar><screen>I downloaded the latest version of PSPP and entered a sequence of numbers,
but when I analyse them it gives the wrong output.
</screen></sidebar>
<para>PSPP developers value all users’ feedback, but cannot promise
an immediate response. The bug reporting is not a consultancy or
support service, although you can make private arrangements for such
services. Since PSPP is free software, consultants have access to
the information they need to provide such support.
</para>
<para>For general enquiries or help, please use the
<ulink url="http://lists.gnu.org/mailman/listinfo/pspp-users">pspp-users
mailing list</ulink> instead of the bug mailing list or bug tracker.
</para>
<para>The PSPP bug tracker and bug reporting mailing list are public. To
privately report a security vulnerability in GNU PSPP, please send
your report to the closed mailing list <email>pspp-security@gnu.org</email>.
The PSPP developers will help you assess your report and fix problems
prior to public disclosure.
</para>
<!-- PSPP - a program for statistical analysis. -->
<!-- Copyright (C) 2017, 2020 Free Software Foundation, Inc. -->
<!-- Permission is granted to copy, distribute and/or modify this document -->
<!-- under the terms of the GNU Free Documentation License, Version 1.3 -->
<!-- or any later version published by the Free Software Foundation; -->
<!-- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -->
<!-- A copy of the license is included in the section entitled "GNU -->
<!-- Free Documentation License". -->
<!-- -->
</sect1>
</chapter>
<chapter label="23" id="Function-Index">
<title>Function Index</title>
<index role="fn"></index>
<!-- PSPP - a program for statistical analysis. -->
<!-- Copyright (C) 2017, 2020 Free Software Foundation, Inc. -->
<!-- Permission is granted to copy, distribute and/or modify this document -->
<!-- under the terms of the GNU Free Documentation License, Version 1.3 -->
<!-- or any later version published by the Free Software Foundation; -->
<!-- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -->
<!-- A copy of the license is included in the section entitled "GNU -->
<!-- Free Documentation License". -->
<!-- -->
</chapter>
<chapter label="24" id="Command-Index">
<title>Command Index</title>
<index role="vr"></index>
<!-- PSPP - a program for statistical analysis. -->
<!-- Copyright (C) 2017, 2020 Free Software Foundation, Inc. -->
<!-- Permission is granted to copy, distribute and/or modify this document -->
<!-- under the terms of the GNU Free Documentation License, Version 1.3 -->
<!-- or any later version published by the Free Software Foundation; -->
<!-- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -->
<!-- A copy of the license is included in the section entitled "GNU -->
<!-- Free Documentation License". -->
<!-- -->
</chapter>
<chapter label="25" id="Concept-Index">
<title>Concept Index</title>
<index role="cp"></index>
<!-- PSPP - a program for statistical analysis. -->
<!-- Copyright (C) 2017 Free Software Foundation, Inc. -->
<!-- Permission is granted to copy, distribute and/or modify this document -->
<!-- under the terms of the GNU Free Documentation License, Version 1.3 -->
<!-- or any later version published by the Free Software Foundation; -->
<!-- with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. -->
<!-- A copy of the license is included in the section entitled "GNU -->
<!-- Free Documentation License". -->
<!-- -->
</chapter>
<appendix label="A" id="GNU-Free-Documentation-License">
<title>GNU Free Documentation License</title>
<!-- The GNU Free Documentation License. -->
<simpara role="center">Version 1.3, 3 November 2008</simpara>
<!-- This file is intended to be included within another document, -->
<!-- hence no sectioning command or @node. -->
<literallayout>Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
<ulink url="http://fsf.org/">http://fsf.org/</ulink>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
</literallayout>
<orderedlist numeration="arabic"><listitem><para>PREAMBLE
</para>
<para>The purpose of this License is to make a manual, textbook, or other
functional and useful document <firstterm>free</firstterm> in the sense of freedom: to
assure everyone the effective freedom to copy and redistribute it,
with or without modifying it, either commercially or noncommercially.
Secondarily, this License preserves for the author and publisher a way
to get credit for their work, while not being considered responsible
for modifications made by others.
</para>
<para>This License is a kind of “copyleft”, which means that derivative
works of the document must themselves be free in the same sense. It
complements the GNU General Public License, which is a copyleft
license designed for free software.
</para>
<para>We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free
program should come with manuals providing the same freedoms that the
software does. But this License is not limited to software manuals;
it can be used for any textual work, regardless of subject matter or
whether it is published as a printed book. We recommend this License
principally for works whose purpose is instruction or reference.
</para>
</listitem><listitem><para>APPLICABILITY AND DEFINITIONS
</para>
<para>This License applies to any manual or other work, in any medium, that
contains a notice placed by the copyright holder saying it can be
distributed under the terms of this License. Such a notice grants a
world-wide, royalty-free license, unlimited in duration, to use that
work under the conditions stated herein. The “Document”, below,
refers to any such manual or work. Any member of the public is a
licensee, and is addressed as “you”. You accept the license if you
copy, modify or distribute the work in a way requiring permission
under copyright law.
</para>
<para>A “Modified Version” of the Document means any work containing the
Document or a portion of it, either copied verbatim, or with
modifications and/or translated into another language.
</para>
<para>A “Secondary Section” is a named appendix or a front-matter section
of the Document that deals exclusively with the relationship of the
publishers or authors of the Document to the Document’s overall
subject (or to related matters) and contains nothing that could fall
directly within that overall subject. (Thus, if the Document is in
part a textbook of mathematics, a Secondary Section may not explain
any mathematics.) The relationship could be a matter of historical
connection with the subject or with related matters, or of legal,
commercial, philosophical, ethical or political position regarding
them.
</para>
<para>The “Invariant Sections” are certain Secondary Sections whose titles
are designated, as being those of Invariant Sections, in the notice
that says that the Document is released under this License. If a
section does not fit the above definition of Secondary then it is not
allowed to be designated as Invariant. The Document may contain zero
Invariant Sections. If the Document does not identify any Invariant
Sections then there are none.
</para>
<para>The “Cover Texts” are certain short passages of text that are listed,
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
the Document is released under this License. A Front-Cover Text may
be at most 5 words, and a Back-Cover Text may be at most 25 words.
</para>
<para>A “Transparent” copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the
general public, that is suitable for revising the document
straightforwardly with generic text editors or (for images composed of
pixels) generic paint programs or (for drawings) some widely available
drawing editor, and that is suitable for input to text formatters or
for automatic translation to a variety of formats suitable for input
to text formatters. A copy made in an otherwise Transparent file
format whose markup, or absence of markup, has been arranged to thwart
or discourage subsequent modification by readers is not Transparent.
An image format is not Transparent if used for any substantial amount
of text. A copy that is not “Transparent” is called “Opaque”.
</para>
<para>Examples of suitable formats for Transparent copies include plain
ASCII without markup, Texinfo input format, La&tex; input
format, <acronym>SGML</acronym> or <acronym>XML</acronym> using a publicly available
<acronym>DTD</acronym>, and standard-conforming simple <acronym>HTML</acronym>,
PostScript or <acronym>PDF</acronym> designed for human modification. Examples
of transparent image formats include <acronym>PNG</acronym>, <acronym>XCF</acronym> and
<acronym>JPG</acronym>. Opaque formats include proprietary formats that can be
read and edited only by proprietary word processors, <acronym>SGML</acronym> or
<acronym>XML</acronym> for which the <acronym>DTD</acronym> and/or processing tools are
not generally available, and the machine-generated <acronym>HTML</acronym>,
PostScript or <acronym>PDF</acronym> produced by some word processors for
output purposes only.
</para>
<para>The “Title Page” means, for a printed book, the title page itself,
plus such following pages as are needed to hold, legibly, the material
this License requires to appear in the title page. For works in
formats which do not have any title page as such, “Title Page” means
the text near the most prominent appearance of the work’s title,
preceding the beginning of the body of the text.
</para>
<para>The “publisher” means any person or entity that distributes copies
of the Document to the public.
</para>
<para>A section “Entitled XYZ” means a named subunit of the Document whose
title either is precisely XYZ or contains XYZ in parentheses following
text that translates XYZ in another language. (Here XYZ stands for a
specific section name mentioned below, such as “Acknowledgements”,
“Dedications”, “Endorsements”, or “History”.) To “Preserve the Title”
of such a section when you modify the Document means that it remains a
section “Entitled XYZ” according to this definition.
</para>
<para>The Document may include Warranty Disclaimers next to the notice which
states that this License applies to the Document. These Warranty
Disclaimers are considered to be included by reference in this
License, but only as regards disclaiming warranties: any other
implication that these Warranty Disclaimers may have is void and has
no effect on the meaning of this License.
</para>
</listitem><listitem><para>VERBATIM COPYING
</para>
<para>You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the
copyright notices, and the license notice saying this License applies
to the Document are reproduced in all copies, and that you add no other
conditions whatsoever to those of this License. You may not use
technical measures to obstruct or control the reading or further
copying of the copies you make or distribute. However, you may accept
compensation in exchange for copies. If you distribute a large enough
number of copies you must also follow the conditions in section 3.
</para>
<para>You may also lend copies, under the same conditions stated above, and
you may publicly display copies.
</para>
</listitem><listitem><para>COPYING IN QUANTITY
</para>
<para>If you publish printed copies (or copies in media that commonly have
printed covers) of the Document, numbering more than 100, and the
Document’s license notice requires Cover Texts, you must enclose the
copies in covers that carry, clearly and legibly, all these Cover
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover. Both covers must also clearly and legibly identify
you as the publisher of these copies. The front cover must present
the full title with all words of the title equally prominent and
visible. You may add other material on the covers in addition.
Copying with changes limited to the covers, as long as they preserve
the title of the Document and satisfy these conditions, can be treated
as verbatim copying in other respects.
</para>
<para>If the required texts for either cover are too voluminous to fit
legibly, you should put the first ones listed (as many as fit
reasonably) on the actual cover, and continue the rest onto adjacent
pages.
</para>
<para>If you publish or distribute Opaque copies of the Document numbering
more than 100, you must either include a machine-readable Transparent
copy along with each Opaque copy, or state in or with each Opaque copy
a computer-network location from which the general network-using
public has access to download using public-standard network protocols
a complete Transparent copy of the Document, free of added material.
If you use the latter option, you must take reasonably prudent steps,
when you begin distribution of Opaque copies in quantity, to ensure
that this Transparent copy will remain thus accessible at the stated
location until at least one year after the last time you distribute an
Opaque copy (directly or through your agents or retailers) of that
edition to the public.
</para>
<para>It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to give
them a chance to provide you with an updated version of the Document.
</para>
</listitem><listitem><para>MODIFICATIONS
</para>
<para>You may copy and distribute a Modified Version of the Document under
the conditions of sections 2 and 3 above, provided that you release
the Modified Version under precisely this License, with the Modified
Version filling the role of the Document, thus licensing distribution
and modification of the Modified Version to whoever possesses a copy
of it. In addition, you must do these things in the Modified Version:
</para>
<orderedlist numeration="upperalpha"><listitem><para>Use in the Title Page (and on the covers, if any) a title distinct
from that of the Document, and from those of previous versions
(which should, if there were any, be listed in the History section
of the Document). You may use the same title as a previous version
if the original publisher of that version gives permission.
</para>
</listitem><listitem><para>List on the Title Page, as authors, one or more persons or entities
responsible for authorship of the modifications in the Modified
Version, together with at least five of the principal authors of the
Document (all of its principal authors, if it has fewer than five),
unless they release you from this requirement.
</para>
</listitem><listitem><para>State on the Title page the name of the publisher of the
Modified Version, as the publisher.
</para>
</listitem><listitem><para>Preserve all the copyright notices of the Document.
</para>
</listitem><listitem><para>Add an appropriate copyright notice for your modifications
adjacent to the other copyright notices.
</para>
</listitem><listitem><para>Include, immediately after the copyright notices, a license notice
giving the public permission to use the Modified Version under the
terms of this License, in the form shown in the Addendum below.
</para>
</listitem><listitem><para>Preserve in that license notice the full lists of Invariant Sections
and required Cover Texts given in the Document’s license notice.
</para>
</listitem><listitem><para>Include an unaltered copy of this License.
</para>
</listitem><listitem><para>Preserve the section Entitled “History”, Preserve its Title, and add
to it an item stating at least the title, year, new authors, and
publisher of the Modified Version as given on the Title Page. If
there is no section Entitled “History” in the Document, create one
stating the title, year, authors, and publisher of the Document as
given on its Title Page, then add an item describing the Modified
Version as stated in the previous sentence.
</para>
</listitem><listitem><para>Preserve the network location, if any, given in the Document for
public access to a Transparent copy of the Document, and likewise
the network locations given in the Document for previous versions
it was based on. These may be placed in the “History” section.
You may omit a network location for a work that was published at
least four years before the Document itself, or if the original
publisher of the version it refers to gives permission.
</para>
</listitem><listitem><para>For any section Entitled “Acknowledgements” or “Dedications”, Preserve
the Title of the section, and preserve in the section all the
substance and tone of each of the contributor acknowledgements and/or
dedications given therein.
</para>
</listitem><listitem><para>Preserve all the Invariant Sections of the Document,
unaltered in their text and in their titles. Section numbers
or the equivalent are not considered part of the section titles.
</para>
</listitem><listitem><para>Delete any section Entitled “Endorsements”. Such a section
may not be included in the Modified Version.
</para>
</listitem><listitem><para>Do not retitle any existing section to be Entitled “Endorsements” or
to conflict in title with any Invariant Section.
</para>
</listitem><listitem><para>Preserve any Warranty Disclaimers.
</para></listitem></orderedlist>
<para>If the Modified Version includes new front-matter sections or
appendices that qualify as Secondary Sections and contain no material
copied from the Document, you may at your option designate some or all
of these sections as invariant. To do this, add their titles to the
list of Invariant Sections in the Modified Version’s license notice.
These titles must be distinct from any other section titles.
</para>
<para>You may add a section Entitled “Endorsements”, provided it contains
nothing but endorsements of your Modified Version by various
parties—for example, statements of peer review or that the text has
been approved by an organization as the authoritative definition of a
standard.
</para>
<para>You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list
of Cover Texts in the Modified Version. Only one passage of
Front-Cover Text and one of Back-Cover Text may be added by (or
through arrangements made by) any one entity. If the Document already
includes a cover text for the same cover, previously added by you or
by arrangement made by the same entity you are acting on behalf of,
you may not add another; but you may replace the old one, on explicit
permission from the previous publisher that added the old one.
</para>
<para>The author(s) and publisher(s) of the Document do not by this License
give permission to use their names for publicity for or to assert or
imply endorsement of any Modified Version.
</para>
</listitem><listitem><para>COMBINING DOCUMENTS
</para>
<para>You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified
versions, provided that you include in the combination all of the
Invariant Sections of all of the original documents, unmodified, and
list them all as Invariant Sections of your combined work in its
license notice, and that you preserve all their Warranty Disclaimers.
</para>
<para>The combined work need only contain one copy of this License, and
multiple identical Invariant Sections may be replaced with a single
copy. If there are multiple Invariant Sections with the same name but
different contents, make the title of each such section unique by
adding at the end of it, in parentheses, the name of the original
author or publisher of that section if known, or else a unique number.
Make the same adjustment to the section titles in the list of
Invariant Sections in the license notice of the combined work.
</para>
<para>In the combination, you must combine any sections Entitled “History”
in the various original documents, forming one section Entitled
“History”; likewise combine any sections Entitled “Acknowledgements”,
and any sections Entitled “Dedications”. You must delete all
sections Entitled “Endorsements.”
</para>
</listitem><listitem><para>COLLECTIONS OF DOCUMENTS
</para>
<para>You may make a collection consisting of the Document and other documents
released under this License, and replace the individual copies of this
License in the various documents with a single copy that is included in
the collection, provided that you follow the rules of this License for
verbatim copying of each of the documents in all other respects.
</para>
<para>You may extract a single document from such a collection, and distribute
it individually under this License, provided you insert a copy of this
License into the extracted document, and follow this License in all
other respects regarding verbatim copying of that document.
</para>
</listitem><listitem><para>AGGREGATION WITH INDEPENDENT WORKS
</para>
<para>A compilation of the Document or its derivatives with other separate
and independent documents or works, in or on a volume of a storage or
distribution medium, is called an “aggregate” if the copyright
resulting from the compilation is not used to limit the legal rights
of the compilation’s users beyond what the individual works permit.
When the Document is included in an aggregate, this License does not
apply to the other works in the aggregate which are not themselves
derivative works of the Document.
</para>
<para>If the Cover Text requirement of section 3 is applicable to these
copies of the Document, then if the Document is less than one half of
the entire aggregate, the Document’s Cover Texts may be placed on
covers that bracket the Document within the aggregate, or the
electronic equivalent of covers if the Document is in electronic form.
Otherwise they must appear on printed covers that bracket the whole
aggregate.
</para>
</listitem><listitem><para>TRANSLATION
</para>
<para>Translation is considered a kind of modification, so you may
distribute translations of the Document under the terms of section 4.
Replacing Invariant Sections with translations requires special
permission from their copyright holders, but you may include
translations of some or all Invariant Sections in addition to the
original versions of these Invariant Sections. You may include a
translation of this License, and all the license notices in the
Document, and any Warranty Disclaimers, provided that you also include
the original English version of this License and the original versions
of those notices and disclaimers. In case of a disagreement between
the translation and the original version of this License or a notice
or disclaimer, the original version will prevail.
</para>
<para>If a section in the Document is Entitled “Acknowledgements”,
“Dedications”, or “History”, the requirement (section 4) to Preserve
its Title (section 1) will typically require changing the actual
title.
</para>
</listitem><listitem><para>TERMINATION
</para>
<para>You may not copy, modify, sublicense, or distribute the Document
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense, or distribute it is void, and
will automatically terminate your rights under this License.
</para>
<para>However, if you cease all violation of this License, then your license
from a particular copyright holder is reinstated (a) provisionally,
unless and until the copyright holder explicitly and finally
terminates your license, and (b) permanently, if the copyright holder
fails to notify you of the violation by some reasonable means prior to
60 days after the cessation.
</para>
<para>Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
</para>
<para>Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, receipt of a copy of some or all of the same material does
not give you any rights to use it.
</para>
</listitem><listitem><para>FUTURE REVISIONS OF THIS LICENSE
</para>
<para>The Free Software Foundation may publish new, revised versions
of the GNU Free Documentation License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns. See
<ulink url="http://www.gnu.org/copyleft/">http://www.gnu.org/copyleft/</ulink>.
</para>
<para>Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this
License “or any later version” applies to it, you have the option of
following the terms and conditions either of that specified version or
of any later version that has been published (not as a draft) by the
Free Software Foundation. If the Document does not specify a version
number of this License, you may choose any version ever published (not
as a draft) by the Free Software Foundation. If the Document
specifies that a proxy can decide which future versions of this
License can be used, that proxy’s public statement of acceptance of a
version permanently authorizes you to choose that version for the
Document.
</para>
</listitem><listitem><para>RELICENSING
</para>
<para>“Massive Multiauthor Collaboration Site” (or “MMC Site”) means any
World Wide Web server that publishes copyrightable works and also
provides prominent facilities for anybody to edit those works. A
public wiki that anybody can edit is an example of such a server. A
“Massive Multiauthor Collaboration” (or “MMC”) contained in the
site means any set of copyrightable works thus published on the MMC
site.
</para>
<para>“CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0
license published by Creative Commons Corporation, a not-for-profit
corporation with a principal place of business in San Francisco,
California, as well as future copyleft versions of that license
published by that same organization.
</para>
<para>“Incorporate” means to publish or republish a Document, in whole or
in part, as part of another Document.
</para>
<para>An MMC is “eligible for relicensing” if it is licensed under this
License, and if all works that were first published under this License
somewhere other than this MMC, and subsequently incorporated in whole
or in part into the MMC, (1) had no cover texts or invariant sections,
and (2) were thus incorporated prior to November 1, 2008.
</para>
<para>The operator of an MMC Site may republish an MMC contained in the site
under CC-BY-SA on the same site at any time before August 1, 2009,
provided the MMC is eligible for relicensing.
</para>
</listitem></orderedlist>
<bridgehead renderas="sect1">ADDENDUM: How to use this License for your documents</bridgehead>
<para>To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and
license notices just after the title page:
</para>
<screen> Copyright (C) <replaceable>year</replaceable> <replaceable>your name</replaceable>.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
Texts. A copy of the license is included in the section entitled ``GNU
Free Documentation License''.
</screen>
<para>If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
replace the “with…Texts.” line with this:
</para>
<screen> with the Invariant Sections being <replaceable>list their titles</replaceable>, with
the Front-Cover Texts being <replaceable>list</replaceable>, and with the Back-Cover Texts
being <replaceable>list</replaceable>.
</screen>
<para>If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.
</para>
<para>If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License,
to permit their use in free software.
</para>
<!-- Local Variables: -->
<!-- ispell-local-pdict: "ispell-dict" -->
<!-- End: -->
</appendix>
</book>
|