* ======================================================================= * File: median_across_columns.txt . * Date: 26-May-2004 . * Author: Bruce Weaver, weaverb@mcmaster.ca . * Notes: Show how to get median across columns. * ======================================================================= . * SPSS does not have a function for computing the median across columns. * One work-around solution is to restructure the file from WIDE to LONG, * then use the MEDIAN function available under AGGREGATE. This method * is demonstrated below. * Restructuring of the data file is done using VARSTOCASES. * If you are using an earlier version of SPSS that does not have * VARSTOCASES, then you will have to restructure the file the old- * fashioned way, as shown in this file: * http://www.angelfire.com/wv/bwhomedir/spss/restructure_old.txt . * Read in some data . data list list / id v1 to v5 (6f1.0). begin data. 1 1 1 1 4 3 2 2 2 3 5 1 3 2 2 3 1 1 4 1 3 3 3 5 end data. VARSTOCASES /MAKE score FROM v1 to v5 /INDEX = index(5) /KEEP = id /NULL = drop. aggregate outfile = * /presorted /break = id /median = median(score). list. * Use MATCH FILES to merge with the original data file if necessary. * End of job. * ======================================================================= .