I am making some report using -putdocx- command.
My data is like following result table.
Code:
clear
set obs 1
gen year = "Disbursement"
gen y2017 = 10000
gen y2018 = 11000
egen total = rowtotal(y2017 y2018)
format %9.0fc y2017 y2018 total
putdocx begin
putdocx paragraph
putdocx table tbl1 = data("year y2017 y2018 total"), varnames
putdocx save tbl1.docx, replace
but I know Stata don't allow a number on the first.
So, I changed the data with some trick.
Code:
tostring _all, replace
set obs 2
replace year = "year" if year == ""
replace y2017 = "2017" if y2017 == ""
replace y2018 = "2018" if y2018 == ""
replace total = "total" if total == ""
gsort -year
putdocx begin
putdocx paragraph
putdocx table tbl1 = data("year y2017 y2018 total")
putdocx save tbl1.docx, replace
but I lost a comma in the disbursement part.
The first code shows 10,000 form, but the second shows 10000 form.
I want to this following form, with comma in the disbursement.
| year | 2007 | 2008 | total |
| Disbursement | 10,000 | 11,000 | 21,000 |
AND,
Do you know how to use a font style when -putdocx- make out a table?
I can find the using font on paragraph and text, but I can't find on table.
Please give me your idea.
0 Response to [putdocx] problem about tostring with comma, table font
Post a Comment