Stata Technical Bulletin
STB-22
Contains data
Obs: 32200
Vars: 3
Width: 12
1. x
2. y
3. group
Sorted by:
float 7.9.0g
float 7.9.0g
float 7.9.0g
. use test
no room to add more observations
r(901) ;
Example large data set
Grouping variable
If there is actually enough memory to handle the data set, you can convince Stata to use the data by (1) clearing any data
currently in memory, (2) using the set maxvar or set maxobs command to resize the data rectangle, and (3) bringing the data
set into memory. For example:
. drop _all
. set maxobs 32300
. use test
(Example large data set)
This process is annoying for the experienced user and baffling for the novice. Stata makes the process a little easier
by supplying the memsize and bmemsize commands for regular and Intercooled Stata, respectively. (See [4] memory.) These
commands analyze the data set and make educated guesses about the best way to resize the data rectangle. In addition, they
load macros for performing the resizing into the function keys F4, F5, and F6. For example, instead of resetting the maximum
number of observations as in the example above, we could
. bmemsize using test
variables : width: observations : data will not fit in current command |
3 12 32200 377 к | |||
partition approx. |
free float |
free obs | ||
(F4) |
— set maxvar 30 width 39 |
104717 |
6 |
— 72517 |
(F5) |
set maxvar 116 width 125 |
32672 |
28 |
472 |
(F6) |
set maxvar 23 width 32 |
127625 |
5 |
95425 |
At this point, pressing F4 would issue the command set maxvar 30 width 39, pressing F5 would issue the command set
maxvar 116 width 125, and pressing F6 would issue the command set maxvar 23 width 32. The first option (F4) attempts
to balance the number of observations and variables that can be added after the data rectangle is resized. The second option
(F5) attempts to maximize the number of variables that can be added. The third option (F6) attempts to maximize the number
of observations that can be added.
While memsize and bmemsize are helpful, they do not go far enough, particularly for the novice Stata user. bringin is
my attempt to completely automate the process of loading a new data set, regardless of shape or size. The syntax is
bringin filename [ { vars ∣ obs } ]
bringin is actually a “wrapper” for the bmemsize command. bringin silently runs bmemsize, executes one of the three
options, then uses the specified data set. For instance:
. bringin test
(Example large data set)
. describe
Contains data from test.dta
0bs: 32200 (max= 94750)
Vars: 3 (max= 29)
Width: 12 (max= 40)
Example large data set
1. x
2. y
3. group
Sorted by:
float %9.0g
float %9.0g
float %9.0g
Grouping variable