Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Updated on SSC: listsome - List values of variables for some observations

    Thanks to Kit Baum, an updated version of listsome is now available from SSC. To update, use

    Code:
    adoupdate listsome
    To install, use

    Code:
    ssc install listsome
    Stata's list command does not provide a way to limit the number of observations listed when the if qualifier is used. There are ways to work around the problem but the maximum() option of listsome offers a quick and convenient solution.

    listsome is even more useful if you need to list a random sample of the observations in memory. For example,

    Code:
    sysuse auto, clear
    set seed 1651651
    listsome make-headroom if price < 10000 & mpg > 25, max(5) random
    is the equivalent of

    Code:
    preserve
    set seed 1651651
    gen sortorder = _n
    keep if price < 10000 & mpg > 25
    sample 5, count
    sort sortorder
    list make-headroom
    restore
    When working with datasets with lots of observations, it is impossible to visualize all cases. listsome makes it easy to add to the record (log file) a random sample that illustrates each data cleaning steps of a Stata project. A desirable data cleaning workflow should include
    • listing a number of observations that illustrates the problem at hand;
    • making a copy of the original variable to preserve the original;
    • implementing the solution, usually using a replace statement;
    • listing a number of observations that show the results of the change.
    listsome is much faster at drawing random samples than Stata's sample command because it does not alter or sort the data in memory. This new version includes faster code to draw random samples and a stand-alone version called randomtag is also available from SSC (type ssc install randomtag in Stata's command window to install).


    Last edited by Robert Picard; 04 Sep 2014, 10:02.
Working...
X