*! version 0.2 8Nov2023

help for metaxl apply

Title

metaxl apply - applies metadata to data in memory

Syntax

metaxl apply
, metafile(fn) [options]

Options
* metafile(fn) is name of the Excel file where the
metadata is stored.

dofile(fn) saves a do-file with all the code used to apply the metadata.

chars applies information about variables and data characteristics.
The default behavior is to not apply characteristics to variables and data.

notes applies information about variables and data notes.
The default behavior is to not apply notes to variables and data.

truncate truncates variables and value labels names if their
length is larger than 25 and 27 characters, respectively.

nobackup changes the default behavior of saving a backup of the
metadata in memory to a file (_bk_meta.xlsx). With this option the backup
file is not created meaning that the changes to the metadata cannot be reversed.

* required

Description

metaxl apply is a Stata command that applies metadata stored in an Excel file
to data in memory. The command assumes that the Excel file has the structure of the
file produced by metaxl extract. Moreover, the command will
only apply the metadata after checking its integrity (see metaxl check).

The command removes all the metadata in memory before applying the new metadata
(see metaxl clear). A backup file (_bk_meta.xlsx)
containing the previous metadata is saved in the current working directory
to guard against unintended usage consequences. It is also worth
mentioning that some of the metadata might no be applied to your data. This
includes metadata generated automatically by Stata and usually concerns
characteristics that start with "_". So we suggest that users do not define
characteristics that follow that pattern.

Examples

Apply metadata from file meta_auto.xlsx to data in memory.

. metaxl apply, meta(metafile)

Apply metadata from file meta_auto.xlsx to data in memory. Save the code
used to apply the metadata in apply.do

. metaxl apply, meta(metafile) do(apply)

Remarks

Please notice that this software is provided "as is", without warranty of any kind, whether
express, implied, or statutory, including, but not limited to, any warranty of merchantability
or fitness for a particular purpose or any warranty that the contents of the item will be error-free.
In no respect shall the author incur any liability for any damages, including, but limited to,
direct, indirect, special, or consequential damages arising out of, resulting from, or any way
connected to the use of the item, whether or not based upon warranty, contract, tort, or otherwise.

Dependencies

gtools package by Mauricio Bravo

Author

BPLIM, Banco de Portugal, Portugal.

Email: bplim@bportugal.pt

We appreciate your feedback. Comments are welcome!