Dear all,

Patient number is a key identifier variable. For example Patients have come for 3 visits, here I want a code to see how many patients have attended all the 3 visits. Hence, I need to generate a new variable with a total number of visits each patient has visited. Also, the dataset is in long format. please see attached example of the query. Thank you