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
How to check panel model's robustnessGreetings! Please, kindly let me know how to conduct postestimation tests for panel model in order …
how to simplify when 2 do files have a lot of same contents?My 1st do file is (a much shorter version): Code: clear * use "/Users/zhaoyao/Documents/wiki/daily_…
How to store the beta/standardized coefficients after a regressionIs there a way to store the beta/standardized coefficients after a regression? For example, how can…
Student Course Enrollment Data (Long to Wide): Transpose, Reshape, Collapse?My data (student course enrollment) is currently in long form, and I would ideally like to reshape i…
HELP: Reshaping + Cleaning DataHello Statlist, I'm am currently working on reshaping the following dataset: Code: * Example gene…
Subscribe to:
Post Comments (Atom)
0 Response to Formatting cells putdocx table
Post a Comment