Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: RE: Creating a table with sample restriction specifics in headers


From   "Radwin, David" <dradwin@rti.org>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Creating a table with sample restriction specifics in headers
Date   Mon, 20 May 2013 13:22:39 -0400

Stephen,

I'm scarcely familiar with -estout- (Ben Jann, SSC) and -estimates
store-, but as for the first part of your question, you can use an
extended macro function to refer to a variable label. For example:

. sysuse auto
. display "`: variable label make'"

It's hard to tell from your example, but I think you actually want a
value label for each value of the numeric variable V7. There is a
different syntax for that:

. display "`: label (foreign) 1'"

In your code it might be:

. somecommand "`: label (V7) `l''"

That is the number 1 in the second to last example and the letter l in
the last example.

David
--
David Radwin
Senior Research Associate
Education Studies Division
RTI International
2150 Shattuck Ave., Suite 800
Berkeley, CA 94704
Phone: 510-665-8274

www.rti.org

> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
> statalist@hsphsun2.harvard.edu] On Behalf Of Stephen Cranney
> Sent: Monday, May 20, 2013 8:44 AM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: Creating a table with sample restriction specifics in
headers
> 
> Hi all,
> 
> I'm looping a regression over approximately a dozen countries X 3
> years= 21 different samples. Instead of going through and eyeballing
> each set of regressions one by one, I want to compile them all into a
> table and automatically head each table with the sample that that
> regression is limited to. The variable that restricts the sample is
> numeric, but the labels are string (CZ_08, for example, is the Czech
> Republic in 2008).  In other words, is there a way to create a macro
> from a variable label, and then directly input that macro into the
> header of an estout or estimates table.
> 
> levelsof V7, local(levels)
> foreach l of local levels {
>   ologit V36 V33 $demo if V7 == `l'
>   tab V6 if e(sample)==1
>   tab Year if e(sample)==1
>   est store
>  }
> 
> Thanks in advance,
> 
> Stephen
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index