Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: RE: Equals: why the "=" (attribution) vs. "==" (Boolean) syntax distinction ???


From   Joe Canner <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: RE: Equals: why the "=" (attribution) vs. "==" (Boolean) syntax distinction ???
Date   Tue, 27 Aug 2013 17:10:40 +0000

How about the following?

. gen a=b==c

How would Stata interpret this (valid) statement if there was no distinction between = and ==?

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Lucas Ferreira Mation
Sent: Tuesday, August 27, 2013 1:00 PM
To: statalist
Subject: st: Equals: why the "=" (attribution) vs. "==" (Boolean) syntax distinction ???

sort of a philosophical question (and I could not find any previous discussion on this topic in the list):

why does Stata the language differentiate between "=" and "==" ?

I was teaching a Intro to Stata Class and the students were asking about it. I explained the difference between attribution equal (=) and Boolean check equal (==).

Although they got the concept, the question remains:

why be explicit about this distinction in the language syntax?

Thinking about it, it seems to me that the occurrences of "equal"
(attribution vs. Boolean) aways appear in distinct places in the syntax, so it does not seem prone to mistakes.

On the other hand, forgetting "==" it the single most common mistake beginner users make, and even more advanced users ofter forget.

Anyway, I just wanted to know if there are other reasons I'm unaware of.


Lucas
*
*   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/

*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index