I understand data confidentiality. I'm working for a NSO In a division for Census Operations. It always increases the challenge to both provide and receive help for complex issues. I'm still not entirely sure what you want of an output with regards to each code/groups of codes/all codes as a single unit. But I'll try to throw out a few different alternatives using where conditioning and by grouping. proc tabulate; class code date; format date monyy7.; where substr(code, -1, 3) = "SME" and month(date) in (6, 7, 😎 and year(date) = 2013; tables (n='# of codes'*f=f6.0), (date); run; Would give you a count, for the last 3 month, by month, of all SME codes. If the digits of your code each have a representation (e.g. most of our IDs comprise a 2 digit code for province here so I could subset on input(substr(code, 6, 2), best32.) between 25 and 30 The idea with this is to use the where statement to shrink the data set that is actually used to calculate the statistics (here only N) desired through tabulate. Alternatively, if you wanted one small table per code instead of the giant table with each different code as row like in post#3, you could've simply used proc tabulate; class date; format date monyy7.; by code; tables (n='# of codes'*f=f6.0), (date); run; I don't know if I'm stating the obvious here or giving at least some insights but anyway. For so long as you don't need to achieve calculations over rows or columns produced by the tables statement that cannot be achieved through the proc's available Statistics, there's definitely a way to get the output you desire. Since you seem to be looking merely for the total count of a subset of data for 3 months, using where statement to simply condition the data used to calculate statistics and produce the table seems to be the way to go. You could further make it a macro taking an input of the reference month and output the results for 3 month span ending on the inputed month for example.
... View more