Michael Blasnik wrote (excerpted):
Not sure if I understand exactly what you want, but this may do it:
bysort group (nocell): drop if nocell[1]!1 | nocell[_N]!=1
--------------------------------------------------------------------------------
Just a typo in Michael's suggestion:
bysort group (nocell): drop if nocell[1] != 1 | nocell[_N] != 1
Bracketing operators with spaces makes them more visible, and it seems that
the code is then is a bit easier to decipher and that it's somewhat easier
to spot coding errors. I believe that Stata handles white space around
operators similarly to how SAS does, so that you should be able to keep your
preference as far as this goes when coming to Stata from SAS.
Joseph Coveney
*
* 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/