This, or at least its complement, is a FAQ.
How do I list observations in a group that differ on a variable?
http://www.stata.com/support/faqs/data/diff.html
bysort zipcode (totalwom1519) : assert totalwom1519[1] ==
totalwom1519[_N]
Alternatively, use -duplicates- to investigate the structure of
duplicates.
Nick
[email protected]
Ekaterina Hertog
I am trying to check the dataset I am working with. It is a dataset of
neighbourhood demographic values and I want to confirm that the
demographic variables associated with each zipcode are identical.
The data looks as follows:
"0182801" 1253 144 115 113 29
"0182801" 1253 144 115 113 29
"0182801" 1253 144 115 113 29
"0182801" 1253 144 115 113 29
"0183204" 90 8 8 8 0
"0183204" 90 8 8 8 0
"0183331" 772 81 64 62 17
"0183331" 772 81 64 62 17
"0183331" 772 81 64 62 17
"0183505" 1816 262 218 211 44
"0183505" 1816 262 218 211 44
The first variable is the zipcode the rest are demographics.
I tried something like:
by zipcode: assert totalwom1519[_n]==totalwom1519[_n+1]
but it clearly did not do what I wanted it to.
Would anyone know how to do it?
*
* 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/