I am using asrol (downloaded from the ssc). Is there a way to find second highest value or the second maximum in a rolling window.
-
Login or Register
- Log in with
* Install the beta version from my site net install asrol, from(http://fintechprofessor.com) replace
*1. By groups webuse grunfeld bys company: asrol invest, stat(max2) *2. Rolling window in groups bys company: asrol invest, stat(max2) window(year 10) list company year invest invest_max210 in 1/20 +-------------------------------------+ | company year invest inves~210 | |-------------------------------------| 1. | 1 1935 317.6 . | 2. | 1 1936 391.8 317.60001 | 3. | 1 1937 410.6 391.79999 | 4. | 1 1938 257.7 410.60001 | 5. | 1 1939 330.8 257.70001 | |-------------------------------------| 6. | 1 1940 461.2 330.79999 | 7. | 1 1941 512 461.20001 | 8. | 1 1942 448 512 | 9. | 1 1943 499.6 448 | 10. | 1 1944 547.5 499.60001 | |-------------------------------------| 11. | 1 1945 561.2 547.5 | 12. | 1 1946 688.1 561.20001 | 13. | 1 1947 568.9 688.09998 | 14. | 1 1948 529.2 568.90002 | 15. | 1 1949 555.1 529.20001 | |-------------------------------------| 16. | 1 1950 642.9 555.09998 | 17. | 1 1951 755.9 642.90002 | 18. | 1 1952 891.2 755.90002 | 19. | 1 1953 1304.4 891.20001 | 20. | 1 1954 1486.7 1304.4 | +-------------------------------------+
Comment