*! version 0.31

Title

metadata -- Presenting metadata from one or more Stata datasets

Syntax

metadata
varlist
[using/]
[,
options]

Main
savein(string) Specify file to save metadata within. The
filename must have one of the suffix dta or one of the styles from the
style option.

The suffix overrules the style option below

keep Keep metadata in Data editor

nolog Do not show any output in the log

searchsubdirs If this option is set subdirectories are also
searched for dataset for which to include metadata. If not set only the specified
directory is searched for datasets

matprint options
style(string) Style for output. One of the values smcl (default),
csv (semicolon separated style),
latex or tex (latex style),
html (html style) or
md (markdown style)

caption(string) Caption for the output. Same as title

title(string) Title for the output. Same as caption.
title overwrites caption

top(string) String containing text prior to table content.
Default is dependent of the value of the style option

undertop(string) String containing text between header and table
content.
Default is dependent of the value of the style option

bottom(string) String containing text after to table content.
Default is dependent of the value of the style option

Description

metadata is a tool to get metadata of datasets without necessarily having
to load the datasets.

The using modifier can either a dataset or a directory as argument.

If a dataset is specified then the metadata of that dataset is presented in the
Result window, possibly saved in a specified dataset and possibly send Data
Editor window.

If a directory is specified then metadata of all datasets in that directory are
collected.

If further the option subdirectories is set then metadata in that directory as
well as all subdirectories are collected.

Examples

Below is a set of examples. You can copy the code and insert it in the
command window or you can just click once on each blue line below.
Then the command is automatically moved to the command window and executed.

Note that there is progression in the examples such a command line may require
some of the previous lines to show the intended properly.

First set up the log window to be wider:

`"set linesize 180"'

And get an example dataset:

`"sysuse auto, clear"'

metadata is similar discribe, however more meta values are reported:

`"metadata *"'

`"describe"'

If the variable xxx do not exist an error is returned:

`"metadata weight make xxx foreign"'

Subset of variables can chosen using classical notation:

`"metadata weight make foreign rep78"'

The same output in html:

`"metadata weight make foreign rep78, style(htm) caption(Output in HTML)"'

metadata can peep into other datasets whithout loosing the current
dataset:

`"metadata * using `"`c(sysdir_base)'c/census.dta"'"'

When metadata have a directory after using all datasets in that
directory as well as all subdirectories etc are added:

`"metadata * using `"`c(sysdir_base)'c"', savein(meta.dta, replace) keep"'

Option savein makes possible to save metadata in file and option
keep places the metadata in the Data Editor window.

One can limit the to a subset of variables, eg the ones starting with m:

`"metadata m* using `"`c(sysdir_base)'"', savein(meta.md, replace) searchsubdirs"'

The file metadata.md is saved in the present working directory and it
can be opened from there in your favorite editor.

Looking for subset of variables can be handy eg when one is looking for
keys to merge upon.

And one need not close the current data or save it in a file.

`"metadata m* using `"`c(sysdir_base)'"', searchsubdirs"'

To see more examples

Author and support

Author:

Niels Henrik Bruun,

Aalborg University Hospital

Support:

niels.henrik.bruun@gmail.com