diff --git a/04-02-creating_log_files_automatically.md b/04-02-creating_log_files_automatically.md index 548dfcd..78ee6b5 100644 --- a/04-02-creating_log_files_automatically.md +++ b/04-02-creating_log_files_automatically.md @@ -27,18 +27,52 @@ On Windows, follow instructions [here](https://www.stata.com/manuals/gswb.pdf#gs ::::{tab-item} R -To automatically create a log file, run R from the command line as follows: +To automatically create a log file, run R from the command line using the `BATCH` functionality, as follows: ```bash -R CMD BATCH main.R +R CMD BATCH options infile outfile +``` + +where + +- `options` are optional _options_ from the command R + +- `infile` is the required input file with the code to be executed + +- `outfile` is the name of an optional output file. If no output file +is provided, the name of `infile` is taken as default, appending +the extension `.Rout` to it. + + +:::{warning} +On Windows, you may need to include the full path of R: `C:\Program Files\R\R-4.1.0\bin\R.exe CMD BATCH main.R` +::: + + +This will create a file `main.Rout` in the same directory as `main.R`. If you prefer a different name for the output file, you can specify it. + +```bash +R CMD BATCH main.R main.$(date +%F-%H:%M:%S).Rout +``` + +which will create a second-precise date-time stamped log file. Finally, if you want to prevent R from saving or restoring its environment (by default, `R CMD BATCH` does both), you can specify the `--no-save` and `--no-restore` options. + +```bash +R CMD BATCH --no-save --no-restore main.R main.$(date +%F-%H:%M:%S).Rout ``` -will create a file `main.Rout` in the same directory as `main.R`. :::{warning} If there are other commands, such as `sink()`, active in the R code, the `main.Rout` file will not contain some output. ::: + +> To see more information, check the manual documentation by typing +`?BATCH` (or `help(BATCH)`) from within an R interactive session. Or by +typing `R CMD BATCH --help` from the command line. + + + :::: ::::{tab-item} MATLAB diff --git a/presentation/04-creating_log_files.md b/presentation/04-creating_log_files.md index 9cd4d84..f498801 100644 --- a/presentation/04-creating_log_files.md +++ b/presentation/04-creating_log_files.md @@ -120,15 +120,14 @@ log using "`globallog'", name(global) replace text - While some software (Stata, MATLAB) will create log files that contain **commands and output**, others (R, Python) will create log files that contain **only output**. -### Creating log files automatically +# Creating log files automatically An alternative (or complement) to creating log files explicitly is to use native functionality of the software to create them. This usually is triggered when using the command line to run the software, and thus may be considered an **advanced topic.** The examples below are for Linux/macOS, but similar functionality exists for Windows. -:::: {.panel-tabset} -### Stata +## Stata To automatically create a log file, run Stata from the command line with the `-b` option: @@ -138,30 +137,112 @@ stata -b do main.do which will create a file `main.log` in the same directory as `main.do`. -```{.notes} -For this to work, the filename cannot include spaces. +> - For this to work, the filename cannot include spaces. +> - On Windows, follow instructions [here](https://www.stata.com/manuals/gswb.pdf#gswB.5). + + + + + + + + + + + + + + + + + + + + + + +## R {auto-animate=true transition="fade"} + +To automatically create a log file, run R from the command line using the `BATCH` functionality, as follows: + +```bash +R CMD BATCH options infile outfile +``` + +> On Windows, you may need to include the full path of R: + ``` -On Windows, follow instructions [here](https://www.stata.com/manuals/gswb.pdf#gswB.5). +C:\Program Files\R\R-4.1.0\bin\R.exe CMD BATCH main.R +``` + + +## R {auto-animate=true transition="fade"} +To automatically create a log file, run R from the command line using the `BATCH` functionality, as follows: +```bash +R CMD BATCH options infile outfile +``` -### R +This will create a file `main.Rout` in the same directory as `main.R`. -To automatically create a log file, run R from the command line as follows: +## R {auto-animate=true transition="fade"} + +If you prefer a different name for the output file, you can specify it. ```bash -R CMD BATCH main.R +R CMD BATCH main.R main.$(date +%F-%H:%M:%S).Rout ``` -will create a file `main.Rout` in the same directory as `main.R`. +which will create a second-precise date-time stamped log file. -```{.notes} -If there are other commands, such as `sink()`, active in the R code, the `main.Rout` file will not contain some output. +## R {auto-animate=true transition="fade"} + +If you want to prevent R from saving or restoring its environment (by default, `R CMD BATCH` does both), you can specify the `--no-save` and `--no-restore` options. + +```bash +R CMD BATCH --no-save --no-restore main.R main.$(date +%F-%H:%M:%S).Rout ``` +## R {.smaller} + +:::{warning} +If there are other commands, such as `sink()`, active in the R code, the `main.Rout` file will not contain some output. +::: + +## R {.smaller} + +> To see more information, check the manual documentation by typing +`?BATCH` (or `help(BATCH)`) from within an R interactive session. Or by +typing `R CMD BATCH --help` from the command line. + + + + + + + + + + + + + -### MATLAB + + + + + + + + + + + + +## MATLAB {auto-animate=true} To automatically create a log file, run MATLAB from the command line as follows: @@ -169,6 +250,8 @@ To automatically create a log file, run MATLAB from the command line as follows: matlab -nodisplay -r "addpath(genpath('.')); main" -logfile matlab.log ``` +## MATLAB {auto-animate=true transition="fade"} + A similar command on Windows would be: ```bash @@ -177,7 +260,7 @@ start matlab -nosplash -minimize -r "addpath(genpath('.'));main" -logfile mat -### Julia, Python +## Julia, Python {auto-animate=true transition="fade"} In order to capture screen output in Julia and Python, on Unix-like system (Linux, macOS), the following can be run: @@ -185,7 +268,11 @@ In order to capture screen output in Julia and Python, on Unix-like system (Linu julia main.jl | tee main.log ``` -or +which will create a log file with everything that would normally appear on the console using the `tee` command. + +## Julia, Python {auto-animate=true transition="fade"} + +In order to capture screen output in Julia and Python, on Unix-like system (Linux, macOS), the following can be run: ```bash python main.py | tee main.log @@ -193,7 +280,6 @@ python main.py | tee main.log which will create a log file with everything that would normally appear on the console using the `tee` command. -:::: diff --git a/presentation/index.html b/presentation/index.html index f34e419..e0f28e9 100644 --- a/presentation/index.html +++ b/presentation/index.html @@ -8,7 +8,7 @@ - + @@ -43,7 +43,7 @@ } @media print { pre > code.sourceCode { white-space: pre-wrap; } - pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; } + pre > code.sourceCode > span { display: inline-block; text-indent: -5em; padding-left: 5em; } } pre.numberSource code { counter-reset: source-line 0; } @@ -418,7 +418,7 @@

Day T-1

Introduction

-

This document describes a few possible steps to self-check replication packages before submitting them to a journal. It is not meant to be exhaustive, and it is not meant to be prescriptive. There are many ways to construct a replication package, and many more to check that it works.

+

This document describes a few possible steps to self-check replication packages before submitting them to a journal. It is not meant to be exhaustive, and it is not meant to be prescriptive. There are many ways to construct a replication package, and many more to check that it works.

Computational Empathy

@@ -466,8 +466,7 @@

Why

-
- +
@@ -603,8 +602,7 @@

Stata

do $rootdir/04_figures.do * Run the appendix file do $rootdir/05_appendix.do - - +

Stata

@@ -624,8 +622,7 @@

Stata

do $rootdir/04_figures.do * Run the appendix file do $rootdir/05_appendix.do - - +

Notes

@@ -645,8 +642,7 @@

Notes

cd /where/my/code/is
 stata-mp -b do main.do

where stata-mp should be replaced with stata or stata-se depending on your licensed version.

- - +

R

@@ -672,8 +668,7 @@

R

source(file.path(rootdir, "04_figures.R"), echo = TRUE) ## Run the appendix file source(file.path(rootdir, "05_appendix.R"), echo = TRUE) - - +

R

@@ -699,8 +694,7 @@

R

source(file.path(rootdir, "04_figures.R"), echo = TRUE) ## Run the appendix file source(file.path(rootdir, "05_appendix.R"), echo = TRUE) - - +

Notes for R

@@ -926,8 +920,7 @@

Stata

local logname = "`cdate'-`ctime'-`c(username)'" local globallog = "$logdir/logfile_`logname'.log" log using "`globallog'", name(global) replace text - - +

Stata

@@ -944,8 +937,7 @@

Stata

local logname = "`cdate'-`ctime'-`c(username)'" local globallog = "$logdir/logfile_`logname'.log" log using "`globallog'", name(global) replace text - - +

Stata

@@ -962,8 +954,7 @@

Stata

local logname = "`cdate'-`ctime'-`c(username)'" local globallog = "$logdir/logfile_`logname'.log" log using "`globallog'", name(global) replace text - - +

Notes

@@ -971,39 +962,81 @@

Notes

  • More examples
  • While some software (Stata, MATLAB) will create log files that contain commands and output, others (R, Python) will create log files that contain only output.
  • -

    Creating log files automatically

    +
    +
    +
    +

    Creating log files automatically

    An alternative (or complement) to creating log files explicitly is to use native functionality of the software to create them. This usually is triggered when using the command line to run the software, and thus may be considered an advanced topic. The examples below are for Linux/macOS, but similar functionality exists for Windows.

    -
    +
    +

    Stata

    To automatically create a log file, run Stata from the command line with the -b option:

    stata -b do main.do

    which will create a file main.log in the same directory as main.do.

    -
    For this to work, the filename cannot include spaces.
    -

    On Windows, follow instructions here.

    - -
    -

    To automatically create a log file, run R from the command line as follows:

    -
    R CMD BATCH main.R
    -

    will create a file main.Rout in the same directory as main.R.

    -
    If there are other commands, such as `sink()`, active in the R code, the `main.Rout` file will not contain some output.
    +
      +
    • For this to work, the filename cannot include spaces.
    • +
    • On Windows, follow instructions here.
    • +
    +
    +
    +

    R

    +

    To automatically create a log file, run R from the command line using the BATCH functionality, as follows:

    +
    R CMD BATCH options infile outfile
    +
    +

    On Windows, you may need to include the full path of R:

    +
    +
    C:\Program Files\R\R-4.1.0\bin\R.exe CMD BATCH main.R
    +
    +
    +

    R

    +

    To automatically create a log file, run R from the command line using the BATCH functionality, as follows:

    +
    R CMD BATCH options infile outfile
    +

    This will create a file main.Rout in the same directory as main.R.

    +
    +
    +

    R

    +

    If you prefer a different name for the output file, you can specify it.

    +
    R CMD BATCH main.R main.$(date +%F-%H:%M:%S).Rout
    +

    which will create a second-precise date-time stamped log file.

    +
    +
    +

    R

    +

    If you want to prevent R from saving or restoring its environment (by default, R CMD BATCH does both), you can specify the --no-save and --no-restore options.

    +
    R CMD BATCH --no-save --no-restore main.R main.$(date +%F-%H:%M:%S).Rout
    +
    +
    +

    R

    +
    +

    If there are other commands, such as sink(), active in the R code, the main.Rout file will not contain some output.

    -
    +
    +
    +

    R

    +
    +

    To see more information, check the manual documentation by typing ?BATCH (or help(BATCH)) from within an R interactive session. Or by typing R CMD BATCH --help from the command line.

    +
    +
    +
    +

    MATLAB

    To automatically create a log file, run MATLAB from the command line as follows:

    -
    matlab -nodisplay -r "addpath(genpath('.')); main" -logfile matlab.log
    +
    matlab -nodisplay -r "addpath(genpath('.')); main" -logfile matlab.log
    +
    +
    +

    MATLAB

    A similar command on Windows would be:

    -
    start matlab -nosplash  -minimize -r  "addpath(genpath('.'));main"  -logfile matlab.log
    - -
    +
    start matlab -nosplash  -minimize -r  "addpath(genpath('.'));main"  -logfile matlab.log
    +
    +
    +

    Julia, Python

    In order to capture screen output in Julia and Python, on Unix-like system (Linux, macOS), the following can be run:

    -
    julia main.jl | tee main.log
    -

    or

    -
    python main.py | tee main.log
    +
    julia main.jl | tee main.log
    +

    which will create a log file with everything that would normally appear on the console using the tee command.

    +
    +
    +

    Julia, Python

    +

    In order to capture screen output in Julia and Python, on Unix-like system (Linux, macOS), the following can be run:

    +
    python main.py | tee main.log

    which will create a log file with everything that would normally appear on the console using the tee command.

    - - -

    Takeaways

    @@ -1062,12 +1095,11 @@

    Search paths

  • R: .libPaths()
  • -
    > .libPaths()
    -[1] "C:/Users/lv39/AppData/Local/R/win-library/4.3"         
    -[2] "C:/Users/lv39/AppData/Local/Programs/R/R-4.3.2/library"
    -   
    -
    - +
    > .libPaths()
    +[1] "C:/Users/lv39/AppData/Local/R/win-library/4.3"         
    +[2] "C:/Users/lv39/AppData/Local/Programs/R/R-4.3.2/library"
    +   
    +

    Search paths

    @@ -1078,17 +1110,16 @@

    Search paths

  • Python: sys.path
  • -
    >>> import sys
    ->>> from pprint import pprint
    ->>> pprint(sys.path)
    -['',
    - 'C:\\Users\\lv39\\AppData\\Local\\Programs\\Python\\Python312\\python312.zip',
    - 'C:\\Users\\lv39\\AppData\\Local\\Programs\\Python\\Python312\\DLLs',
    - 'C:\\Users\\lv39\\AppData\\Local\\Programs\\Python\\Python312\\Lib',
    - 'C:\\Users\\lv39\\AppData\\Local\\Programs\\Python\\Python312',
    - 'C:\\Users\\lv39\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages']
    -
    - +
    >>> import sys
    +>>> from pprint import pprint
    +>>> pprint(sys.path)
    +['',
    + 'C:\\Users\\lv39\\AppData\\Local\\Programs\\Python\\Python312\\python312.zip',
    + 'C:\\Users\\lv39\\AppData\\Local\\Programs\\Python\\Python312\\DLLs',
    + 'C:\\Users\\lv39\\AppData\\Local\\Programs\\Python\\Python312\\Lib',
    + 'C:\\Users\\lv39\\AppData\\Local\\Programs\\Python\\Python312',
    + 'C:\\Users\\lv39\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages']
    +

    Search paths

    @@ -1100,13 +1131,12 @@

    Search paths

  • Julia: DEPOT_PATH (Julia docs)
  • -
    julia> DEPOT_PATH
    -3-element Vector{String}:
    - "C:\\Users\\lv39\\.julia"
    - "C:\\Users\\lv39\\.julia\\juliaup\\julia-1.10.0+0.x64.w64.mingw32\\local\\share\\julia"
    - "C:\\Users\\lv39\\.julia\\juliaup\\julia-1.10.0+0.x64.w64.mingw32\\share\\julia"
    -
    - +
    julia> DEPOT_PATH
    +3-element Vector{String}:
    + "C:\\Users\\lv39\\.julia"
    + "C:\\Users\\lv39\\.julia\\juliaup\\julia-1.10.0+0.x64.w64.mingw32\\local\\share\\julia"
    + "C:\\Users\\lv39\\.julia\\juliaup\\julia-1.10.0+0.x64.w64.mingw32\\share\\julia"
    +

    “Yes, but what about Stata?”

    @@ -1139,44 +1169,41 @@

    The sysdir directories

    The default set of directories which can be searched, from a freshly installed Stata, can be queried with the sysdir command, and will look something like this:

    -
    sysdir
    +
    sysdir
    -
       STATA:  C:\Program Files\Stata18\
    -    BASE:  C:\Program Files\Stata18\ado\base\
    -    SITE:  C:\Program Files\Stata18\ado\site\
    -    PLUS:  C:\Users\lv39\ado\plus\
    -PERSONAL:  C:\Users\lv39\ado\personal\
    -OLDPLACE:  c:\ado\
    -
    -
    +
       STATA:  C:\Program Files\Stata18\
    +    BASE:  C:\Program Files\Stata18\ado\base\
    +    SITE:  C:\Program Files\Stata18\ado\site\
    +    PLUS:  C:\Users\lv39\ado\plus\
    +PERSONAL:  C:\Users\lv39\ado\personal\
    +OLDPLACE:  c:\ado\
    +

    The adopath search order

    The search paths where Stata looks for commands is queried by adopath, and looks similar, but now has an order assigned to each entry:

    -
    adopath
    +
    adopath
    -
      [1]  (BASE)      "C:\Program Files\Stata18\ado\base/"
    -  [2]  (SITE)      "C:\Program Files\Stata18\ado\site/"
    -  [3]              "."
    -  [4]  (PERSONAL)  "C:\Users\lv39\ado\personal/"
    -  [5]  (PLUS)      "C:\Users\lv39\ado\plus/"
    -  [6]  (OLDPLACE)  "c:\ado/"
    -
    -
    +
      [1]  (BASE)      "C:\Program Files\Stata18\ado\base/"
    +  [2]  (SITE)      "C:\Program Files\Stata18\ado\site/"
    +  [3]              "."
    +  [4]  (PERSONAL)  "C:\Users\lv39\ado\personal/"
    +  [5]  (PLUS)      "C:\Users\lv39\ado\plus/"
    +  [6]  (OLDPLACE)  "c:\ado/"
    +

    The path at work

    To look for a command, Stata will look in the first directory, then the second, and so on, until it finds it. If it does not find it, it will return an error.

    -
    which reghdfe
    +
    which reghdfe
    command reghdfe not found as either built-in or ado-file
     r(111);
    -
    -
    +

    Where are packages installed?

    @@ -1184,32 +1211,30 @@

    Where are packages installed?

    When we install a package (net install, ssc install)4, only one of the (sysdir) paths is relevant: PLUS.

    -
      [1]  (BASE)      "C:\Program Files\Stata18\ado\base/"
    -  [2]  (SITE)      "C:\Program Files\Stata18\ado\site/"
    -  [3]              "."
    -  [4]  (PERSONAL)  "C:\Users\lv39\ado\personal/"
    -  [5]  (PLUS)      "C:\Users\lv39\ado\plus/"
    -  [6]  (OLDPLACE)  "c:\ado/"
    -
    - +
      [1]  (BASE)      "C:\Program Files\Stata18\ado\base/"
    +  [2]  (SITE)      "C:\Program Files\Stata18\ado\site/"
    +  [3]              "."
    +  [4]  (PERSONAL)  "C:\Users\lv39\ado\personal/"
    +  [5]  (PLUS)      "C:\Users\lv39\ado\plus/"
    +  [6]  (OLDPLACE)  "c:\ado/"
    +

    Installing packages

    -
    ssc install reghdfe
    -which reghdfe
    +
    ssc install reghdfe
    +which reghdfe
    -
    . ssc install reghdfe
    -checking reghdfe consistency and verifying not already installed...
    -installing into C:\Users\lv39\ado\plus\...
    -installation complete.
    -
    -. which reghdfe
    -C:\Users\lv39\ado\plus\r\reghdfe.ado
    -*! version 6.12.3 08aug2023
    -
    -
    +
    . ssc install reghdfe
    +checking reghdfe consistency and verifying not already installed...
    +installing into C:\Users\lv39\ado\plus\...
    +installation complete.
    +
    +. which reghdfe
    +C:\Users\lv39\ado\plus\r\reghdfe.ado
    +*! version 6.12.3 08aug2023
    +

    Using environments in Stata

    @@ -1217,66 +1242,63 @@

    Using environments in Stata

    But the (PLUS) directory can be manipulated

    -
    * Set the root directory
    -global rootdir : pwd
    -* Define a location where we will hold all packages in THIS project (the "environment")
    -global adodir "$rootdir/ado"
    -* make sure it exists, if not create it.
    -cap mkdir "$adodir"
    -* Now let's simplify the adopath
    -* - remove the OLDPLACE and PERSONAL paths
    -* - NEVER REMOVE THE SYSTEM-WIDE PATHS - bad things will happen!
    -adopath - OLDPLACE
    -adopath - PERSONAL
    -* modify the PLUS path to point to our new location, and move it up in the order
    -sysdir set PLUS "$adodir"
    -adopath ++ PLUS
    -* verify the path
    -adopath
    -
    - +
    * Set the root directory
    +global rootdir : pwd
    +* Define a location where we will hold all packages in THIS project (the "environment")
    +global adodir "$rootdir/ado"
    +* make sure it exists, if not create it.
    +cap mkdir "$adodir"
    +* Now let's simplify the adopath
    +* - remove the OLDPLACE and PERSONAL paths
    +* - NEVER REMOVE THE SYSTEM-WIDE PATHS - bad things will happen!
    +adopath - OLDPLACE
    +adopath - PERSONAL
    +* modify the PLUS path to point to our new location, and move it up in the order
    +sysdir set PLUS "$adodir"
    +adopath ++ PLUS
    +* verify the path
    +adopath
    +

    Using environments in Stata

    -
    * Set the root directory
    -global rootdir : pwd
    -* Define a location where we will hold all packages in THIS project (the "environment")
    -global adodir "$rootdir/ado"
    -* make sure it exists, if not create it.
    -cap mkdir "$adodir"
    -* Now let's simplify the adopath
    -* - remove the OLDPLACE and PERSONAL paths
    -* - NEVER REMOVE THE SYSTEM-WIDE PATHS - bad things will happen!
    -adopath - OLDPLACE
    -adopath - PERSONAL
    -* modify the PLUS path to point to our new location, and move it up in the order
    -sysdir set PLUS "$adodir"
    -adopath ++ PLUS
    -* verify the path
    -adopath
    +
    * Set the root directory
    +global rootdir : pwd
    +* Define a location where we will hold all packages in THIS project (the "environment")
    +global adodir "$rootdir/ado"
    +* make sure it exists, if not create it.
    +cap mkdir "$adodir"
    +* Now let's simplify the adopath
    +* - remove the OLDPLACE and PERSONAL paths
    +* - NEVER REMOVE THE SYSTEM-WIDE PATHS - bad things will happen!
    +adopath - OLDPLACE
    +adopath - PERSONAL
    +* modify the PLUS path to point to our new location, and move it up in the order
    +sysdir set PLUS "$adodir"
    +adopath ++ PLUS
    +* verify the path
    +adopath
    -
    . adopath
    -  [1]  (PLUS)      "C:\Users\lv39\Documents/PROJECT123/ado/"
    -  [2]  (BASE)      "C:\Program Files\Stata18\ado\base/"
    -  [3]  (SITE)      "C:\Program Files\Stata18\ado\site/"
    -  [4]              "."
    -
    -
    +
    . adopath
    +  [1]  (PLUS)      "C:\Users\lv39\Documents/PROJECT123/ado/"
    +  [2]  (BASE)      "C:\Program Files\Stata18\ado\base/"
    +  [3]  (SITE)      "C:\Program Files\Stata18\ado\site/"
    +  [4]              "."
    +

    Using environments in Stata

    Let’s verify again where the reghdfe package is:

    -
    which reghdfe
    +
    which reghdfe
    -
    . which reghdfe
    -command reghdfe not found as either built-in or ado-file
    -r(111);
    -
    -
    +
    . which reghdfe
    +command reghdfe not found as either built-in or ado-file
    +r(111);
    +

    Using environments in Stata

    @@ -1284,29 +1306,28 @@

    Using environments in Stata

    Previously:

    -
    . which reghdfe
    -C:\Users\lv39\ado\plus\r\reghdfe.ado
    -*! version 6.12.3 08aug2023
    +
    . which reghdfe
    +C:\Users\lv39\ado\plus\r\reghdfe.ado
    +*! version 6.12.3 08aug2023
    -
    . adopath
    -  [1]  (PLUS)      "C:\Users\lv39\Documents/PROJECT123/ado/"
    -  [2]  (BASE)      "C:\Program Files\Stata18\ado\base/"
    -  [3]  (SITE)      "C:\Program Files\Stata18\ado\site/"
    -  [4]              "."
    -
    -
    +
    . adopath
    +  [1]  (PLUS)      "C:\Users\lv39\Documents/PROJECT123/ado/"
    +  [2]  (BASE)      "C:\Program Files\Stata18\ado\base/"
    +  [3]  (SITE)      "C:\Program Files\Stata18\ado\site/"
    +  [4]              "."
    +

    Installing packages when an environment is active

    When we now install reghdfe again:

    -
    . ssc install reghdfe
    -checking reghdfe consistency and verifying not already installed...
    -installing into C:\Users\lv39\Documents\PROJECT123\ado\plus\...
    -installation complete.
    -
    -. which reghdfe
    -C:\Users\lv39\Documents\PROJECT123\ado\plus\r\reghdfe.ado
    -*! version 6.12.3 08aug2023
    +
    . ssc install reghdfe
    +checking reghdfe consistency and verifying not already installed...
    +installing into C:\Users\lv39\Documents\PROJECT123\ado\plus\...
    +installation complete.
    +
    +. which reghdfe
    +C:\Users\lv39\Documents\PROJECT123\ado\plus\r\reghdfe.ado
    +*! version 6.12.3 08aug2023

    We now see it in the project-specific directory, which we can distribute with the whole project.

    @@ -1434,64 +1455,7 @@

    Consider

    A project with confidential and public-use data.

    -
    README.pdf
    -code/
    -    main.do
    -    01_data_prep.do
    -    02_confidential_prep.do
    -    03_analysis.do
    -    04_figures.do
    -data/
    -   raw/
    -      cps0001.dat
    -   confidential/
    -      ssa.csv
    -   conf_analysis/
    -      confidential_combined.dta
    -
    - -
    -
    -

    Organize your project so you can exclude confidential data

    -
    -
    -

    Clearly separate the restricted from the open-access data, both in terms of the raw data as well as the processed data:

    -
    -
    README.pdf
    -code/
    -    main.do
    -    01_data_prep.do
    -    02_confidential_prep.do
    -    03_analysis.do
    -    04_figures.do
    -data/
    -   raw/
    -      cps0001.dat
    -   confidential/
    -      ssa.csv
    -   conf_analysis/
    -      confidential_combined.dta
    -
    -
    -
    -
    -

    Strategy

    -

    When the replication package relies on confidential data that cannot be shared, or is shared under different conditions, you should

    - -
    -
    -

    Strategy

    -
    -
    -

    Prepare a confidential (partial) replication package project-confidential.zip, contains the contents of data/confidential and possibly data/conf_analysis.

    -
    -
    README.pdf
    +
    README.pdf
     code/
         main.do
         01_data_prep.do
    @@ -1505,16 +1469,15 @@ 

    Strategy

    ssa.csv conf_analysis/ confidential_combined.dta
    -
    -
    +
    -
    -

    Strategy

    +
    +

    Organize your project so you can exclude confidential data

    -

    Prepare a non-confidential replication package that contains all code, and any data that is not subject to publication controls

    +

    Clearly separate the restricted from the open-access data, both in terms of the raw data as well as the processed data:

    -
    README.pdf
    +
    README.pdf
     code/
         main.do
         01_data_prep.do
    @@ -1528,16 +1491,26 @@ 

    Strategy

    ssa.csv conf_analysis/ confidential_combined.dta
    -
    -
    +
    -
    +
    +

    Strategy

    +

    When the replication package relies on confidential data that cannot be shared, or is shared under different conditions, you should

    +
      +
    • preserve (archive) the confidential replication package +
    • +
    +
    +

    Strategy

    -

    Important: the package contains all code, including the code that is used to process the confidential data!

    +

    Prepare a confidential (partial) replication package project-confidential.zip, contains the contents of data/confidential and possibly data/conf_analysis.

    -
    README.pdf
    +
    README.pdf
     code/
         main.do
         01_data_prep.do
    @@ -1551,19 +1524,15 @@ 

    Strategy

    ssa.csv conf_analysis/ confidential_combined.dta
    -
    -
    +
    -
    +

    Strategy

    -
      -
    • Ensure that replicators have detailed instructions (README) on how to combine the two packages
    • -
    • Specify which (if any) of the results in their paper can be reproduced without the confidential data.
    • -
    +

    Prepare a non-confidential replication package that contains all code, and any data that is not subject to publication controls

    -
    README.pdf
    +
    README.pdf
     code/
         main.do
         01_data_prep.do
    @@ -1577,8 +1546,54 @@ 

    Strategy

    ssa.csv conf_analysis/ confidential_combined.dta
    -
    -
    +
    +
    +
    +

    Strategy

    +
    +
    +

    Important: the package contains all code, including the code that is used to process the confidential data!

    +
    +
    README.pdf
    +code/
    +    main.do
    +    01_data_prep.do
    +    02_confidential_prep.do
    +    03_analysis.do
    +    04_figures.do
    +data/
    +   raw/
    +      cps0001.dat
    +   confidential/
    +      ssa.csv
    +   conf_analysis/
    +      confidential_combined.dta
    +
    +
    +
    +

    Strategy

    +
    +
    +
      +
    • Ensure that replicators have detailed instructions (README) on how to combine the two packages
    • +
    • Specify which (if any) of the results in their paper can be reproduced without the confidential data.
    • +
    +
    +
    README.pdf
    +code/
    +    main.do
    +    01_data_prep.do
    +    02_confidential_prep.do
    +    03_analysis.do
    +    04_figures.do
    +data/
    +   raw/
    +      cps0001.dat
    +   confidential/
    +      ssa.csv
    +   conf_analysis/
    +      confidential_combined.dta
    +

    Questions

    @@ -1827,81 +1842,43 @@

    References

    }); - - -