Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: -dlist- available on SSC


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: -dlist- available on SSC
Date   Wed, 8 Feb 2006 15:47:02 -0000

Thanks to Kit Baum, a -dlist- package containing 
a command of that name has been added to SSC. 

Stata 8.2 is required. 

-dlist- arose from a question asked privately by 
Miguel Ampudia Fraile. 

-dlist- is a listing command. The -d- element 
is meant to evoke -describe-. The motivation 
for -dlist- is that on occasion you may wish
to look simultaneously at variable names, 
variable values and variable labels. For example, 
variable names may be cryptic to some degree, 
especially if the dataset is new or unfamiliar to 
you or large or complicated. Ideally, a cryptic 
variable name will be made clear by a variable 
label. 

I may well be missing something, but I couldn't 
think of a way to do this. -codebook- seems
to come closest. In -edit- variable labels are a click 
away, but the price is that and often the need to 
scroll horizontally. 

Reminding ourselves of what -list- does

. sysuse auto, clear
(1978 Automobile Data)

. list in 1 

     +-------------------------------------------------------------------------------+
  1. | make        | price | mpg | rep78 | headroom | trunk | weight | length | turn |
     | AMC Concord | 4,099 |  22 |     3 |      2.5 |    11 |  2,930 |    186 |   40 |
     |-------------------------------------------------------------------------------|
     |        displa~t         |         gear_r~o         |          foreign         |
     |             121         |             3.58         |         Domestic         |
     +-------------------------------------------------------------------------------+

and what -describe- does

. d 

Contains data from C:\Program Files\Stata9\ado\base/a/auto.dta
  obs:            74                          1978 Automobile Data
 vars:            12                          13 Apr 2005 17:45
 size:         3,478 (99.9% of memory free)   (_dta has notes)
-------------------------------------------------------------------------------
              storage  display     value
variable name   type   format      label      variable label
-------------------------------------------------------------------------------
make            str18  %-18s                  Make and Model
price           int    %8.0gc                 Price
mpg             int    %8.0g                  Mileage (mpg)
rep78           int    %8.0g                  Repair Record 1978
headroom        float  %6.1f                  Headroom (in.)
trunk           int    %8.0g                  Trunk space (cu. ft.)
weight          int    %8.0gc                 Weight (lbs.)
length          int    %8.0g                  Length (in.)
turn            int    %8.0g                  Turn Circle (ft.) 
displacement    int    %8.0g                  Displacement (cu. in.)
gear_ratio      float  %6.2f                  Gear Ratio
foreign         byte   %8.0g       origin     Car type
-------------------------------------------------------------------------------
Sorted by:  foreign

This is what -dlist- does: 

. dlist in 1

1.
make           Make and Model            AMC Concord       
price          Price                     4,099
mpg            Mileage (mpg)             22
rep78          Repair Record 1978        3
headroom       Headroom (in.)            2.5
trunk          Trunk space (cu. ft.)     11
weight         Weight (lbs.)             2,930
length         Length (in.)              186
turn           Turn Circle (ft.)         40
displacement   Displacement (cu. in.)    121
gear_ratio     Gear Ratio                3.58
foreign        Car type                  Domestic

That might be useful for looking at just a few observations. 

By default, you get variable names, labels and values. 
There are a few options for tweaking output. Perhaps 
the most useful is scope for abbreviating names and 
variable labels and even suppressing them: 

. dlist in 1, name(0)

1.
Make and Model            AMC Concord       
Price                     4,099
Mileage (mpg)             22
Repair Record 1978        3
Headroom (in.)            2.5
Trunk space (cu. ft.)     11
Weight (lbs.)             2,930
Length (in.)              186
Turn Circle (ft.)         40
Displacement (cu. in.)    121
Gear Ratio                3.58
Car type                  Domestic

Nick 
[email protected] 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index