Thanks to Kit Baum, a new version of dataex (with Nick Cox) is now available from SSC.
dataex produces a data example in Stata's Results window that can be copied and pasted in a post on Statalist or shared elsewhere (e.g. in a query to Stata Tech Support). 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.
To update to the new version, type in Stata's Command window:
To install dataex for the first time, type
The new version simplifies value label definitions when multiple variables use the same value labels (thanks to Ana Maria Martinez and Joe Canner for noticing the issue in this post). The new version also checks that floating point values can be read back to within an epsilon (in proportion) of the original (1e-7 for a float, 1e-16 for a double). This ensures that all significant digits of very long identifiers are fully displayed. Finally, the dataex now aligns data in columns which makes it easier to visualize the data in a post.
Here's a quick example that lists the first 5 observations of Stata's standard auto dataset. The following shows what appears in Stata's Results window:
To use the data example in a Stata post, a user needs to copy from Stata's Results window everything that's in between the "---- copy ---" instruction lines (this includes the [CODE] and [/CODE] formatting instructions. When pasted in this post, the example appears as
dataex produces a data example in Stata's Results window that can be copied and pasted in a post on Statalist or shared elsewhere (e.g. in a query to Stata Tech Support). 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.
To update to the new version, type in Stata's Command window:
Code:
adoupdate dataex, update
Code:
ssc install dataex
Here's a quick example that lists the first 5 observations of Stata's standard auto dataset. The following shows what appears in Stata's Results window:
Code:
. clear . sysuse auto (1978 Automobile Data) . dataex in 1/5 ----------------------- copy starting from the next line ----------------------- [CODE] * Example generated by -dataex-. To install: ssc install dataex clear input str18 make int(price mpg rep78) float headroom int(trunk weight length turn displacement) float gear_ratio byte foreign "AMC Concord" 4099 22 3 2.5 11 2930 186 40 121 3.58 0 "AMC Pacer" 4749 17 3 3 11 3350 173 40 258 2.53 0 "AMC Spirit" 3799 22 . 3 12 2640 168 35 121 3.08 0 "Buick Century" 4816 20 3 4.5 16 3250 196 40 196 2.93 0 "Buick Electra" 7827 15 4 4 20 4080 222 43 350 2.41 0 end label values foreign origin label def origin 0 "Domestic", modify [/CODE] ------------------ copy up to and including the previous line ------------------ .
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str18 make int(price mpg rep78) float headroom int(trunk weight length turn displacement) float gear_ratio byte foreign "AMC Concord" 4099 22 3 2.5 11 2930 186 40 121 3.58 0 "AMC Pacer" 4749 17 3 3 11 3350 173 40 258 2.53 0 "AMC Spirit" 3799 22 . 3 12 2640 168 35 121 3.08 0 "Buick Century" 4816 20 3 4.5 16 3250 196 40 196 2.93 0 "Buick Electra" 7827 15 4 4 20 4080 222 43 350 2.41 0 end label values foreign origin label def origin 0 "Domestic", modify
Comment