Hi everyone,

I have three variables of my interest for my microdata: consumer IDs, month, card type. I would like to calculate some summary statistics. In particular, first I want to find number of observations per month. This is the code to realize this:
gen count=1
collapse (sum) count, by(txn_yrmon)

Second, I want to find the number of consumers per month. So basically I want to find the number of unique consumer IDs in each month. Third, I want to find the number of consumers per month by card type.

I'm still learning how to approach this process. Could you please help me on last two questions? Thanks in advance!