This post was updated on .
I have a table of areas with data. For a particular operation, I want to exclude the top and bottom 1% of areas, as they include extreme outliers.
Seems to me that a way forward is:
SORT CASES BY theVariableIwantToAnalyse (A) . NUMERIC id (F12.0) . * create a casenum label "id" COMPUTE id = $CASENUM. * populate it with casenum EXECUTE.
NUMERIC idmax (F12.4) . * create a variable to contain the highest value for "id" NUMERIC id1perc (F12.4) . * create a variable to contain 1% of the highest value for "id"
COMPUTE idmax = MAX(id) . * determine the highest value for id. This 'mock-syntax' line does not work. COMPUTE id1perc = idmax / 100 . * 1% of the highest value for "id"
SELECT CASES WHERE ID >= id1perc or ID <= idmax - id1perc . Draw graphs etc.
... and yes that is SPSS 12 - ten years and ten versions out of date ...
Bruce Mitchell MA MSc
ONS Geography | Office for National Statistics | PO15 5RR | UK
bruce.mitchell@ons.gsi.gov.uk | +44(0) 1329 444455
|
Administrator
|
You are going about this completely wrong!
COMPUTE ...MAX() operates within a case, NOT an entire column. See RANK to achieve this task! (NTILES or PERCENT will be useful). ----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
In reply to this post by fosh90
In addition to David's advice, I could not tell if RANK was available for V12 (I presume it was), but you could also get the max and min id within an area using AGGREGATE. I might also suggest instead of throwing away data to winsorize the data, see http://en.wikipedia.org/wiki/Winsorising.
At least for graphs that should be sufficient, for other statistical procedures you have a whole lot of options (weighting, other robust stats. etc.). |
Administrator
|
RANK is as old as Nick!
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
In reply to this post by Andy W
Andy and Dave. Thank you. I did get it to work using RANK.
Bruce Mitchell MA MSc
ONS Geography | Office for National Statistics | PO15 5RR | UK
bruce.mitchell@ons.gsi.gov.uk | +44(0) 1329 444455
|
Free forum by Nabble | Edit this page |