Skip to content
François Briatte edited this page Feb 20, 2019 · 16 revisions

The SRQM course relies on the profile.do file located at the root of the SRQM folder. This do-file relies, in turn, on a set of ado-files located in the setup folder.

List of 'core' utilities, used to set up Stata for taking the course:

  • srqm: check the integrity of the course utilities
  • srqm_grab: add files to the course material by copying them from a remote source
  • srqm_link: link to the SRQM folder from the Stata application folder
  • srqm_pkgs: install Stata packages used in the course
  • srqm_scan: check the integrity of the course material (data and code)

List of additional utilities, used for testing the course material:

  • srqm_demo: run the course do-files
  • srqm_wipe: clean up common temporary files (wraps around wipe)

And last, some shorter utilities are grouped in the utils.ado file.

All commands above should be run from the SRQM folder.

In Stata, use which to get short descriptions of each utility. Alternatively, type srqm, v or srqm, verbose to get a complete description of the utilities located in the setup folder.

Workflow

When students type run profile after setting the working directory to the SRQM folder, the profile.do file located in the SRQM folder will do the following:

  1. Set global variables (macros), including $SRQM_WD (working directory)
  2. Open a 'course log' at srqm.log
  3. Configure Stata – set memory (Stata < 12), maxvars, more, etc.
  4. Check the integrity of the setup/, code/ and data/ course folders
  • done by the srqm_scan utility
  • includes routines to try recovering missing data files
  • if that fails, stop
  1. Link to the SRQM folder from the Stata application folder
  1. Check that all course-required packages are installed
  • done by the srqm_pkgs utility
  • some installed packages are not (yet) used in the course srqm_datamake.ado + srqm_datatrim.ado)
    • if fail, stop

COMMANDS

sbar

Experimental. Produces categorical plots that use colored gradients to draw the bars. Relies on Nick Cox's catplot command.

Type sbar_demo for an example, or see this blog post.

srqm_data

Prepares the course datasets from the original ones (if available). All datasets are saved in Stata 9/10 format for backward compatibility.

Uses the srqm_datamake and srqm_datatrim subroutines.

srqm_demo

Runs the course do-files, separately or sequentially.

  • Use the s() option to select the sessions to run, as in s(1/12) to run the entire course.
  • Use the test option to perform a clean run of the course that tests the require package calls
  • Use the wipe option to clean all workfiles at the end of the demo
  • You can log that command by passing a using argument to it.

srqm_grab

Downloads files from an online access point to the course folders. Sometimes used in class to distribute updated versions of the code, programs and slides for the course.

Compatibility:

  • The default access point is set to allow HTTP connexions only, which means that this utility should work with older versions of Stata (12-).
  • I was not able to support HTTPS connexions due to my server using an AES encryption scheme that is not supported by Stata 13.

Notes:

  • Formerly called srqm_copy.
  • [TOFIX] Type srqm_get demo.do for an example.

srqm

Signs the architecture of the SRQM folder, a.k.a the 'Teaching Pack', by checking that all course utilities are present in the folder, and by printing information related to the four global macros used by the course:

  • $SRQM_WD: path to the SRQM folder
  • $SRQM_FOLDERS: names of the code, data and setup folders
  • $SRQM_DATASETS: names of the datasets stored in the data folder and used by the course do-files
  • $SRQM_PACKAGES: names of the Stata packages used by the course do-files

Notes:

  • [TODO]: if not, download them from SRQM remote access point?

srqm_link

Checks whether Stata is being told to automatically run from the SRQM folder by checking the folder path to the global macro $srqm_wd. If this is not the case, the macro is written into a profile.do file located in the Stata application folder.

The profile.do file saved to the Stata application folder acts as a symbolic link that also runs the profile.do file from the SRQM folder, which modifies some Stata settings and performs further integrity checks on the course setup with srqm_scan and srqm_pkgs.

Compatibility:

  • This command was written back in the days when Stata 11 (and possibly Stata 12) did not have an option to start in the last session's current working directory.
  • On Windows Vista and above, the command requires running Stata as administrator, or it will fail due to a system restriction in recent versions of Windows.

srqm_pkgs

Checks whether the additional Stata packages used in the course do-files have been installed and installs them if necessary.

Compatibility:

  • The command requires an Internet connexion.
  • The command relies on the pkgs utility located in utils.ado.

Notes:

  • The course packages include the burd graph scheme, which was developed for the course.
  • The command tries to run as quickly as possible by skipping packages that are already installed.
  • When necessary, the command will try to bypass admin restrictions by cycling through several install locations.

srqm_scan

Checks whether the data and code folders exist in the SRQM folder, and restores the course datasets from their ZIP archives if they have been deleted.

Folder-by-folder details:

  • code: check all course do-files are present
    • [TOFIX] if not, tries to download them via srqm_grab
    • [TODO] use GitHub as last-resort access point?
  • data: check all course datasets are present
    • if not, unzip the backup copy (routine: srqm_scan.ado)
    • if no backup copy, try to assemble from source (routine: srqm_data + do-files in data/ folder)

srqm_wipe

Cleans up the SRQM folder by erasing temporary workfiles (logs and tables) produced by the course do-files.

stab

Produces summary statistics and correlation matrix tables in plain text format, for maximum compatibility with external editors like Google Documents. Relies on Ben Jann's estout command.

Type stab_demo for an example, or see this blog post.

utils

Undocumented shortcut commands that slightly modify the behaviour of a few built-in Stata commands.

  • find: a quicker lookfor command.
  • load: a quicker use command.
  • pkgs: determines whether a folder can be used to install Stata packages
  • science: Easter egg
  • updates: updates all installed packages
  • wipe: clean up temporary files
Clone this wiki locally