title: SPSS - How to isolate the maximum value in a variable so you can use it in syntax?
body: <p>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. </p>
  
  <p>Seems to me that a way forward is:</p>
  
  <pre><code>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 &gt;= id1perc or ID &lt;= idmax - id1perc .
  </code></pre>
  
  <p>Draw graphs etc. I then need to  </p>
  
  <pre><code>SORT CASES BY theNextVariableIwantToAnalyse  (A) .
  COMPUTE id = $CASENUM. * populate it with the NEW casenum order
  EXECUTE.
  </code></pre>
  
  <p>etc ...</p>