* Example generated by -dataex-. For more info, type help dataex
clear
input str20 id int month_stata double collection_not_infl_adj
"1442106-1106000046" 757 0
"1442106-1106000046" 758 0
"1442106-1106000046" 759 0
"1442106-1106000046" 760 700
"1442106-1106000046" 761 0
"1442106-1106000046" 762 0
"1442106-1106000046" 763 0
"1442106-1106000046" 764 0
"1442106-1106000046" 765 105
"1442106-1106000046" 766 0
"1442106-1106000047" 757 95
"1442106-1106000047" 758 95
"1442106-1106000047" 759 95
"1442106-1106000047" 760 95
"1442106-1106000047" 761 294
"1442106-1106000047" 762 333
"1442106-1106000047" 763 205
"1442106-1106000047" 764 0
"1442106-1106000047" 765 521
end
format %tm month_stata
I have a panel dataset which includes consumer id, month and collection. I have been struggling to find a way to generate a variable that will give me a sense of the payment cycle for consumers.
E.g. id" 1442106-1106000046" makes the first non zero payment in month "760". The next non zero payment is made in month "765". This tells me that the consumer is paying once every 5 months.
But, in the case of id "1442106-1106000047", the consumer pays every month apart from month "764".
I have been essentially trying to get one number that associates the payment pattern of a consumer

Any ideas as to how this can be achieved?
Comment