Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: extract "describe" output/Variable window to Excel


From   Roger Newson <[email protected]>
To   [email protected]
Subject   Re: st: extract "describe" output/Variable window to Excel
Date   Mon, 10 Oct 2005 09:45:31 +0100

At 19:58 09/10/2005, Jake wrote:
Is there a way to do something like the following?

Export the contents of the Variable window, or better yet the
information yielded by the "describe" command, to a tab-delimited text file.

(Note that the contents of Review window can be easily extracted by
right-clicking that window, but that right-clicking the Variable window
does not permit the same operation.)

The idea is to get a spreadsheet with a row for each variable and with
at least the following two columns:

        the name of the variable

        explanation of  what the variable represents.

and ideally also the following columns:

        Storage type

        Display format

        Value label

My reason for wanting to export this information, rather than just looking
at it in the Results or Variable windows, is so that I can browse through
it, search in it (e.g., find all variables with "ffr" in their name),
and add other fields such as a column that simply numbers the variables
consecutively.
You should probably use the -descsave- package, downloadable from SSC, which produces an output dataset (or resultsset) with 1 observation per variable and data on the variable's order in the original dataset, name, storage type, format, value label, variable label and (optionally) characteristics. Having produced the resultsset, you can input it into memory using the -use- command and export it to a spreadsheet using the -outsheet- command. In Stata, type

ssc install descsave

to install -descsave-.

I hope this helps.

Roger



--
Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
Division of Asthma, Allergy and Lung Biology
King's College London

5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
or 020 7848 6605 International +44 20 7848 6605
Email: [email protected]
Website: http://phs.kcl.ac.uk/rogernewson/

Opinions expressed are those of the author, not the institution.

*
* 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