Stata Technical Bulletin
11
Stata would have problems, however, if the same data arrangement appeared in a dictionary file:
. type ini. det
dictionary {
int xl
int x2
int x3
}
11 12 13
21 22
23 31 32 33
. infile using ini
dictionary
int xl
int x2
int x3
(4 observations read)
list |
xl |
x2 |
x3 |
1. |
11 |
12 |
13 |
2. |
21 |
22 | |
3. | |||
4. |
23 |
31 |
32 |
Stata’s dictionary files are the preferred form for storing and documenting raw data. The dictionary subcommands can handle
most kinds of formatted data including multi-line records and data sets without carriage returns ([5d] infile). Nonetheless, Murphy’s
law guarantees that you will occasionally confront data sets that confound Stata’s dictionary capabilities. More commonly, you
will have a data set that Stata’s dictionary features can handle but only with difficulty. Clearly, life would be simpler if all raw
data sets were rectangular, as in the first example.
I have written a C program called block that makes my life simpler. block takes an arbitrary ASCII file as input and
produces as output the same information arrayed rectangularly. The following example illustrates how to use block.
C:> type ini
11 12 13
21 22
23 31 32 33
C:> block
Name of the input file: ini
Name of the output file: outl
Number of columns: 3
Read in 9 fields from ini
Wrote out 3 rows of 3 columns to outl
C:> type outl
11 12 13
21 22 23
31 32 33
block handles non-rectangular data gracefully:
C:> type in2
11 12 13
21 22
23 31 32 33 44
C:> block
Name of the input file: in2
Name of the output file: out2
Number of columns: 3
Read in 10 fields from in2
Wrote out 3 rows of 3 columns to out2
WARNING: last row not complete.
C:> type out2
11 12 13
21 22 23
31 32 33
44
More intriguing information
1. Real Exchange Rate Misalignment: Prelude to Crisis?2. Does adult education at upper secondary level influence annual wage earnings?
3. TLRP: academic challenges for moral purposes
4. CAPACITAÇÃO GERENCIAL DE AGRICULTORES FAMILIARES: UMA PROPOSTA METODOLÓGICA DE EXTENSÃO RURAL
5. The Impact of EU Accession in Romania: An Analysis of Regional Development Policy Effects by a Multiregional I-O Model
6. PRIORITIES IN THE CHANGING WORLD OF AGRICULTURE
7. Visual Artists Between Cultural Demand and Economic Subsistence. Empirical Findings From Berlin.
8. Spatial patterns in intermunicipal Danish commuting
9. Education Research Gender, Education and Development - A Partially Annotated and Selective Bibliography
10. Modelling Transport in an Interregional General Equilibrium Model with Externalities