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

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: Length for strings, ignoring SMCL tags |

Date |
Tue, 2 Dec 2008 22:04:04 -0000 |

I see. If there's a cleverer way, it may well involve a very different approach, e.g. use of -_tab- (not that I've ever done that). Nick n.j.cox@durham.ac.uk Brian Karfunkel Thanks for the help so far, it's at least nice to know I'm not overlooking something that's easy. I'm trying to output a series of locals in a nice tabular format, with pipes (i.e. "|") between columns and a line of hyphens separating rows. So, I iterate through a list of rows and columns, etc., and ultimately have a string that contains the text for each row. For a 2X2 with Hello, World, Longval, and a blank as values that would be something like: local row1 "| Hello{col 10} | World{col 18} |" local row2 "| Longval{col 10} | {col 18} |" which outputs to: | Hello | World | | Longval | | (note that in fixed-char font the column dividers line up). The point is, the width of each column is set by the longest value in that column. However, if, say, only one value in a column is very long, I don't want to have that whole column be very wide, but rather want something like this as output: -------------------- | Test | Table | -------------------- | tst2 | Table | ------------------------------------------------------------- | Really abnormally long cell value | Table | ------------------------------------------------------------- | Test | Table | -------------------- The problem is getting the right number of hyphens to be displayed; I want as many hyphens in the row-separators as there are characters in the output row, which is just the length of the row as it is displayed. I can work around it by keeping track of the length of each component of the output row (e.g. "Test" is 4, " | " is 3, "Table" is 5, etc.), but I was hoping there was a less cumbersome way, though it doesn't seem that there is. * * 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**:**st: Length for strings, ignoring SMCL tags***From:*"Brian Karfunkel" <bkarfunkel@gmail.com>

**Re: st: Length for strings, ignoring SMCL tags***From:*"Austin Nichols" <austinnichols@gmail.com>

**RE: st: Length for strings, ignoring SMCL tags***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**Re: st: Length for strings, ignoring SMCL tags***From:*"Brian Karfunkel" <bkarfunkel@gmail.com>

- Prev by Date:
**Re: st: Length for strings, ignoring SMCL tags** - Next by Date:
**RE: st: ranking with weights** - Previous by thread:
**Re: st: Length for strings, ignoring SMCL tags** - Next by thread:
**Re: st: Length for strings, ignoring SMCL tags** - Index(es):

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