Statalist


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

Re: st: Declare and class field initialisation with an r()-value


From   [email protected] (Vince Wiggins, StataCorp)
To   [email protected]
Subject   Re: st: Declare and class field initialisation with an r()-value
Date   Sun, 25 Jan 2009 22:28:05 -0600

Sergiy Radyakin <[email protected]> asks about using the Declare class
builtin with.

> is this a bug in Stata?
>
> sysuse auto
> .MyObject=.object.new
> summarize price
> .MyObject Declare double AvPrice1 = r(mean)
> .MyObject Declare double AvPrice2 = 6165.256756756757
> classutil des .MyObject
>
> Output:
> object .MyObject:
>    classwide:
>         dbstyle      .dbstyle
>    .Declare:
>         double       .AvPrice1      = .
>         double       .AvPrice2      = 6165.256756756757
> [...]

It is a bug.  We will fix it in a future update.  In the interim, I suggest
dereferencing r() results with macro quotes in the declaration; e.g., 

    .MyObject.Declare AvPrice2 = `r(mean)'

 
-- Vince
   [email protected]

 
 
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index