According to the "putdocx table" documentation, it should be possible to format cells in the table, as in line 10 in the script below.. E.g for means I get 7.861702 which I want to reduce to two decimal points. The loop works well, but when I try to format cells by inserting a nformat command (line 10) I get the error message "option not allowed".
Anybody know how to reduce number of decimals in this example?
I am using Stata SE 15.0
.
. forvalues i = 3/150{
2. putdocx paragraph, halign(left)
3. putdocx text ("Kommune `: label (K) `i''"), bold
4. foreach var in Fornøydhet Meningsfylt Ensom{
5.
. putdocx paragraph, halign(center)
6. putdocx text ("`var'")
7. preserve
8. statsby n=r(N) mean=r(mean) se=r(se) lb=r(lb) ub=r(ub), by(aldergr3) clear: ci mean `var' if K==`i'
9. putdocx table `var' = data("n mean se lb ub aldergr3"), varnames border(start, nil) border(insideV, nil) border(end, nil)
10. putdocx table `var'(2,3), nformat(%5.2f)
11.
.
. restore
12. }
13. }
(running ci on estimation sample)
command: ci mean Fornøydhet if K==3
n: r(N)
mean: r(mean)
se: r(se)
lb: r(lb)
ub: r(ub)
by: aldergr3
Statsby groups
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
...
option nformat(%5.2f) not allowed
Related Posts with Formatting cells putdocx table
Generating Mean Values for a variable based on 2 conditions in Panel DataHi, I have panel data of150+ companies for the years 2001-19. I have divided these years between pr…
Dropping duplicates takes more that 24 hr.Dear stata forum, I am quite new to Stata and I ran into an issue. I have panel data with quarterly…
Mixed logit modelHi All I am trying to calibrate a multilevel crash outcome analysis using a mixed logit model. The …
pwcorr display three starsI want display three stars if p<0.01, display two stars if p<0.05, display one star if p<0.…
Out of sample calculationsHello, I am looking for a solution to expand my matrices in Mata for some out of sample calculation…
Subscribe to:
Post Comments (Atom)
0 Response to Formatting cells putdocx table
Post a Comment