Announcement

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

  • puting mean into a global variable

    Hello Statlisters,

    How can I put mean into a global macro variable? The code below produces an empty value instead of 6165.257

    webuse auto
    summarize price
    global mean_price=r(mean)
    disp `mean_price'

    Peter

  • #2
    The global is there; you just used the syntax for displaying a local macro.

    Code:
    . sysuse auto, clear 
    (1978 Automobile Data)
    
    . summarize price
    
        Variable |       Obs        Mean    Std. Dev.       Min        Max
    -------------+--------------------------------------------------------
           price |        74    6165.257    2949.496       3291      15906
    
    . global mean_price=r(mean)
    
    . disp `mean_price' 
    
    
    . disp $mean_price 
    6165.2568
    See also http://www.stata.com/statalist/archi.../msg01258.html

    Comment

    Working...
    X