Statalist


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

st: -set memory- in Stata 11


From   "Newson, Roger B" <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: -set memory- in Stata 11
Date   Mon, 27 Jul 2009 18:15:28 +0100

Fellow Statalisters (especially StataCorp)

Thanks to all at StataCorp for the new Stata 11, which I am currently testing (in its IC flavor) on my Windows XP system, and which seems to be working as advertized so far.

One immediate query (sorry for being a pest). Is there any special reason why, in Stata 11, we can no longer reset the memory using -set memory- when there is a set of estimation results (or even a matrix) in the memory, even under version control with the command -version 10.1-? (I have included a demonstration of this feature of Stata 11 under version control below my signature.)

I ask because we were always allowed to do this in Stata 6, 7, 8, 9 and 10, and I have therefore always habitually started most of my do-files with three commands, which were a -version- command, a -clear- command, and a -set memory- command. As in:

version 10.1;
clear;
set memory 1m;

These do-files worked under their respective Stata versions, or under higher versions. However, if I re-run a Stata 10.1 do-file beginning with these 3 commands under Stata 11, and a set of estimation results (or a matrix) already exists in the memory, then the first 2 commands execute OK, but the third command aborts with the error message

no; Stata matrices have not been cleared
(type -clear matrix- to clear Stata matrices)

I am aware that, if I amend the second of the above 3 commands so that they read

version 10.1;
clear all;
set memory 1m;

then the matrices will be cleared as well, and the do-file will therefore run under either Stata 10.1 or Stata 11. However, I was wondering if there is a quick fix to this minor teething problem which does not require me to edit most of my existing currently active do-files one by one. I cannot immediately find such a fix in the on-line help for -clear- or -memory-, or in the new .pdf manuals (which are a much appreciated improvement - thanks to all at StataCorp).

Best wishes

Roger


Roger B Newson BSc MSc DPhil
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
UNITED KINGDOM
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: [email protected] 
Web page: http://www.imperial.ac.uk/nhli/r.newson/
Departmental Web page:
http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/popgenetics/reph/

Opinions expressed are those of the author, not of the institution.

**** BEGINNING OF Stata LOG - CUT HERE

. version 10.1

. sysuse auto, clear
(1978 Automobile Data)

. regress mpg weight

      Source |       SS       df       MS              Number of obs =      74
-------------+------------------------------           F(  1,    72) =  134.62
       Model |   1591.9902     1   1591.9902           Prob > F      =  0.0000
    Residual |  851.469256    72  11.8259619           R-squared     =  0.6515
-------------+------------------------------           Adj R-squared =  0.6467
       Total |  2443.45946    73  33.4720474           Root MSE      =  3.4389

------------------------------------------------------------------------------
         mpg |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      weight |  -.0060087   .0005179   -11.60   0.000    -.0070411   -.0049763
       _cons |   39.44028   1.614003    24.44   0.000     36.22283    42.65774
------------------------------------------------------------------------------

. eretu list

scalars:
                  e(N) =  74
               e(df_m) =  1
               e(df_r) =  72
                  e(F) =  134.618242241237
                 e(r2) =  .6515312529087511
               e(rmse) =  3.438889631047954
                e(mss) =  1591.990203053362
                e(rss) =  851.4692564060979
               e(r2_a) =  .6466914091991505
                 e(ll) =  -195.3886885951764
               e(ll_0) =  -234.3943376482347
               e(rank) =  2

macros:
            e(cmdline) : "regress mpg weight"
              e(title) : "Linear regression"
          e(marginsok) : "XB default"
                e(vce) : "ols"
             e(depvar) : "mpg"
                e(cmd) : "regress"
         e(properties) : "b V"
            e(predict) : "regres_p"
              e(model) : "ols"
          e(estat_cmd) : "regress_estat"

matrices:
                  e(b) :  1 x 2
                  e(V) :  2 x 2

functions:
             e(sample)   

. clear

. eretu list

scalars:
                  e(N) =  74
               e(df_m) =  1
               e(df_r) =  72
                  e(F) =  134.618242241237
                 e(r2) =  .6515312529087511
               e(rmse) =  3.438889631047954
                e(mss) =  1591.990203053362
                e(rss) =  851.4692564060979
               e(r2_a) =  .6466914091991505
                 e(ll) =  -195.3886885951764
               e(ll_0) =  -234.3943376482347
               e(rank) =  2

macros:
            e(cmdline) : "regress mpg weight"
              e(title) : "Linear regression"
          e(marginsok) : "XB default"
                e(vce) : "ols"
             e(depvar) : "mpg"
                e(cmd) : "regress"
         e(properties) : "b V"
            e(predict) : "regres_p"
              e(model) : "ols"
          e(estat_cmd) : "regress_estat"

matrices:
                  e(b) :  1 x 2
                  e(V) :  2 x 2

. set memory 1m
no; Stata matrices have not been cleared
(type -clear matrix- to clear Stata matrices)
r(4);

. ereturn clear

. set memory 1m
(1024k)
**** END OF Stata LOG - CUT HERE
*
*   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