Hi,
I am using mata in Stata 12. I have a matrix, say 10x10, and I want to have a value of '1' for the five smallest values for each row in the matrix and '0' otherwise. In a similar post in the past (http://www.stata.com/statalist/archi.../msg00418.html) there is a code to assign a value of '1' for the smallest value of a row, but I couldn't figure out how to do this if I want it to be for the five smallest numbers. Any help will be greatly appreciated. Thanks!
I am using mata in Stata 12. I have a matrix, say 10x10, and I want to have a value of '1' for the five smallest values for each row in the matrix and '0' otherwise. In a similar post in the past (http://www.stata.com/statalist/archi.../msg00418.html) there is a code to assign a value of '1' for the smallest value of a row, but I couldn't figure out how to do this if I want it to be for the five smallest numbers. Any help will be greatly appreciated. Thanks!
Comment