Thanks to Kit Baum, a new command called dataex (with Nick Cox) is now available from SSC.
With dataex, you can produce a data example that you can then copy and paste in a post on Statalist. Readers will be able to easily recreate your dataset and note the exact variable type and content. Even date/time formatting and value labels are carried over.
dataex requires Stata version 9.2 or higher. To install, type
Providing a good data example increases the likelihood of getting an answer. Make sure that you have read the FAQ before posting. Aim for a small example of your data, just enough to explain your data structure, variable types and names. If your data contains proprietary identifiers, you can easily anonymize them using the egen group() function. For example,
will produce the following output, which is copied as is from Stata's Results window
The output already includes the correct tags to display the results in a code box.
With dataex, you can produce a data example that you can then copy and paste in a post on Statalist. Readers will be able to easily recreate your dataset and note the exact variable type and content. Even date/time formatting and value labels are carried over.
dataex requires Stata version 9.2 or higher. To install, type
Code:
ssc install dataex
Code:
sysuse auto egen makeid = group(make) dataex makeid rep78 price foreign if rep78 == 5
Code:
clear input float makeid int(rep78 price) byte foreign 27 5 3984 0 55 5 4425 0 4 5 9690 1 24 5 4589 1 34 5 5799 1 66 5 3798 1 67 5 5899 1 68 5 3748 1 69 5 5719 1 71 5 5397 1 74 5 11995 1 end label def origin 0 Domestic, modify label def origin 1 Foreign, modify label values foreign origin
Comment