<?xml version="1.0" encoding="utf-8"?><!DOCTYPE article  PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'  'http://www.docbook.org/xml/4.4/docbookx.dtd'><article><articleinfo><title>FAQ/kw/means</title><revhistory><revision><revnumber>5</revnumber><date>2013-03-08 10:17:26</date><authorinitials>localhost</authorinitials><revremark>converted to 1.6 markup</revremark></revision><revision><revnumber>4</revnumber><date>2006-08-15 15:51:06</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>3</revnumber><date>2006-08-15 15:45:57</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>2</revnumber><date>2006-08-15 15:40:21</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>1</revnumber><date>2006-08-15 15:38:57</date><authorinitials>PeterWatson</authorinitials></revision></revhistory></articleinfo><para>The SPSS syntax below computes the raw score means with given mean rank (as outputted by !kwpairs). This may be a more intuitive way of expressing the locations of each group. Run immediately after running !kwpairs as the macro assumes the data has been backed up in a file called input.sav which is created by running !kwpairs. </para><para>[COPY AND PASTE BELOW SYNTAX INTO A SPSS SYNTAX WINDOW; SELECT ALL AND RUN; EDIT LAST TWO LINES TO SUBSTITUTE OBSERVED MEAN RANKS] </para><screen><![CDATA[* input a column of scores (y) and group
* run immediately after using !kwpairs macro
* using the outputted mean ranks as input in
* bottom line below; 
* BACKUP DATA BEFORE RUNNING THIS MACRO
*
* outputs in file called output.sav (located in
* My Documents folder) and in output window
* the raw data value in original data with
* corresponding mean rank obtained by
* interpolation
]]><![CDATA[
set errors=none.
set mprint=off.
]]><![CDATA[
DEFINE RMEAN (!POS !TOKENS(1)).
]]><![CDATA[
get file=input.sav.
]]><![CDATA[
COMPUTE MR=!1.
]]><![CDATA[
RANK
  VARIABLES=y  (A)   /RANK /PRINT=YES
  /TIES=MEAN .
exe.
]]><![CDATA[
SORT CASES BY RY(A).
]]><![CDATA[
IF (MR GT RY) LR=MIN(ABS(MR-RY)).
IF (MR LT RY) UR=MIN(ABS(MR-RY)).
EXE.
]]><![CDATA[
IF (LR GT 0) IND=1.
IF (UR GT 0) IND=2.
EXE.
]]><![CDATA[
aggregate outfile=* 
 /break=IND
 /LRY LY=MAX(RY Y)
 /URY UY=MIN(RY Y).
]]><![CDATA[
IF (IND EQ 1) LRYY=LRY.
IF (IND EQ 1) LYY=LY.
IF (IND EQ 2) URYY=URY.
IF (IND EQ 2) UYY=UY.
EXE.
]]><![CDATA[
COMPUTE dummy=1.
EXE.
]]><![CDATA[
aggregate outfile=* 
 /break=dummy
 /RY1 Y1 RY2 Y2=FIRST(LRYY LYY URYY UYY).
]]><![CDATA[
COMPUTE MR=!1.
COMPUTE RMN=Y1 + (Y2-Y1) * (MR-RY1) / (RY2-RY1).
EXE.
]]><![CDATA[
aggregate outfile=* 
 /break=dummy
 /LY=FIRST(RMN).
]]><![CDATA[
save outfile=output.sav /keep = LY.
exe.
]]><![CDATA[
GET FILE=OUTPUT.SAV.
]]><![CDATA[
compute mr=!1.
]]><![CDATA[
formats all (f11.8).
variable labels mr 'Mean Rank' /ly 'Raw mean' .
]]><![CDATA[
report format=list automatic align(center)
  /variables=mr ly
  /title "Raw score mean obtained by interpolation having given mean rank".
         
!ENDDEFINE.
]]><![CDATA[
* input a single group mean rank as outputted
* by !kwpairs macro: 
* macro outputs raw data value in original data
* with inputted corresponding mean rank
]]><![CDATA[
* substitute the two outputted mean ranks
* for 8.5 and 8.0714 given below
]]><![CDATA[
RMEAN 8.5.
RMEAN 8.0714.]]></screen></article>