Is it possible to force proc summary to include all possible combinations of variables in the where statement, even when those combinations don't appear in the dataset? I know that you can do this for the class statement. Maybe in conjunction with proc report?
Consider sharing sample INPUT and (desired) OUTPUT data represented - consider the WHERE statement is an input filter and the WHERE= (the dataset option) is an output-side filter. You're asking that combinations not meeting the WHERE statement filter criteria be included in the SUMMARY execution output -- plz help to explain this opportunity with your data-sample as an example of what you want to see.
year channel type numloans
1 A 1 100
2 B 1 5
3 C 1 23
4 A 2 7
5 B 2 10
proc summary data=loan_all missing completetypes;
class year channel /preloadfmt exclusive;
output out=test sum=;
format channel $channellbl.;
where type in ('1','2','3');
My output will have every permutation of year and channel for types 1 and 2, but not for 3 because type is not in the class statement and never appears in the data. How can I print 0 for numloans for every permutation of year and channel for type 3? I cannot create a temporary dataset with all 0s because the variables will change each time the program is run.
I'm not sure I understand what you are looking for. The following is based on the understanding that the data desribes the years and channels, but a where statement is the only thing that describes the desired 'types' you want to include.
If that is correct, then I'd suggest including the where statement as a macro variable and using it to build a file that contains all of the possible permutations.
value $ channellbl