Thanks to Kit Baum, an updated version of listsome is now available from SSC. To update, use
To install, use
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,
is the equivalent of
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
Code:
adoupdate listsome
Code:
ssc install listsome
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
Code:
preserve set seed 1651651 gen sortorder = _n keep if price < 10000 & mpg > 25 sample 5, count sort sortorder list make-headroom restore
- 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.