Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: state the same for multiple observations?


From   "Richardson, Kelly K." <Kelly.Richardson@va.gov>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: state the same for multiple observations?
Date   Tue, 14 Nov 2006 09:00:21 -0600

This should work:

sort us_id state
list us_id if us_id==us_id[_n-1] & state~=state[_n-1]



Anyone have an idea of how I can do the following: 

The data looks something like this: 

us_id       state
1               CA
1               CA
2               VA
3               PA
3               TX

I need to know if when a us_id has multiple observations is the state
the same for each observation in that us_id.  If the state is different
for a given us_id I need to be able to easily identify those cases. 

Thanks in advance,
Marilyn. 
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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