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

From |
Ben Jann <ben.jann@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: Re: Re: Re: Re: st: How to make certain variable names and related coefficients red in the word in the -estout-? |

Date |
Mon, 24 Aug 2009 22:06:04 +0200 |

If you want to use the same color for each label, you can use -varlabels(, prefix())- (documented in -help estout-). Example: sysuse auto, clear reg price weight mpg local colortbl "{\colortbl;\red255\green0\blue0;\red0\green0\blue255;}" esttab using test.rtf, replace /// title(`colortbl'Table 1: blah) /// varlabels(, prefix(\cf1)) /// cells(b(par("\cf1 " "")) t(par("\cf2 (" ")"))) If you need different colors, then the easiest way is to insert the color commands into the labels beforehand. Example: label variable weight "\cf1 `: variable label weight'" label variable mpg "\cf2 `: variable label mpg'" local colortbl "{\colortbl;\red255\green0\blue0;\red0\green0\blue255;}" esttab using test.rtf, replace /// title(`colortbl'Table 1: blah) /// label /// cells(b(par("\cf1 " "")) t(par("\cf2 (" ")"))) Note, however, that this permanently changes the labels. Alternatively, you could also use constructs such as "\cf1 `: variable label weight'" within -coeflabels()-. Example: sysuse auto, clear reg price weight mpg local colortbl "{\colortbl;\red255\green0\blue0;\red0\green0\blue255;}" esttab using test.rtf, replace /// title(`colortbl'Table 1: blah) /// coeflabels(weight "\cf1 `: variable label weight'" /// mpg "\cf2 `: variable label mpg'") /// cells(b(par("\cf1 " "")) t(par("\cf2 (" ")"))) However, I think the approach with manipulating the labels beforehand is more elegant. You could for example define list of variables and then use loops etc. such as local redlist "v1 v2 v3" local bluelist "v4 v5 v6" foreach var of local redlist { label variable `var' "\cf1 `: variable label `var''" } foreach var of local bluelist { label variable `var' "\cf2 `: variable label `var''" } ben 2009/8/24 <gjhxmu@sina.com>: > Ben, > I am sorry to bother you again. > I have generated labels for each variable in the dta. I can use -label- in the -estout- > easily to display variable labels instead of variable names in the left stub of the table. > However, in the typing you gave me, what I said before could be realized by > "coeflabels(weight "\cf1 weight" mpg "\cf2 mpg") ". > My question is whether I can realize my purpose without repeatedly typing > each label for each variable. > > Thank you very much for any help. > > Best regards, > Rose > > ----- Original Message ----- > From: Ben Jann <ben.jann@gmail.com> > To: statalist@hsphsun2.harvard.edu > Subject: Re: Re: Re: Re: st: How to make certain variable names and related coefficients red in the word in the -estout-? > Date: 2009-8-24 19:23:20 > > You need to use the -par()- suboption in estout's -cells()- option. > Here's an example: > > sysuse auto, clear > reg price weight mpg > local colortbl "{\colortbl;\red255\green0\blue0;\red0\green0\blue255;}" > esttab using test.rtf, replace /// > title(`colortbl'Table 1: blah) /// > coeflabels(weight "\cf1 weight" mpg "\cf2 mpg") /// > cells(b(par("\cf1 " "")) t(par("\cf2 (" ")"))) > > Coefficients will be in red, standard errors in blue. > > b(par("\cf1 " "")) encloses the coefficients in "\cf1 " and "" (note > that there is a blank after \cf1) > > t(par("\cf2 (" ")")) prints t-values and encloses them in "\cf2 (" and ")" > > ben > > 2009/8/21 <gjhxmu@sina.com>: >> Ben, >> thank you very much for your reply and help. >> I am out these two days, so forgive me for my late reply. >> Based on your typing, I can make the variable names and stats,such as r2_a, red or other colors >> I need. What I typing is to make the related coefficients to be the same colors, not just >> make the "Coef." red. >> For example, >> If the coefficient of mpg equals 2.1444, the figure 2.1444 should be red or some colors. >> >> Thank you very much for any help. >> >> Best regards, >> Rose. >> >> ----- Original Message ----- >> From: Ben Jann <ben.jann@gmail.com> >> To: statalist@hsphsun2.harvard.edu >> Subject: Re: Re: Re: st: How to make certain variable names and related coefficients red in the word in the -estout-? >> Date: 2009-8-19 05:33:18 >> >> makes no sense. Maybe you mean something like >> >> cells(b(label("{\cf1 Coef.}"))) >> >> Furthermore, >> >> stats(r2_a,labels(adj-R2 "{\cf1 adj-R2}")) >> >> should probably be >> >> stats(r2_a, labels("{\cf1 adj-R2}")) >> >> Check the syntax of the -cells()- and -stats()- options in -help estout-. >> ben >> >> 2009/8/18 <gjhxmu@sina.com>: >>> Ben, >>> thank you very much for your earnest explanation. I understood it now. >>> An additional doubt is that when I apply the colortbl to the coefficient or some other options >>> in the -esttab- stata shows an error "_{ invalid name". >>> >>> For example, >>> >>> sysuse auto, clear >>> reg price weight mpg >>> local colortbl "{\colortbl;\red255\green0\blue0;\red0\green0\blue255;}" >>> esttab using test.rtf, append title(`colortbl'Table 1: blah) /// >>> cells(b "{\cf1 weight}") stats(r2_a,labels(adj-R2 "{\cf1 adj-R2}")) /// >>> coeflabels(weight "{\cf1 weight}" mpg "{\cf2 mpg}") >>> >>> >>> Thank you a lot >>> >>> Best regards, >>> Rose. >>> ----- Original Message ----- >>> From: Ben Jann <ben.jann@gmail.com> >>> To: statalist@hsphsun2.harvard.edu >>> Subject: Re: Re: st: How to make certain variable names and related coefficients red in the word in the -estout-? >>> Date: 2009-8-18 03:08:47 >>> >>> "{\colortbl;...}" means "this is the color table". >>> >>> "red255\green0\blue0" means mix a RGB color with 255 red, 0 green, and >>> 0 blue (255 is maximum intensity). >>> >>> colors are specified one after another with a semicolon after each color. >>> >>> "\cf1" means "pick the first color, "\cf2" means "pick the second color" >>> >>> BTW: You could also type >>> >>> coeflabels(weight "\cf1 weight" mpg "\cf2 mpg") >>> >>> (that is, you can omit the curly braces; however, the curly braces are >>> needed for the color table). >>> ben >>> >>> 2009/8/17 <gjhxmu@sina.com>: >>>> Ben, >>>> thank you very much for your help. >>>> It works well, though I do not understand the typing clearly. >>>> >>>> Thank you. >>>> >>>> Best regards, >>>> Rose. >>>> >>>> ----- Original Message ----- >>>> From: Ben Jann <ben.jann@gmail.com> >>>> To: statalist@hsphsun2.harvard.edu >>>> Subject: Re: st: How to make certain variable names and related coefficients red in the word in the -estout-? >>>> Date: 2009-8-17 17:12:17 >>>> >>>> The issue with colors is that a color table has to be defined before >>>> the colors can be used in RTF. The main problem is how to get the >>>> color table into the document. Although not very elegant, you could >>>> use the -title()- option for this. Here is an example with blue and >>>> red: >>>> >>>> sysuse auto, clear >>>> reg price weight mpg >>>> local colortbl "{\colortbl;\red255\green0\blue0;\red0\green0\blue255;}" >>>> esttab using test.rtf, replace /// >>>> title(`colortbl'Table 1: blah) /// >>>> coeflabels(weight "{\cf1 weight}" mpg "{\cf2 mpg}") >>>> >>>> Another approach would be to hack esttab.ado and hardwire the color >>>> table in the beginning where the RTF preamble is defined. >>>> ben >>>> >>>> 2009/8/16 <gjhxmu@sina.com>: >>>>> Dear statalists, >>>>> >>>>> I have a question on the -esttab-. I want to esttab results to word. >>>>> Is there a way to make certain ?ariable names and related coefficients red in the word? >>>>> Or make the contents of -addnotes- option in the -esttab- red? >>>>> >>>>> Thank you very much for any help. >>>>> >>>>> >>>>> >>>>> Best regards, >>>>> >>>>> Rose. >>>>> >>>>> >>>>> * >>>>> * 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/ >>>> >>>> * >>>> * 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/ >>> >>> * >>> * 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/ >> >> * >> * 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/ > > * > * 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/

**References**:

- Prev by Date:
**st: Fw: Standardizing values** - Next by Date:
**Re: st: Stata 11 Random Effects--Std. Errors** - Previous by thread:
**Re: Re: Re: Re: Re: st: How to make certain variable names and related coefficients red in the word in the -estout-?** - Next by thread:
**Re: Re: Re: Re: Re: Re: st: How to make certain variable names and related coefficients red in the word in the -estout-?** - Index(es):

© Copyright 1996–2017 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |