Fix SORT .. BY pattern syntax error

Addresses a syntax error when using "By" option of Sort.