I'm trying to create a report that bins my variable into groups (say quartiles) and then find the mean for the variable in the bin. When I use a format in proc summary, the format applies to both the binned value(class variable) and the analytical variable.
See the below code as an example with the problem that I am having. Using the SASHELP tables, the output data set has the class variable, mean and std all formated with the quartilefmt. Is there a way to only apply the format to the class variable, so I can see the mean and std with no formatting?
I had the same problem and to solve it created a copy of inventory variable, applied format to it and used as a class variable:
proc summary data=i nway;
format inv quartilefmt.;
output out=inventory_by_quartiles mean=mean std=std;
I should also notice that without NWAY option you will get total mean and std that could be useful.
Using a DATA Step view (data i / view = i) will avoid making a copy of the original data set which could be important if it is large. The new column will exist only in memory for single pass processing.