Your comparison
... if artist != artist
compares each value with itself, but necessarily in no observations
are values not equal to themselves. It is like asking
... if "Estrella" != "Estrella"
which is always false.
Your comparison needs to be within a group of observations.
bysort title (artist) : gen diff = artist[1] != artist[_N]
l title artist if diff
This is an FAQ: see
http://www.stata.com/support/faqs/data-management/listing-observations-in-group/
I did refer you to precisely this FAQ on 9 January.
Nick
On Mon, Jan 14, 2013 at 11:58 AM, Estrella Gomez
<estrellastata@gmail.com> wrote:
> Hi,
>
> I am working with a database that contains music records. I would like
> to detect observations in which the title is the same title but the
> artist is different; for instance, "The power of love" is a song from
> Celine Dion, but also from Huey Lewis & the News. I have tried this
> command:
>
> list if title==title & artist!=artist
>
> but reports nothing.
>
> In addition, I would like to find observations with the same title but
> different identifier; however,
>
> list if title==title & id!=id
>
> again reports nothing
>
> Any idea?
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/