- Stata manual
- -file- - Read and write text and binary files
- Slaymaker (2005).Using the file command to produce formatted output for other applications
- -display- - Display strings and values of scalar expressions
- -log- - Echo copy of session to file
- Saving and printing output - log files
- -outfile- - Export dataset in text format
- UCLA: How do I use to write results or other information to an external text file?
- Example:
- cap program drop coeftab
- program coeftab
- args per dec wth
- #del ;
- if "`per'"=="" {; local per=100; };
- if "`dec'"=="" {; local dec=2; };
- if "`wth'"=="" {; local wth=4; };
- #del cr
- mat R=r(table)'
- mat rtable=R[1...,"b"]
- local rows=rowsof(rtable)
- local names: rownames rtable
- disp _skip(24) "estimate (LL, UL) estimate (SE) p-value"
- forvalues i=1/`rows' {
- disp "`:word `i' of `names''" _column(25) ///
- %`wth'.`dec'f rtable[`i',1] ///
- " (" %`wth'.`dec'f rtable[`i',2] ///
- ", " %`wth'.`dec'f rtable[`i',3] ")" ///
- _skip(10) %`wth'.`dec'f rtable[`i',1] ///
- " (" %`wth'.`dec'f rtable[`i',4] ///
- ")" _skip(10) %5.3f rtable[`i',5]
- }
- end
Disclaimer: This blog site is intended solely for sharing of information. Comments are warmly welcome, but I make no warranties regarding the quality, content, completeness, suitability, adequacy, sequence, or accuracy of the information.
Saturday, July 14, 2018
Stata: Output the results into text files
Stata: Output the results into text files
Stata: Output the results into Excel tables
Stata: Output the results into Excel tables
- Stata manual: putexcel, putexcel advanced
- Stata blogs: Chuck Huber (2017).Creating Excel tables with putexcel
- part 1: Introduction and formatting
- part 2: Macro, picture, matrix, and formula expressions
- part 3: Writing custom reports for arbitrary variables
- ASCII Codes
- Example:
cd c:\temp sysuse auto regress price mpg i.foreign margins foreign mat rtable=r(table)' putexcel set demo.xlsx,sheet(demo) replace local cell1=char(64+1)+string(1) local cell2=char(64+1)+string(5) putexcel `cell1'=matrix(rtable) /// `cell2'=matrix(rtable[1...,1],rtable[1...,5..6],rtable[1...,2]),names
Subscribe to:
Posts (Atom)