Indirect Standardization
Encyclopedia of Epidemiology · 2008
Data dictionaries are an effective way to import and export data: The data are transported in an ASCII text file (a reliable mechanism on any reasonable computing platform), and the dictionary itself provides a clear description of the contents of the data file.(See [R] infile (fixed format) for details.)More importantly, dictionaries can be freely commented: any line with the character '*' in the first column will be ignored by the infile command when it uses the dictionary to read the data.Comments can thus be used to document the source of the data, or to explain details regarding the collection of the data-information that ought to remain attached to the data.This insert presents a command (infilen) that creates a Stata dataset by infiling from a fixed format data file, captures commentary from the data dictionary, and stores those comments as notes; see [R] notes.To illustrate, consider the file mammals.dat(included with this insert) which begins thus: dictionary { *! Data originally published by Allison, T. & Cicchetti, D. V. (1976) *! , as part of a study of correlates of sleep in *! mammals a subset (the first 3 variables below) appears inTable 6.6 of *! Weisberg (1985) .*! *!The data show average values for 62 species of mammals note that some *! values are missing.The last 3 variables below (is_prey, expos_sl, and *! indanger) are ordered categories, where 1 = least and 5 = most with *! respect to the attribute in question.Note also that slow wave sleep *! (swav_sl) is known as `non-dreaming' sleep, whereas paradoxical sleep *! (pdox_sl) is known as `dreaming' sleep.* str25 species "Mammal species" body_wt "Body Weight (kg)" brain_wt "Brain Weight (g)" swav_sl "Slow wave sleep (hrs/day)" pdox_sl "Paradoxical sleep (hrs/day)" totsleep "Total sleep (hrs/day)" lifespan "Maximum life span (yrs)" gestate "Gestation time (days)" byte is_prey "Likely to be preyed upon?" byte expos_sl "Exposed during sleep?"byte indanger "In danger from other animals?"} "African elephant" 6654 5712 . .