Hello, I am trying to use bys to generate sequential and total number of Lines of treatments by patient by disease phase (CLL vs RT). The total number just does not seems to show with my code: What am I doing wrong? The first _n works perfectly.

bysort studyid disease (Lineno): gen tx = _n if !inlist(lot_split, "No", "None", "untrea", "", "N/A", "NA")
bysort studyid disease (Lineno): gen txtot = _N if!missing(tx)

Code:
* Example generated by -dataex-. For more info, type help dataex
clear
input float studyid str3 disease byte Lineno str102 lot_split
1 "cll" 1 "FCR"                         
1 "cll" 2 " Ibrutinib"                  
1 "cll" 3 ""                            
1 "cll" 4 ""                            
1 "cll" 5 ""                            
1 "cll" 6 ""                            
1 "cll" 7 ""                            
1 "cll" 8 ""                            
1 "rt"  1 "Venetoclax/Rituximab"        
1 "rt"  2 " Venetoclax"                 
1 "rt"  3 " Idelasilib/Rituximab"       
1 "rt"  4 " Obinutuzumab/Idelalisib"    
1 "rt"  5 ""                            
1 "rt"  6 ""                            
1 "rt"  7 ""                            
1 "rt"  8 ""                            
2 "cll" 1 "FCO"                         
2 "cll" 2 ""                            
2 "cll" 3 ""                            
2 "cll" 4 ""                            
2 "cll" 5 ""                            
2 "cll" 6 ""                            
2 "cll" 7 ""                            
2 "cll" 8 ""                            
2 "rt"  1 "ACP"                         
2 "rt"  2 " AVD"                        
2 "rt"  3 " BV-bendamustine"            
2 "rt"  4 " BV"                         
2 "rt"  5 " Pembrolizumab"              
2 "rt"  6 " Pembrolizumab/Acalabrutinib"
2 "rt"  7 ""                            
2 "rt"  8 ""                            
3 "cll" 1 ""                            
3 "cll" 2 ""                            
3 "cll" 3 ""                            
3 "cll" 4 ""                            
3 "cll" 5 ""                            
3 "cll" 6 ""                            
3 "cll" 7 ""                            
3 "cll" 8 ""                            
3 "rt"  1 "R-CHOP"                      
3 "rt"  2 " Ibrutinib"                  
3 "rt"  3 " BR-polatuzumab"             
3 "rt"  4 " Venetoclax"                 
3 "rt"  5 " Obinituzumab/Venetoclax"    
3 "rt"  6 " Venetoclax"                 
3 "rt"  7 ""                            
3 "rt"  8 ""                            
4 "cll" 1 ""                            
4 "cll" 2 ""                            
4 "cll" 3 ""                            
4 "cll" 4 ""                            
4 "cll" 5 ""                            
4 "cll" 6 ""                            
4 "cll" 7 ""                            
4 "cll" 8 ""                            
4 "rt"  1 "CHOP"                        
4 "rt"  2 " R-CHOP"                     
4 "rt"  3 " R-ICE"                      
4 "rt"  4 " Ibrutinib"                  
4 "rt"  5 " RT"                         
4 "rt"  6 ""                            
4 "rt"  7 ""                            
4 "rt"  8 ""                            
5 "cll" 1 ""                            
5 "cll" 2 ""                            
5 "cll" 3 ""                            
5 "cll" 4 ""                            
5 "cll" 5 ""                            
5 "cll" 6 ""                            
5 "cll" 7 ""                            
5 "cll" 8 ""                            
5 "rt"  1 ""                            
5 "rt"  2 ""                            
5 "rt"  3 ""                            
5 "rt"  4 ""                            
5 "rt"  5 ""                            
5 "rt"  6 ""                            
5 "rt"  7 ""                            
5 "rt"  8 ""                            
6 "cll" 1 "Chlorambucil"                
6 "cll" 2 " Rituximab/Chlorambucil"     
6 "cll" 3 " Ibrutinib"                  
6 "cll" 4 " Idelalisib/Rituximab"       
6 "cll" 5 " Venetoclax"                 
6 "cll" 6 ""                            
6 "cll" 7 ""                            
6 "cll" 8 ""                            
6 "rt"  1 "Venetoclax"                  
6 "rt"  2 " Pembrolizumab"              
6 "rt"  3 ""                            
6 "rt"  4 ""                            
6 "rt"  5 ""                            
6 "rt"  6 ""                            
6 "rt"  7 ""                            
6 "rt"  8 ""                            
7 "cll" 1 ""                            
7 "cll" 2 ""                            
7 "cll" 3 ""                            
7 "cll" 4 ""                            
end