Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: how to identify unique id variables within groups?


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: how to identify unique id variables within groups?
Date   Wed, 20 May 2009 12:31:50 +0100

-duplicates- doesn't need to work with -by:-. 

You just need to include the variable(s) you would feed to -by:- in the varlist you feed directly to -duplicates-. 

Thus 

duplicates <whatever> id var1 

is a template for working with duplicates in your sense. Here <whatever> is whatever subcommand you need. 

The same comment applies to -isid-. 

isid id var1 

works out whether -id var1- jointly serve to identify observations uniquely. 

Thus existing (official) commands suffice for your problem. 

Nick 
n.j.cox@durham.ac.uk 

Jia Xiangping

For a datafile like :
id                    var1

1			1
1			2
1			3
2			1
2			2
2  		        1

I expect to check whether the value of "var1" within one group of "id"
is unique -- i.e. in group 2, the values are not unique. For a
non-grouped datafile, syntax like -isid- or -duplicates- is able to do
the work. But none of them works when combining with -by-.  Is there
any approach to check the unique  value within groups?


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index