Dear Statalist, I am wondering if it is possible to know automatically the value for the 5 minus the highest and 5 plus the lowest values on a variable. As you can see at the end, I can do this with the fre table, when the values I am interested are -.1490809 and .0326344 respectively. I need those values to list several other variables only for those range of values
Code:
list c1 x1 if (c1<=-.1490809  | c1>=.0326344)
However, these values will be changing. I was trying with the "tab" command to use the position in the matrix, but this can only be done for the first 5 values, but not for the last 5 values since the values (depending on the conditioning) will change and could report 20 or 200 different values. And unfortunately, the tab, sort option only sort for frequencies and not for values.
Is there any way to keep the specific values I need (similar to a local macro) to use it in the "list" command?

Thanks in advance.

Code:
 xttab c1 if year==2010 & c2==1

                  Overall             Between            Within
       c1 |    Freq.  Percent      Freq.  Percent        Percent
----------+-----------------------------------------------------
 -.299033 |       1      6.25         1      7.14         100.00
 -.261712 |       1      6.25         1      7.14         100.00
-.1875746 |       1      6.25         1      7.14         100.00
-.1848576 |       1      6.25         1      7.14         100.00
-.1490809 |       1      6.25         1      7.14         100.00
-.1248866 |       1      6.25         1      7.14          33.33
-.1118712 |       1      6.25         1      7.14         100.00
-.0203138 |       2     12.50         2     14.29         100.00
 .0326344 |       2     12.50         1      7.14          66.67
  .040889 |       1      6.25         1      7.14         100.00
 .0757612 |       2     12.50         2     14.29         100.00
 .1047588 |       1      6.25         1      7.14         100.00
 1.237074 |       1      6.25         1      7.14         100.00
----------+-----------------------------------------------------
    Total |      16    100.00        15    107.14          93.33
                                (n = 14)

. di r(results)[5,1]
-.14908086
Code:
---------------------------------------------------------------
                  |      Freq.    Percent      Valid       Cum.
------------------+--------------------------------------------
Valid   -.299033  |          1       4.00       6.25       6.25
        -.261712  |          1       4.00       6.25      12.50
        -.1875746 |          1       4.00       6.25      18.75
        -.1848576 |          1       4.00       6.25      25.00
        -.1490809 |          1       4.00       6.25      31.25
        :         |          :          :          :          :
        .0326344  |          2       8.00      12.50      68.75
        .040889   |          1       4.00       6.25      75.00
        .0757612  |          2       8.00      12.50      87.50
        .1047588  |          1       4.00       6.25      93.75
        1.237074  |          1       4.00       6.25     100.00
        Total     |         16      64.00     100.00           
Missing .         |          9      36.00                      
Total             |         25     100.00                      
---------------------------------------------------------------