Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: SImple question on "describe"


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: SImple question on "describe"
Date   Wed, 21 Jun 2006 09:01:51 +0100

This fires up -ds- just to get a varlist. -ds- is several 
dozens of lines of code to interpret. Normally that is trivial, but 
you can get there in one. 

program ds_varlab
	version 8.2 
	syntax varlist 
	foreach var of local varlist {
		di "`var'" _col(36) `"`: variable label `var''"'
	}
end

I also used compound double quotes, for the odd occasion
when the variable label includes " " characters. 

Nick 
n.j.cox@durham.ac.uk 

Philip Ryan
 
> oops... in my little example, the call to the program should, 
> of course, 
> be  ds_varlab  not   d_var.
 
> >In answer to your first question, perhaps:
> >
> >====== save this as ds_varlab.ado =========
> >program ds_varlab
> >quietly ds
> >foreach var of varlist `r(varlist)' {
> >di "`var'" _col(36) "`: variable label `var''"
> >}
> >end
> >=======================================
> >
> >. sysuse auto, clear
> >. d_var                                         <== make 
> that ds_varlab !
> >
> >make                         Make and Model
> >price                        Price
> >mpg                          Mileage (mpg)
> >rep78                        Repair Record 1978
> >headroom                     Headroom (in.)
> >trunk                        Trunk space (cu. ft.)
> >weight                       Weight (lbs.)
> >length                       Length (in.)
> >turn                         Turn Circle (ft.)
> >displacement                 Displacement (cu. in.)
> >gear_ratio                   Gear Ratio
> >foreign                      Car type

Buddy 

> >>I've checked the user's guide, programming and the
> >>reference guide.  I want to use describe and only want
> >>the variable name and variable label - not the other
> >>information.  Also, when I use a table command - I
> >>would like to see BOTH the variable name and the
> >>variable label - is this possible?

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index