loops closer to crosstable ks test
sample nest loops generate error