11.07.2015 Views

[U] User's Guide

[U] User's Guide

[U] User's Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

[ U ] 18.9 Accessing results calculated by estimation commands 231What is surprising is that you can do this with scalar and even matrix saved results. e(N) is ascalar equal to 74 and may be used as such in any expression such as “display e(mss)/e(N)”or “local meanss = e(mss)/e(N)”. ‘e(N)’ substitutes to the string “74” and may be used inany context whatsoever, such as “local val‘e(N)’ = e(N)” (which would create a macro namedval74). The rules for referring to saved results are1. You may refer to r(name) or e(name) without single quotes in any expression and only inan expression. (Referring to s-class s(name) without single quotes is not allowed.)1.1 If name does not exist, missing value (.) is returned; it is not an error to refer to anonexistent saved result.1.2 If name is a scalar, the full double-precision value of name is returned.1.3 If name is a macro, it is examined to determine whether its contents can be interpretedas a number. If so, the number is returned; otherwise, the first 80 characters of name arereturned.1.4 If name is a matrix, the full matrix is returned.2. You may refer to ‘r(name)’, ‘e(name)’, or ‘s(name)’—note the presence of quotesindicating macro substitution—in any context whatsoever.2.1 If name does not exist, nothing is substituted; it is not an error to refer to a nonexistentsaved result. The resulting line is the same as if you had never typed ‘r(name)’,‘e(name)’, or ‘s(name)’.2.2 If name is a scalar, a string representation of the number accurate to no less than 12digits of precision is substituted.2.3 If name is a macro, the full contents are substituted.2.4 If name is a matrix, the word matrix is substituted.In general, you should refer to scalar and matrix saved results without quotes—r(name) ande(name)—and to macro saved results with quotes—‘r(name)’, ‘e(name)’, and ‘s(name)’—butit is sometimes convenient to switch. Say that returned result r(example) contains the number ofperiods patients are observed, and assume that r(example) was saved as a macro and not as ascalar. You could still refer to r(example) without the quotes in an expression context and obtainthe expected result. It would have made more sense for you to have stored r(example) as a scalar,but really it would not matter, and the user would not even have to know how the saved result wasstored.Switching the other way is sometimes useful, too. Say that returned result r(N) is a scalar thatcontains the number of observations used. You now want to use some other command that has anoption n(#) that specifies the number of observations used. You could not type n(r(N)) becausethe syntax diagram says that the n() option expects its argument to be a literal number. Instead, youcould type n(‘r(N)’).18.9 Accessing results calculated by estimation commandsEstimation results are saved in e(), and you access them in the same way you access any savedresult; see [U] 18.8 Accessing results calculated by other programs above. In summary,1. Estimation commands—regress, logistic, etc.—save results in e().2. Estimation commands save their name in e(cmd). For instance, regress saves “regress”and poisson saves “poisson” in e(cmd).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!