With() function is similar to DATA in SAS, it apply an expression to a dataset.
BY() function applies a function to each level of factors. It is similar to BY processing in SAS.