Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Inquire about display command

    Code:
    display  _b[_cons] + _b[priGPA]*3.1 + _b[ACT]*21
    Code:
    scalar A = _b[_cons] + _b[priGPA]*3.1 + _b[ACT]*21
    display A
    Why do these two codes show different outcomes? I am scary about it.

  • #2
    Nothing reproducible here -- after 92 posts you should know to give examples we can reproduce -- but

    Code:
    display A
    will show the first value of any variable called A (or that uniquely abbreviates to A if you haven't disabled variable name abbreviation) -- if and only if such a variable exists. But your code in fact tells all we need to know. Clearly you have a variable ACT. If Stata doesn't squawk at

    Code:
    display A
    what you typed is equivalent to

    Code:
    display ACT
    which will always be interpreted as

    Code:
    display ACT[1]
    As the good manual tells you, scalars and variables share the same namespace. So to insist that it is scalar A that you want to see, you need to tell Stata

    Code:
    display scalar(A)
    and then you won't feel scared (or scarred).

    Comment

    Working...
    X