nested_freq function

Generate nested count/percent for two or three levels