Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Viewing variable labels and notes at the same time


From   Jorge Eduardo Pérez Pérez <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Viewing variable labels and notes at the same time
Date   Wed, 16 Mar 2011 18:57:24 -0400

This code will produce a sloppy table. Maybe other listers can improve
on this to produce a better formatted table using better  smcl

sysuse auto
note mpg : This is a note
quietly {
	nois di "VARIABLE  {tab} LABEL  {tab} NOTE"
	foreach x of varlist * {
		local `x'l: var label `x'
		notes _fetch `x'n : `x'	1
		nois di "`x'  {tab} ``x'l'  {tab} ``x'n' "
	}
}

Hope this helps
_______________________
Jorge Eduardo Pérez Pérez



On Wed, Mar 16, 2011 at 6:08 PM, Venable <[email protected]> wrote:
>
> Dear Statalist,
>
> Is it possible to view lists of variables that display both variable
> labels and notes at the same time?
>
> What I have in mind is something like the output one gets from
> display, except including any variable notes in the same line as the
> variable name, value label, variable label, etc. Currently, display
> shows an asterisk indicating that a given variable has notes - I
> suppose what I would like is for the actual note or notes to appear in
> place of the asterisk.
>
> For example:
>
> sysuse auto
> notes make: Test note 1 (make)
> notes price: Test note 2 (price)
> desc make price
>
> yields
>
>              storage  display     value
> variable name   type   format      label      variable label
> -------------------------------------------------------------------------------
> make            str18  %-18s                * Make and Model
> price           int    %8.0gc               * Price
>
> and what I would like to have is something like (with apologies for
> the formatting-by-hand)
>
> variable name    variable label   notes
> -------------------------------------------------------------------------------
> make      Make and Model         Test note 1 (make)
> price       Price                         Test note 2 (price)
>
>
>
> The reason I ask (in case there's a better way to address the problem)
> is that I use the variable label in tables and graphs, which requires
> using a fairly short label, but I also want to have information about
> the origin of a variable, which is better suited to a note.
>
> Many thanks in advance.
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index