Using commas within cells in tbl

Using commas within cells in tbl

by Logan Pierce -
Number of replies: 1

Hi,

I am trying to get certain numbers (and strings of text) into a table using the tbl command, but when those numbers or strings have commas they get divided into two different cells. For example, I want two cells containing the values "5,240" and "Encounters, mean". However, the following code:


local test : di %5.0fc 5240

tbl ( `test', "Encounters, mean")


shows four cells:

  5  |  240  |  Encounters  |  mean


How do I show fields with commas within an individual cell?

In reply to Logan Pierce

Re: Using commas within cells in tbl

by Kristen -

Unfortunately, it looks like there is no way to include a comma in the output, at least as much as I could tell from googling around. 

I don't think that tbl is the greatest option for your use as future research scientists as the code is a bit clunky and there is not a lot of help info out there. table1, tabout and outreg are all better options


That being said, it is fine to use for your final project. 


If you want to include a comma in a Markdoc table, you can use markdown syntax to include a table as a comment. The table can have commas like in the following example, but the problem is that it is not dynamic (it does not auto-populate)


Example .do file here:

 https://github.com/haghish/markdoc/blob/master/Examples/tbl/tbl1.do


This website generates LaTeX or markdown syntax for tables. But again, the problem is that it is not dynamic: 

https://www.tablesgenerator.com