Statalist The Stata Listserver


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

Re: st: display output in columns of a table


From   "Tom Boonen" <[email protected]>
To   [email protected]
Subject   Re: st: display output in columns of a table
Date   Tue, 12 Sep 2006 14:15:17 -0400

Ah...this works well. Thank you very much Nick Winter!


On 9/12/06, Nick Winter <[email protected]> wrote:
The solution is not really to do them in columns, but rather to indent
the second (and subsequent) lines enough that it looks like you've got
columns.

You want to do something like:

di "{p 0 3 0}B: {res}`blist'"

This will format the results as a paragraph with the first line indented
zero, the second (and subsequent lines) indented 3, and the right-side
indented zero.

See

. help smcl##paragraph_mode

for a discussion of the smcl {p} directive.

--Nick Winter

Tom Boonen wrote:
> Hi List,
>
> I have a question on how to use SMCL to display output of my
> program in aligned columns of a table. My code reads:
>
> di as txt "{hline}"
> di "A: {res}`alist' "
> di "B: {res}`blist' "
> di "C: {res}`clist' "
> di as txt "{hline}"
>
> Here `arlist' , `blist' , and `clist' are numlists entered by the
> user. Since `colist' is too long to fit in a single line it overflows
> to the next line on the screen. Output looks like this:
>
> ------------------------------------------------------------------------------------------------------
>
> A: 3
> B: 1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
> 27 28 29 30 31 32 33 34 35 36 37 38 39
> C: 4 5 6
> ------------------------------------------------------------------------------------------------------
>
>
> Is there any way to display my output in columns of a table instead.
> In my case this would be a two column table, where A, B, and C would
> go in the first column and the respective numbers in the lists would
> go in the second column.
>
> The difference would be that the numbers in `blist' that overflow into
> the next line are not displayed below B but remain correctly aligned.
>
> Thanks a lot!
>
> Tom
> *
> *   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/

--
--------------------------------------------------------------
Nicholas Winter                                 434.924.6994 t
Assistant Professor                             434.924.3359 f
Department of Politics                  [email protected] e
University of Virginia          faculty.virginia.edu/nwinter w
PO Box 400787, 100 Cabell Hall
Charlottesville, VA 22904

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

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