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 on April 23, and its replacement, statalist.org is already up and running.


[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   Nick Cox <njcoxstata@gmail.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: RE: Creating a table with sample restriction specifics in headers
Date   Mon, 20 May 2013 20:13:32 +0100

No mystery here. The keywords are extended macro function and

. help extended_fcn

takes you to documentation. Alternatively, a small twist on David's code gives

local mylabel "`: variable label make'"

Nick
njcoxstata@gmail.com


On 20 May 2013 20:01, Stephen Cranney <scranney@sas.upenn.edu> wrote:

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

On Mon, May 20, 2013 at 1:22 PM, Radwin, David <dradwin@rti.org> wrote:

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