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
Problem interpolating data with mipolate with spline optionDear Nick Cox I believe I encounter a bug, or other wise unexpected behavior when trying to use the …
Treatment effect within a group. Implementation in Stata.Dear all, I have the following task. I want to estimate the effect of winning a particular auction o…
Specifying the start date of a generated time-series variableHi, What is the simplest method to count quarters from Feb 1972 to Apr 1993? I am generating a qua…
showing the significant star in the output of t-test using asdocHi, I am using asdoc command for the exporting the output and I have a question. I wonder how can we…
Specifying the start date of a generated time-seriesHi, What is the simplest method to count quarters from Feb 1972 to Apr 1993? I am generating a qua…
Subscribe to:
Post Comments (Atom)
0 Response to Formatting cells putdocx table
Post a Comment