}
}
- if (frq.stats & FRQ_ST_MEDIAN)
+ if (frq.stats & BIT_INDEX (FRQ_ST_MEDIAN))
{
frq.percentiles =
xrealloc (frq.percentiles,
}
calc_stats (vf, stat_value);
- t = tab_create (3, ((frq->stats & FRQ_ST_MEDIAN) ? frq->n_stats - 1 : frq->n_stats)
+ t = tab_create (3, ((frq->stats & BIT_INDEX (FRQ_ST_MEDIAN)) ? frq->n_stats - 1 : frq->n_stats)
+ frq->n_show_percentiles + 2);
tab_set_format (t, RC_WEIGHT, wfmt);
tab_box (t, TAL_1, TAL_1, -1, -1 , 0 , 0 , 2, tab_nr(t) - 1) ;
AT_CHECK([pspp frequencies.sps], [0], [ignore])
AT_CLEANUP
+
+
+AT_SETUP([FREQUENCIES median])
+AT_DATA([median.sps], [dnl
+data list notable list /x *.
+begin data.
+1
+2
+3000000
+end data.
+
+FREQUENCIES
+ /VARIABLES = x
+ /STATISTICS = MEDIAN
+ .
+])
+
+AT_CHECK([pspp median.sps -O format=csv], [0], [dnl
+Table: x
+Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
+,1.00,1,33.33,33.33,33.33
+,2.00,1,33.33,33.33,66.67
+,3000000.00,1,33.33,33.33,100.00
+Total,,3,100.0,100.0,
+
+Table: x
+N,Valid,3
+,Missing,0
+Percentiles,50 (Median),2.00
+])
+AT_CLEANUP