Logo

Data and Code Guidance by Data Editors

Guidance for authors wishing to create data and code supplements, and for replicators.

Sample code to generate descriptive statistics

Stata

In Stata,the native ‘codebook’ command can generate such information:

// Stata
use my_input_data
describe
codebook

See code/01_codebook_fancy.md for a fancier example, and code/02_codebook_plaintext.md for the code and output from the simpler example.

R

In R, the dataMaid [1], [2] can accomplish a similar task:

# use the    dataMaid   package
library(dataMaid)
makeCodebook(my_input_data)

See code/03_codebook_dataMaid for an example.

SAS

In SAS, PROC CONTENTS and PROC MEANS may very well provide all that is needed:

proc contents;
proc means;
run;

See code/04_codebook_SAS for an example.