Hello, I encounter a question when building models in Stata.

Data example:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str1 userID str10 date str12 post_status str44 category
"a" "2018/12/18" "Needs Votes"  "Business Central"                            
"b" "2019/11/01" "New"          "Finance "                                    
"c" "2019/09/26" "New"          "Sales"                                      
"c" "2019/09/27" "New"          "Sales"                                      
"d" "2020/04/30" "New"          "Power Platform Governance and Administration"
"e" "2016/05/28" "Under Review" "Sales"                                      
"e" "2016/07/25" "Declined"     "Customer Service"                            
"f" "2011/05/28" "Under Review" "Sales"                                      
"g" "2012/10/18" "Under Review" "Sales"                                      
"h" "2018/02/11" "Under Review" "Business Central"                            
"h" "2018/02/13" "Needs Votes"  "Business Central"                            
"i" "2019/10/12" "New"          "Sales"                                      
"j" "2019/02/05" "Needs Votes"  "Marketing"                                  
"j" "2019/02/07" "Needs Votes"  "Marketing"                                  
"j" "2019/02/10" "Needs Votes"  "Marketing"                                  
"j" "2019/02/11" "Completed"    "Marketing"                                  
"j" "2019/02/27" "Needs Votes"  "Marketing"                                  
"j" "2019/05/30" "Needs Votes"  "Marketing"                                  
"k" "2019/11/22" "Needs Votes"  "Supply Chain Management"                    
"l" "2019/11/13" "Under Review" "Customer Service"                            
"l" "2019/11/14" "Needs Votes"  "Customer Service"                            
"l" "2019/12/13" "Needs Votes"  "Customer Service"                            
"l" "2019/12/26" "New"          "Product Service"                            
"l" "2020/01/16" "New"          "Customer Service"                            
"l" "2020/01/16" "New"          "Customer Service"                            
"l" "2020/02/10" "New"          "Product Service"                            
"l" "2020/02/17" "New"          "Sales"                                      
"l" "2020/02/17" "Needs Votes"  "Customer Service"                            
"l" "2020/02/18" "New"          "Product Service"                            
"l" "2020/03/17" "Needs Votes"  "Customer Service"                            
"m" "2018/04/23" "New"          "Sales"                                      
"m" "2018/04/25" "New"          "Sales"                                      
"m" "2018/06/12" "Completed"    "Product Service"                            
"m" "2018/07/09" "Needs Votes"  "Customer Service"                            
"m" "2018/07/10" "Needs Votes"  "Customer Service"                            
"m" "2018/07/26" "Needs Votes"  "Customer Service"                            
"m" "2018/08/01" "Under Review" "Customer Service"                            
"m" "2018/08/21" "Needs Votes"  "Customer Service"                            
"m" "2018/09/03" "New"          "Sales"                                      
"m" "2018/11/21" "Completed"    "Marketing"                                  
"m" "2018/11/21" "Planned"      "Marketing"                                  
"m" "2018/11/21" "New"          "Sales"                                      
"m" "2019/02/07" "Under Review" "Customer Service"                            
"m" "2019/02/14" "New"          "Sales"                                      
"m" "2019/02/15" "New"          "Sales"                                      
"m" "2019/02/22" "New"          "Sales"                                      
"m" "2019/02/25" "New"          "Sales"                                      
"m" "2019/03/08" "New"          "Sales"                                      
"m" "2019/03/14" "Needs Votes"  "Customer Service"                            
"m" "2019/03/14" "New"          "Sales"                                      
"m" "2019/03/19" "New"          "Sales"                                      
"m" "2019/03/26" "New"          "Sales"                                      
"m" "2019/03/26" "New"          "Sales"                                      
"m" "2019/03/26" "New"          "Sales"                                      
"m" "2019/03/26" "New"          "Sales"                                      
"m" "2019/03/26" "New"          "Sales"                                      
"m" "2019/03/26" "New"          "Sales"                                      
"m" "2019/03/26" "New"          "Sales"                                      
"m" "2019/03/27" "New"          "Sales"                                      
"m" "2019/03/27" "New"          "Sales"                                      
"m" "2019/03/27" "New"          "Sales"                                      
"m" "2019/03/28" "New"          "Sales"                                      
"m" "2019/03/29" "New"          "Sales"                                      
"m" "2019/03/29" "New"          "Sales"                                      
"m" "2019/04/01" "New"          "Sales"                                      
"m" "2019/04/05" "New"          "Sales"                                      
"m" "2019/04/11" "New"          "Sales"                                      
"m" "2019/04/12" "New"          "Sales"                                      
"m" "2019/04/16" "New"          "Sales"                                      
"m" "2019/05/08" "New"          "Sales"                                      
"m" "2019/05/09" "New"          "Sales"                                      
"m" "2019/05/10" "New"          "Sales"                                      
"m" "2019/05/16" "New"          "Sales"                                      
"m" "2019/05/16" "New"          "Sales"                                      
"m" "2019/05/21" "New"          "Sales"                                      
"m" "2019/05/23" "Under Review" "Field Service"                              
"m" "2019/05/23" "New"          "Sales"                                      
"m" "2019/05/31" "New"          "Sales"                                      
"m" "2019/06/05" "New"          "Sales"                                      
"m" "2019/06/07" "New"          "Sales"                                      
"m" "2019/06/07" "New"          "Sales"                                      
"m" "2019/06/10" "New"          "Sales"                                      
"m" "2019/06/13" "New"          "Sales"                                      
"m" "2019/06/13" "New"          "Sales"                                      
"m" "2019/06/13" "New"          "Sales"                                      
"m" "2019/06/18" "New"          "Sales"                                      
"m" "2019/06/24" "New"          "Sales"                                      
"m" "2019/06/25" "New"          "Sales"                                      
"m" "2019/06/25" "New"          "Sales"                                      
"m" "2019/06/25" "New"          "Sales"                                      
"m" "2019/06/26" "New"          "Sales"                                      
"m" "2019/06/26" "New"          "Sales"                                      
"m" "2019/07/01" "New"          "Sales"                                      
"m" "2019/07/08" "New"          "Sales"                                      
"m" "2019/07/08" "New"          "Sales"                                      
"m" "2019/07/09" "New"          "Sales"                                      
"m" "2019/07/11" "New"          "Sales"                                      
"m" "2019/07/11" "New"          "Sales"                                      
"m" "2019/07/12" "New"          "Sales"                                      
"m" "2019/08/01" "New"          "Sales"                                      
end
I want to calculate the number of "New" statuses and different categories that one user has before time t.

For example: for UserID "m", on 2018/06/12 his past status was "New", he had posted in the category "Sales", so he had posted 2 posts, his no. of "New" status was 2, and no. of categories in which he had posted until time t-1 was 1.
On 2018/07/09, m's past status was "New" and "Completed", he had posted in categories "Sales" and "Product Service", so he had posted 3 posts, his past "New" status was 2, and no. of categories in which he had posted until time t-1 is 2.
On 2018/07/10, m's past status was "New", "Completed" and "Needs Votes", he had posted in categories "Sales", "Product Service" and "Customer Service", so he had posted 4 posts, his past "New" status was 2 and no. of categories in which he has posted until time t-1 is 3.
etc.

for the user a, it is his/her first post. so the number of past posts, status, categories will be 0.

Can I calculate this number of past posts, "New" status and different categories for a certain user until time t-1 in Stata? How can I do it? Many many thanks!!!