Stata Technical Bulletin
The basic command, ‘brin gin filename ’, chooses the first (F4 ) bmemsize option, that is, it attempts to balance the number
of variables and observations that can be added after the data rectangle is resized and filename, dta is loaded. The optional
keyword vars selects the second (F5) option, which maximizes the number of variables that can be added. The optional keyword
obs selects the third (F6) option, which maximizes the number of observations that can be added.
bringin may be most useful in do-files that are designed to be run by others, particularly when the others are not experienced
Stata users. To make it easy to modify your existing do-files, bringin ignores any commas and options. As a consequence, you
can safely globally replace use with bringin in your do-files. For example, changing the line
. use myfile, clear
to
. bringin myfile, clear
will cause no problems. bringin assumes the clear option, so ignoring the typed option does not change the meaning of the
command.
bringin uses the bmemsize command, hence it can only be used with Intercooled Stata. If you are not running Intercooled
Stata, change bmemsize to memsize in bringin.ado, and the program will work as described.
dm22 Sorting in descending order
David Mabb, Health Services Advisory Group Inc., FAX 602-241-0757
Stata’s sort command supports sorting only in ascending order. Often it is beneficial to observe data in descending order.
sortd provides a way to sort variables in descending order. The syntax of sortd is
sortd varlist [ in range ]
sortd offers the same features as Stata’s internal sort command. In fact, the sorting is performed by the sort command,
making sortd very fast. Aside from reversing the order of the sort, there is one difference between sort and sortd: the data
set is not marked as sorted when sortd is used. As a consequence, the by prefix and similar constructions cannot be used
following the sortd command.
Example
. use ∖stata∖census, clear
(1980 Census data by state)
. sort pop
list state pop in f/6 | ||
state |
PoP | |
1. |
Alaska |
4018εi |
2. |
Wyoming |
469εε7 |
3. |
Vermont |
611466 |
4. |
Delaware |
894338 |
ε. |
N. Dakota |
682717 |
list |
state pop in |
-ε∕ι |
state |
p°p | |
46. |
Illinois |
11426618 |
47. |
Pennsylvania |
1186389ε |
48. |
Texas |
14229191 |
49. |
New York |
17εε8072 |
50. |
California |
23667902 |
sortd pop | ||
list |
state pop in |
f∕ε |
state |
PoP | |
1. |
California |
23667902 |
2. |
New York |
17εε8072 |
3. |
Texas |
14229191 |
4. |
Pennsylvania |
11863896 |
ε. |
Illinois |
11426618 |