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: RE: Creating a table with sample restriction specifics in headers
From
Stephen Cranney <[email protected]>
To
[email protected]
Subject
Re: st: RE: Creating a table with sample restriction specifics in headers
Date
Mon, 20 May 2013 15:01:39 -0400
Thanks David; I guess I'm wondering how to turn that label into a
macro. Once I do that I can re-label the dependent variable in each
loop, then the sample limitation will appear at the top of each table
naturally. So I guess the question is, how do I use the display (or
any other command) to turn the label into a local (or global) macro
that I can refer to later on?
Best,
Stephen
On Mon, May 20, 2013 at 1:22 PM, Radwin, David <[email protected]> wrote:
> 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: [email protected] [mailto:owner-
>> [email protected]] On Behalf Of Stephen Cranney
>> Sent: Monday, May 20, 2013 8:44 AM
>> To: [email protected]
>> 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/
--
Stephen Cranney
PhD Student
Graduate Group in Demography
University of Pennsylvania
*
* 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/