Hello,
Using Stata 16.1 for Mac, I have been doing quite a bit of searching online to try to figure this out and keep getting confused. I have a dataset with a large number of IDs, many of which are repeated multiple times. I want to figure out the percentage of IDs that have only been seen 1 time, that have been seen 2 times, 3 times, etc. so that I can calculate the percentage of people who were seen once, twice, three times, etc. My dataset is about 80,000 observations (which includes the repeated values), so it is impossible to recode any variables by hand.

I have used bysort patient_id : gen patient_id_count = _N, but the frequencies included the duplicate values, which makes my data meaningless.

I have downloaded the Distinct function, but it just shows me how many distinct values there are overall - what I need is the number of times each distinct value is showing up as a frequency and as a percentage.
I have also tried:
by patient_id, sort: gen nvals = _n == 1
tab nvals

which shows me the number of distinct values overall as well.

The only thing that got me close to what I want is Contract, but that eliminates the rest of my data, so it is difficult to use that.
contract patient_id
tab _freq

Any suggestions?
Thank you kindly.