counting the number of times individual appears more than once

#1
Hi there, I have an interesting database of what I thought was 11000 clients. Turns out for my person identifier variable I have the same individual reported more than once (I noticed when I sorted). when there is a duplicated the same info is recorded in the columns. Is there a way of counting how many times I have the same individual more than once so that I can know really how many people I have in the dataset.

Also when they appear more than once is there a way of deleting the duplicate observations?

Thanks in advance

James
 

bukharin

RoboStataRaptor
#2
Take a look at the -duplicates- command, the -codebook- command (which tells you the number of unique observations for a given variable), and this old but still informative FAQ.
 
#3
if the identifier for each person does not change, you can easily get the number of UNIQUE person in your dataset
bys ID: gen junk=_n
gen pernd=junk==1
tab pernd
**pernd means person identifier

Then, if each row means one visit you do:
gen visit=1
egen tot_visit=sum(visit), by (ID)
and this will give you the sum of the times (rows) the person has apparead