@baystanil wrote:
Hello SAS Community,
By and class statement is applicable for character type data.
CLASS and BY variables can be variables of any type. Always. It is a good idea to use them with variables that make sense as categories.
It is very common to use date variables as CLASS variables because changing the format in the code will create different groups based on the formatted variable.
One of the advantages of CLASS variables is that SAS will do the sort when they are not sorted before the procedure. There is a processing time penalty and extremely large number of class variable/level combinations may exceed resources.
You might also consider a different procedure to generate the output since you apparently do not have a need for output data sets. Consider:
proc tabulate data=sashelp.shoes format=best10.;
class region product;
var sales;
table region,
sales
;
table product,
sales
;
run;
Proc tabulate will create the summaries using the formatted values of the class variables.
Caveat: Proc tabulate will by default discard any record with missing values for any of the class variables unless the option /missing is provided on the class statement.
... View more