Announcement

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

  • Problem with delimit

    Dear All,

    I have a master file from where I invoke other auxiliary files, the code being:

    Code:
    
    * Definition of the directory
    cd "MyDir"
    
    
    * Set the log file and loading the data
    cap log close
    log using Log\21Mar19.smcl, replace
    set more off
    
    
    /* Running preliminary analysis and tables */
    
    do 4-Estimations_Tables.do
    Inside the do file
    4-Estimations_Tables.do, I have routines for the estimations and the generation of tables. However, since the generation of tables requires a large code I use delimit. Specifically:

    Code:
    
    #delimit ;
    
    esttab   slm_dW_pc_culture slm_dW_pc_culturepos slm_dW_pc_children
       slm_dW_control slm_dW_trust slm_dW_obedience slm_dW_respect
       using "Tables_dW\slm_dW.tex",
       replace star(* 0.10 ** 0.05 *** 0.01)
       plain nogaps depvars b(%9.3f)
       legend noabbrev style(tex) booktabs
       title("slm_dW" \label{slm_dW}) se
       substitute(\begin{table}[htbp]\centering
       \begin{table}[htbp]\centering\footnotesize{ \end{tabular} \end{tabular}}) ;
       
    * Table sem_dW
    
    esttab   sem_dW_pc_culture sem_dW_pc_culturepos sem_dW_pc_children
       sem_dW_control sem_dW_trust sem_dW_obedience sem_dW_respect
       using "Tables_dW\sem_dW.tex",
       replace star(* 0.10 ** 0.05 *** 0.01)
       plain nogaps depvars b(%9.3f)
       legend noabbrev style(tex) booktabs
       title("sem_dW" \label{sem_dW}) se
       substitute(\begin{table}[htbp]\centering
       \begin{table}[htbp]\centering\footnotesize{ \end{tabular} \end{tabular}}) ;
       
    * Table sarar_dW
    
    esttab   sarar_dW_pc_culture sarar_dW_pc_culturepos sarar_dW_pc_children
       sarar_dW_control sarar_dW_trust sarar_dW_obedience sarar_dW_respect
       using "Tables_dW\sarar_dW.tex",
       replace star(* 0.10 ** 0.05 *** 0.01)
       plain nogaps depvars b(%9.3f)
       legend noabbrev style(tex) booktabs
       title("sarar_dW" \label{sarar_dW}) se
       substitute(\begin{table}[htbp]\centering
       \begin{table}[htbp]\centering\footnotesize{ \end{tabular} \end{tabular}});
    
    
    # delimiit cr


    In the output window I can see the estimations. But when I go to the folder where the tables are supposed to be, I cannot find anything. Just the first table is created. I also use xml_tab to generate files readable in excel. In that case not even the first table is created. Which is the issue with that?

    Thanks in advance

  • #2
    You need to end each of your comments with semicolons. As now written, each comment continues through the end of what is supposed to be an esttab command.

    In this example, you can see the second "tab", but it is preceded by "> " rather than ". " indicating that it is a continuation of the comment that starts on the preceding line.
    Code:
    . sysuse auto, clear
    (1978 Automobile Data)
    
    . #delimit ;
    delimiter now ;
    . tab foreign;
    
       Car type |      Freq.     Percent        Cum.
    ------------+-----------------------------------
       Domestic |         52       70.27       70.27
        Foreign |         22       29.73      100.00
    ------------+-----------------------------------
          Total |         74      100.00
    
    . * a comment
    > tab foreign;
    .

    Comment


    • #3
      William Lisowski Thanks William.

      Comment


      • #4
        Another work-around is to always use block comments - i.e.
        Code:
        /* comments go between slash asterisk, and asterisk slash */
        . The block comments can span multiple lines with the carriage return (cr) delimiter as well.

        Comment

        Working...
        X