add get sorted pattern statistic function