Announcement

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

  • What are these system variables (_variables)?

    It seems that _c(varname), _n(varname), _p(varname), _s(varname) all return the first value of a variable, which appears to be of little use. So I wonder why Stata has these system variables. Is there anything useful that they can do? Thank you.


    Code:
    . sysuse          auto
    (1978 Automobile Data)
    
    . di              _c[mpg]
    22
    . di              _n[mpg]
    
    22
    
    . di              _p[mpg]
    22
    
    . di              _s[mpg]
     22

  • #2
    _c _n and _s are all abbreviations of display directives as shown in the helpfile for the display command:
    _continue: suppresses a newline at the end of the display command (You may have noticed that there was no newline between the output of your di _c[mpg] and the di _n[mpg] commands)
    _newline: displays one newline (As shown by there being a newline between your command and the first value of the variable)
    _skip(#): skips # columns, defaulting to 1 when there is no argument (As shown by there being a single whitespace appended before the first value of the variable in the output)

    However, the nature of _p evades me... It is likely to also not be a system variable.

    Comment

    Working...
    X