AT_BANNER([CTABLES]) # AT_SETUP([CTABLES parsing]) # AT_DATA([ctables.sps], # [[DATA LIST LIST NOTABLE /x y z. # CTABLES /TABLE=(x + y) > z. # CTABLES /TABLE=(x[c] + y[c]) > z. # CTABLES /TABLE=(x + y) > z[c]. # CTABLES /TABLE=x BY y BY z. # CTABLES /TABLE=x[c] [ROWPCT.COUNT] > y[c]. # CTABLES /TABLE=x[c] > y[c] [ROWPCT.COUNT]. # ]]) # AT_CHECK([pspp ctables.sps]) # AT_CLEANUP AT_SETUP([CTABLES one categorical variable]) AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .]) AT_DATA([ctables.sps], [[GET 'nhtsa.sav'. CTABLES /TABLE qn1. CTABLES /TABLE BY qn1. CTABLES /TABLE BY BY qn1. ]]) AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl 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 ╭──────────────────────────────────────────────────────────────────────────────╮ │ 1. How often do you usually drive a car or other motor vehicle? │ ├─────────┬──────────────────┬──────────────────┬────────────────────────┬─────┤ │ │ Several days a │ Once a week or │ Only certain times a │ │ │Every day│ week │ less │ year │Never│ ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤ │ Count │ Count │ Count │ Count │Count│ ├─────────┼──────────────────┼──────────────────┼────────────────────────┼─────┤ │ 4667│ 1274│ 361│ 130│ 540│ ╰─────────┴──────────────────┴──────────────────┴────────────────────────┴─────╯ Custom Tables Every day ╭─────╮ │Count│ ├─────┤ │ 4667│ ╰─────╯ ]) AT_CLEANUP AT_SETUP([CTABLES one scale variable]) AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .]) AT_DATA([ctables.sps], [[GET 'nhtsa.sav'. CTABLES /TABLE qnd1[COUNT, MEAN, STDDEV, MINIMUM, MAXIMUM]. CTABLES /TABLE BY qnd1. CTABLES /TABLE BY BY qnd1. ]]) AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl Custom Tables ╭──────────────────────────┬─────┬────┬─────────────┬───────┬───────╮ │ │Count│Mean│Std Deviation│Minimum│Maximum│ ├──────────────────────────┼─────┼────┼─────────────┼───────┼───────┤ │D1. AGE: What is your age?│ 6930│ 48│ 19│ 16│ 86│ ╰──────────────────────────┴─────┴────┴─────────────┴───────┴───────╯ Custom Tables ╭──────────────────────────╮ │D1. AGE: What is your age?│ ├──────────────────────────┤ │ Mean │ ├──────────────────────────┤ │ 48│ ╰──────────────────────────╯ Custom Tables D1. AGE: What is your age? ╭────╮ │Mean│ ├────┤ │ 48│ ╰────╯ ]) AT_CLEANUP AT_SETUP([CTABLES simple stacking]) AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .]) AT_DATA([ctables.sps], [[GET 'nhtsa.sav'. CTABLES /TABLE qn105ba + qn105bb + qn105bc + qn105bd BY qns3a [COLPCT PCT8.0]. ]]) AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl Custom Tables ╭───────────────────────────────────────────────────────────────┬──────────────╮ │ │ S3a. GENDER: │ │ ├──────┬───────┤ │ │ Male │ Female│ │ ├──────┼───────┤ │ │Column│ Column│ │ │ % │ % │ ├───────────────────────────────────────────────────────────────┼──────┼───────┤ │105b. How likely is it that drivers who have had Almost │ 10%│ 11%│ │too much to drink to drive safely will A. Get certain │ │ │ │stopped by the police? Very likely │ 21%│ 22%│ │ Somewhat │ 38%│ 42%│ │ likely │ │ │ │ Somewhat │ 21%│ 18%│ │ unlikely │ │ │ │ Very │ 10%│ 8%│ │ unlikely │ │ │ ├───────────────────────────────────────────────────────────────┼──────┼───────┤ │105b. How likely is it that drivers who have had Almost │ 14%│ 18%│ │too much to drink to drive safely will B. Have an certain │ │ │ │accident? Very likely │ 36%│ 45%│ │ Somewhat │ 39%│ 32%│ │ likely │ │ │ │ Somewhat │ 9%│ 4%│ │ unlikely │ │ │ │ Very │ 3%│ 2%│ │ unlikely │ │ │ ├───────────────────────────────────────────────────────────────┼──────┼───────┤ │105b. How likely is it that drivers who have had Almost │ 18%│ 16%│ │too much to drink to drive safely will C. Be certain │ │ │ │convicted for drunk driving? Very likely │ 32%│ 28%│ │ Somewhat │ 27%│ 32%│ │ likely │ │ │ │ Somewhat │ 15%│ 15%│ │ unlikely │ │ │ │ Very │ 9%│ 9%│ │ unlikely │ │ │ ├───────────────────────────────────────────────────────────────┼──────┼───────┤ │105b. How likely is it that drivers who have had Almost │ 16%│ 16%│ │too much to drink to drive safely will D. Be certain │ │ │ │arrested for drunk driving? Very likely │ 26%│ 27%│ │ Somewhat │ 32%│ 35%│ │ likely │ │ │ │ Somewhat │ 17%│ 15%│ │ unlikely │ │ │ │ Very │ 9%│ 7%│ │ unlikely │ │ │ ╰───────────────────────────────────────────────────────────────┴──────┴───────╯ ]) AT_CLEANUP AT_SETUP([CTABLES simple nesting]) AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .]) AT_DATA([ctables.sps], [[GET 'nhtsa.sav'. CTABLES /TABLE (qn105ba + qn105bb + qn105bc + qn105bd) > qns3a [TABLEPCT PCT8.0] /CATEGORIES VARIABLES=qns3a TOTAL=NO. CTABLES /TABLE qns3a > (qn105ba + qn105bb + qn105bc + qn105bd) [TABLEPCT PCT8.0] /CATEGORIES VARIABLES=qns3a TOTAL=NO /CLABELS ROW=OPPOSITE. ]]) dnl XXX With TOTAL=YES above, the totals get included in the denominator so that dnl the percentages are about half of the correct values. AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl Custom Tables ╭───────────────────────────────────────────────────────────────────────┬──────╮ │ │ Table│ │ │ % │ ├───────────────────────────────────────────────────────────────────────┼──────┤ │105b. How likely is it that drivers who Almost S3a. Male │ 4%│ │have had too much to drink to drive safely certain GENDER: Female│ 6%│ │will A. Get stopped by the police? ╶───────────────────────────┼──────┤ │ Very likely S3a. Male │ 10%│ │ GENDER: Female│ 12%│ │ ╶───────────────────────────┼──────┤ │ Somewhat S3a. Male │ 17%│ │ likely GENDER: Female│ 23%│ │ ╶───────────────────────────┼──────┤ │ Somewhat S3a. Male │ 9%│ │ unlikely GENDER: Female│ 10%│ │ ╶───────────────────────────┼──────┤ │ Very S3a. Male │ 5%│ │ unlikely GENDER: Female│ 4%│ ├───────────────────────────────────────────────────────────────────────┼──────┤ │105b. How likely is it that drivers who Almost S3a. Male │ 6%│ │have had too much to drink to drive safely certain GENDER: Female│ 10%│ │will B. Have an accident? ╶───────────────────────────┼──────┤ │ Very likely S3a. Male │ 16%│ │ GENDER: Female│ 25%│ │ ╶───────────────────────────┼──────┤ │ Somewhat S3a. Male │ 17%│ │ likely GENDER: Female│ 18%│ │ ╶───────────────────────────┼──────┤ │ Somewhat S3a. Male │ 4%│ │ unlikely GENDER: Female│ 2%│ │ ╶───────────────────────────┼──────┤ │ Very S3a. Male │ 1%│ │ unlikely GENDER: Female│ 1%│ ├───────────────────────────────────────────────────────────────────────┼──────┤ │105b. How likely is it that drivers who Almost S3a. Male │ 8%│ │have had too much to drink to drive safely certain GENDER: Female│ 9%│ │will C. Be convicted for drunk driving? ╶───────────────────────────┼──────┤ │ Very likely S3a. Male │ 14%│ │ GENDER: Female│ 15%│ │ ╶───────────────────────────┼──────┤ │ Somewhat S3a. Male │ 12%│ │ likely GENDER: Female│ 18%│ │ ╶───────────────────────────┼──────┤ │ Somewhat S3a. Male │ 7%│ │ unlikely GENDER: Female│ 8%│ │ ╶───────────────────────────┼──────┤ │ Very S3a. Male │ 4%│ │ unlikely GENDER: Female│ 5%│ ├───────────────────────────────────────────────────────────────────────┼──────┤ │105b. How likely is it that drivers who Almost S3a. Male │ 7%│ │have had too much to drink to drive safely certain GENDER: Female│ 9%│ │will D. Be arrested for drunk driving? ╶───────────────────────────┼──────┤ │ Very likely S3a. Male │ 12%│ │ GENDER: Female│ 15%│ │ ╶───────────────────────────┼──────┤ │ Somewhat S3a. Male │ 14%│ │ likely GENDER: Female│ 19%│ │ ╶───────────────────────────┼──────┤ │ Somewhat S3a. Male │ 8%│ │ unlikely GENDER: Female│ 8%│ │ ╶───────────────────────────┼──────┤ │ Very S3a. Male │ 4%│ │ unlikely GENDER: Female│ 4%│ ╰───────────────────────────────────────────────────────────────────────┴──────╯ Custom Tables ╭─────────────────────────────────┬────────┬──────┬─────────┬─────────┬────────╮ │ │ Almost │ Very │ Somewhat│ Somewhat│ Very │ │ │ certain│likely│ likely │ unlikely│unlikely│ │ ├────────┼──────┼─────────┼─────────┼────────┤ │ │ │ Table│ │ │ │ │ │ Table %│ % │ Table % │ Table % │ Table %│ ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤ │S3a. Male 105b. How likely │ 4%│ 10%│ 17%│ 9%│ 5%│ │GENDER: is it that drivers│ │ │ │ │ │ │ who have had too │ │ │ │ │ │ │ much to drink to │ │ │ │ │ │ │ drive safely will │ │ │ │ │ │ │ A. Get stopped by │ │ │ │ │ │ │ the police? │ │ │ │ │ │ │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤ │ Female 105b. How likely │ 6%│ 12%│ 23%│ 10%│ 4%│ │ is it that drivers│ │ │ │ │ │ │ who have had too │ │ │ │ │ │ │ much to drink to │ │ │ │ │ │ │ drive safely will │ │ │ │ │ │ │ A. Get stopped by │ │ │ │ │ │ │ the police? │ │ │ │ │ │ ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤ │S3a. Male 105b. How likely │ 6%│ 16%│ 17%│ 4%│ 1%│ │GENDER: is it that drivers│ │ │ │ │ │ │ who have had too │ │ │ │ │ │ │ much to drink to │ │ │ │ │ │ │ drive safely will │ │ │ │ │ │ │ B. Have an │ │ │ │ │ │ │ accident? │ │ │ │ │ │ │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤ │ Female 105b. How likely │ 10%│ 25%│ 18%│ 2%│ 1%│ │ is it that drivers│ │ │ │ │ │ │ who have had too │ │ │ │ │ │ │ much to drink to │ │ │ │ │ │ │ drive safely will │ │ │ │ │ │ │ B. Have an │ │ │ │ │ │ │ accident? │ │ │ │ │ │ ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤ │S3a. Male 105b. How likely │ 8%│ 14%│ 12%│ 7%│ 4%│ │GENDER: is it that drivers│ │ │ │ │ │ │ who have had too │ │ │ │ │ │ │ much to drink to │ │ │ │ │ │ │ drive safely will │ │ │ │ │ │ │ C. Be convicted │ │ │ │ │ │ │ for drunk driving?│ │ │ │ │ │ │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤ │ Female 105b. How likely │ 9%│ 15%│ 18%│ 8%│ 5%│ │ is it that drivers│ │ │ │ │ │ │ who have had too │ │ │ │ │ │ │ much to drink to │ │ │ │ │ │ │ drive safely will │ │ │ │ │ │ │ C. Be convicted │ │ │ │ │ │ │ for drunk driving?│ │ │ │ │ │ ├─────────────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤ │S3a. Male 105b. How likely │ 7%│ 12%│ 14%│ 8%│ 4%│ │GENDER: is it that drivers│ │ │ │ │ │ │ who have had too │ │ │ │ │ │ │ much to drink to │ │ │ │ │ │ │ drive safely will │ │ │ │ │ │ │ D. Be arrested for│ │ │ │ │ │ │ drunk driving? │ │ │ │ │ │ │ ╶─────────────────────────┼────────┼──────┼─────────┼─────────┼────────┤ │ Female 105b. How likely │ 9%│ 15%│ 19%│ 8%│ 4%│ │ is it that drivers│ │ │ │ │ │ │ who have had too │ │ │ │ │ │ │ much to drink to │ │ │ │ │ │ │ drive safely will │ │ │ │ │ │ │ D. Be arrested for│ │ │ │ │ │ │ drunk driving? │ │ │ │ │ │ ╰─────────────────────────────────┴────────┴──────┴─────────┴─────────┴────────╯ ]) AT_CLEANUP AT_SETUP([CTABLES nesting and scale variables]) AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .]) AT_DATA([ctables.sps], [[GET 'nhtsa.sav'. CTABLES /TABLE=qnd1 > qn1 BY qns3a. CTABLES /TABLE=qnd1 [MINIMUM, MAXIMUM, MEAN] > qns3a > (qn26 + qn27). CTABLES /TABLE=qnsa1 > qn105ba [COLPCT] BY qns1. CTABLES /TABLE=AgeGroup > qn20 [MEAN F8.1, STDDEV F8.1]. ]]) AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl Custom Tables ╭─────────────────────────────────────────────────────────────────┬────────────╮ │ │S3a. GENDER:│ │ ├─────┬──────┤ │ │ Male│Female│ │ ├─────┼──────┤ │ │ Mean│ Mean │ ├─────────────────────────────────────────────────────────────────┼─────┼──────┤ │D1. AGE: What 1. How often do you usually drive Every day │ 46│ 46│ │is your age? a car or other motor vehicle? Several days a │ 51│ 59│ │ week │ │ │ │ Once a week or │ 44│ 54│ │ less │ │ │ │ Only certain │ 34│ 41│ │ times a year │ │ │ │ Never │ 39│ 55│ ╰─────────────────────────────────────────────────────────────────┴─────┴──────╯ Custom Tables ╭─────────────────────────────────────────────────────────┬───────┬───────┬────╮ │ │Minimum│Maximum│Mean│ ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤ │D1. AGE: S3a. Male 26. During the last 12 Yes│ 16│ 86│ 42│ │What is GENDER: months, has there been a │ │ │ │ │your time when you felt you │ │ │ │ │age? should cut down on your No │ 16│ 86│ 46│ │ drinking? │ │ │ │ │ ╶───────────────────────────────────────┼───────┼───────┼────┤ │ Female 26. During the last 12 Yes│ 16│ 86│ 43│ │ months, has there been a │ │ │ │ │ time when you felt you │ │ │ │ │ should cut down on your No │ 16│ 86│ 48│ │ drinking? │ │ │ │ ├─────────────────────────────────────────────────────────┼───────┼───────┼────┤ │D1. AGE: S3a. Male 27. During the last 12 Yes│ 16│ 86│ 38│ │What is GENDER: months, has there been a │ │ │ │ │your time when people criticized No │ 16│ 86│ 46│ │age? your drinking? │ │ │ │ │ ╶───────────────────────────────────────┼───────┼───────┼────┤ │ Female 27. During the last 12 Yes│ 17│ 69│ 37│ │ months, has there been a │ │ │ │ │ time when people criticized No │ 16│ 86│ 48│ │ your drinking? │ │ │ │ ╰─────────────────────────────────────────────────────────┴───────┴───────┴────╯ Custom Tables ╭──────────────────────────────────┬───────────────────────────────────────────╮ │ │S1. Including yourself, how many members of│ │ │ this household are age 16 or older? │ │ ├──────┬───────┬──────┬──────┬───────┬──────┤ │ │ │ │ │ │ │ 6 or │ │ │ 1 │ 2 │ 3 │ 4 │ 5 │ more │ │ ├──────┼───────┼──────┼──────┼───────┼──────┤ │ │Column│ Column│Column│Column│ Column│Column│ │ │ % │ % │ % │ % │ % │ % │ ├──────────────────────────────────┼──────┼───────┼──────┼──────┼───────┼──────┤ │Sa1. RDD 105b. How Almost │ 9.5%│ 8.2%│ 12.4%│ 9.9%│ 20.0%│ 23.8%│ │SAMPLE likely is it certain │ │ │ │ │ │ │ │SOURCE: that drivers Very │ 24.9%│ 18.5%│ 24.0%│ 26.6%│ 25.5%│ 33.3%│ │ who have had likely │ │ │ │ │ │ │ │ too much to Somewhat│ 38.3%│ 41.9%│ 38.6%│ 37.5%│ 36.4%│ 23.8%│ │ drink to likely │ │ │ │ │ │ │ │ drive safely Somewhat│ 18.1%│ 21.7%│ 16.8%│ 16.7%│ 10.9%│ 9.5%│ │ will A. Get unlikely│ │ │ │ │ │ │ │ stopped by Very │ 9.2%│ 9.7%│ 8.2%│ 9.4%│ 7.3%│ 9.5%│ │ the police? unlikely│ │ │ │ │ │ │ ╰──────────────────────────────────┴──────┴───────┴──────┴──────┴───────┴──────╯ Custom Tables ╭──────────────────────────────────────────────────────────────┬────┬──────────╮ │ │ │ Std │ │ │Mean│ Deviation│ ├──────────────────────────────────────────────────────────────┼────┼──────────┤ │Age 16 to 25 20. On how many of the thirty days in this │ 5.2│ 6.0│ │group typical month did you have one or more │ │ │ │ alcoholic beverages to drink? │ │ │ │ ╶───────────────────────────────────────────────────────┼────┼──────────┤ │ 26 to 35 20. On how many of the thirty days in this │ 4.7│ 5.9│ │ typical month did you have one or more │ │ │ │ alcoholic beverages to drink? │ │ │ │ ╶───────────────────────────────────────────────────────┼────┼──────────┤ │ 36 to 45 20. On how many of the thirty days in this │ 5.5│ 6.8│ │ typical month did you have one or more │ │ │ │ alcoholic beverages to drink? │ │ │ │ ╶───────────────────────────────────────────────────────┼────┼──────────┤ │ 46 to 55 20. On how many of the thirty days in this │ 5.8│ 7.7│ │ typical month did you have one or more │ │ │ │ alcoholic beverages to drink? │ │ │ │ ╶───────────────────────────────────────────────────────┼────┼──────────┤ │ 56 to 65 20. On how many of the thirty days in this │ 6.3│ 8.2│ │ typical month did you have one or more │ │ │ │ alcoholic beverages to drink? │ │ │ │ ╶───────────────────────────────────────────────────────┼────┼──────────┤ │ 66 or 20. On how many of the thirty days in this │ 7.1│ 9.2│ │ older typical month did you have one or more │ │ │ │ alcoholic beverages to drink? │ │ │ ╰──────────────────────────────────────────────────────────────┴────┴──────────╯ ]) AT_CLEANUP AT_SETUP([CTABLES SLABELS]) AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .]) AT_DATA([ctables.sps], [[GET 'nhtsa.sav'. CTABLES /TABLE qn1 [COUNT COLPCT]. CTABLES /TABLE qn1 [COUNT COLPCT] /SLABELS POSITION=ROW. CTABLES /TABLE qn1 [COUNT COLPCT] /SLABELS POSITION=ROW VISIBLE=NO. ]]) AT_CHECK([pspp ctables.sps -O box=unicode -O width=80], [0], [dnl Custom Tables ╭────────────────────────────────────────────────────────────────┬─────┬───────╮ │ │ │ Column│ │ │Count│ % │ ├────────────────────────────────────────────────────────────────┼─────┼───────┤ │ 1. How often do you usually drive a car or Every day │ 4667│ 66.9%│ │other motor vehicle? Several days a week│ 1274│ 18.3%│ │ Once a week or less│ 361│ 5.2%│ │ Only certain times │ 130│ 1.9%│ │ a year │ │ │ │ Never │ 540│ 7.7%│ ╰────────────────────────────────────────────────────────────────┴─────┴───────╯ Custom Tables ╭────────────────────────────────────────────────────────────────────────┬─────╮ │ 1. How often do you usually drive a car or Every day Count │ 4667│ │other motor vehicle? Column │66.9%│ │ % │ │ │ ╶───────────────────────────┼─────┤ │ Several days a week Count │ 1274│ │ Column │18.3%│ │ % │ │ │ ╶───────────────────────────┼─────┤ │ Once a week or less Count │ 361│ │ Column │ 5.2%│ │ % │ │ │ ╶───────────────────────────┼─────┤ │ Only certain times Count │ 130│ │ a year Column │ 1.9%│ │ % │ │ │ ╶───────────────────────────┼─────┤ │ Never Count │ 540│ │ Column │ 7.7%│ │ % │ │ ╰────────────────────────────────────────────────────────────────────────┴─────╯ Custom Tables ╭────────────────────────────────────────────────────────────────────────┬─────╮ │ 1. How often do you usually drive a car or other Every day │ 4667│ │motor vehicle? │66.9%│ │ Several days a week │ 1274│ │ │18.3%│ │ Once a week or less │ 361│ │ │ 5.2%│ │ Only certain times a │ 130│ │ year │ 1.9%│ │ Never │ 540│ │ │ 7.7%│ ╰────────────────────────────────────────────────────────────────────────┴─────╯ ]) AT_CLEANUP