Finding the second smallest value
问题 For every observation, I want to get the second smallest value of the last five observations of a variable. Do you know which command I have to use? * Example generated by -dataex-. To install: ssc install dataex clear input str5 var1 str26 var2 "Value" "2nd smallest of previous 5" "8" "" "0" "" "4" "" "5" "" "0" "" "6" "0" "8" "0" "10" "4" "8" "5" "8" "6" end 回答1: Original problem: 2nd of last 5 Another way to do it is that the 2nd lowest out of 5 will be returned as the lower quartile: .