Announcement

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

  • Printing rendered SMCL file in Console Stata

    Hello,

    Does anyone know of a good way to render and print a specified SMCL file located on the disk, while using Console Stata? I'll give a trivial and easily reproducible test case here, but my goal in asking this question is to solve a bug report with my program -maptile-.

    In a Stata GUI window, one can open a rendered view of a SMCL file using the -view- command. For example:

    Code:
    log using test.smcl
    sysuse auto
    reg price mpg
    log off
    view test.smcl
    If you try the exact same thing in Console Stata, you get the following error:

    Code:
    . view test.smcl
    the -view- command is not available under Stata(console)
    r(199);
    I've given this issue some thought, and the help files that are distributed with Stata ado-files are simply SMCL markup stored with a .sthlp file extension instead of a .smcl file extension. If one runs -help regress- in a Stata GUI window, the help file is rendered in a viewer. If one runs -help regress- in a Stata Console window, the help file is rendered and printed to the console.

    I inspected help.ado, and unfortunately the -chelp- command that does the rendering for Console Stata is a built-in command. So I can't point -chelp- to a .smcl file, nor can I view and adapt the -chelp- code.

    Any advice and guidance is appreciated!

  • #2
    You could use the type command instead of view:

    Code:
    . log using test.smcl
    
    -------------------------------------------------------------------------------
    
          name:  <unnamed>
    
           log:  /Users/billy/Desktop/Programs/test.smcl
    
      log type:  smcl
    
     opened on:  20 Aug 2016, 11:27:58
    
    
    
    
    . sysuse auto.dta, clear
    
    (1978 Automobile Data)
    
    
    
    
    . reg price mpg
    
    
    
    
          Source |       SS           df       MS      Number of obs   =        74
    
    -------------+----------------------------------   F(1, 72)        =     20.26
    
           Model |   139449474         1   139449474   Prob > F        =    0.0000
    
        Residual |   495615923        72  6883554.48   R-squared       =    0.2196
    
    -------------+----------------------------------   Adj R-squared   =    0.2087
    
           Total |   635065396        73  8699525.97   Root MSE        =    2623.7
    
    
    
    
    ------------------------------------------------------------------------------
    
           price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    
    -------------+----------------------------------------------------------------
    
             mpg |  -238.8943   53.07669    -4.50   0.000    -344.7008   -133.0879
    
           _cons |   11253.06   1170.813     9.61   0.000     8919.088    13587.03
    
    ------------------------------------------------------------------------------
    
    
    
    
    . log off  
    
          name:  <unnamed>
    
           log:  /Users/billy/Desktop/Programs/test.smcl
    
      log type:  smcl
    
     paused on:  20 Aug 2016, 11:28:13
    
    -------------------------------------------------------------------------------
    
    
    
    
    . type "test.smcl"
    
    -------------------------------------------------------------------------------
    
          name:  <unnamed>
    
           log:  /Users/billy/Desktop/Programs/test.smcl
    
      log type:  smcl
    
     opened on:  20 Aug 2016, 11:27:58
    
    
    
    
    . sysuse auto.dta, clear
    
    (1978 Automobile Data)
    
    
    
    
    . reg price mpg
    
    
    
    
          Source |       SS           df       MS      Number of obs   =        74
    
    -------------+----------------------------------   F(1, 72)        =     20.26
    
           Model |   139449474         1   139449474   Prob > F        =    0.0000
    
        Residual |   495615923        72  6883554.48   R-squared       =    0.2196
    
    -------------+----------------------------------   Adj R-squared   =    0.2087
    
           Total |   635065396        73  8699525.97   Root MSE        =    2623.7
    
    
    
    
    ------------------------------------------------------------------------------
    
           price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    
    -------------+----------------------------------------------------------------
    
             mpg |  -238.8943   53.07669    -4.50   0.000    -344.7008   -133.0879
    
           _cons |   11253.06   1170.813     9.61   0.000     8919.088    13587.03
    
    ------------------------------------------------------------------------------
    
    
    
    
    . log off
    
          name:  <unnamed>
    
           log:  /Users/billy/Desktop/Programs/test.smcl
    
      log type:  smcl
    
     paused on:  20 Aug 2016, 11:28:13
    
    -------------------------------------------------------------------------------

    Comment


    • #3
      Thanks William, that was exactly the command I needed!

      Comment

      Working...
      X