{"id":891,"date":"2017-09-18T11:27:08","date_gmt":"2017-09-18T15:27:08","guid":{"rendered":"http:\/\/www.kaikaichen.com\/?p=891"},"modified":"2019-05-13T14:07:58","modified_gmt":"2019-05-13T18:07:58","slug":"sample-code-for-outreg-command-in-stata","status":"publish","type":"post","link":"https:\/\/www.kaichen.work\/?p=891","title":{"rendered":"Sample code for &#8220;outreg&#8221; command in Stata"},"content":{"rendered":"<p><code>outreg<\/code> is a time-saving and must-have command in Stata. It will generate a ready-for-use results table like this. I&#8217;m sure you will see what a relief this can give us.<\/p>\n<p><a href=\"http:\/\/kaichen.work\/wp-content\/uploads\/2019\/05\/outreg.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1324\" src=\"http:\/\/kaichen.work\/wp-content\/uploads\/2019\/05\/outreg-300x232.png\" alt=\"\" width=\"400\" height=\"309\" srcset=\"https:\/\/www.kaichen.work\/wp-content\/uploads\/2019\/05\/outreg-300x232.png 300w, https:\/\/www.kaichen.work\/wp-content\/uploads\/2019\/05\/outreg.png 768w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/a><\/p>\n<p><code>outreg<\/code> is not a built-in command and can be installed by issuing the following command:<\/p>\n<p><code>ssc install outreg<\/code><\/p>\n<p>The typical usage of <code>outreg<\/code> is:<\/p>\n<pre class=\"lang:default decode:true\">outreg using results, stats(b p) sdec(3) \/\/\/\r\nsummstat(r2_a \\ N) summdec(3,0) summtitles(\"Adjusted R2\" \\ \"N\") \/\/\/\r\nstarlevels(10 5 1) starloc(1) \/\/\/\r\nctitles(\"\", \"Heading\" \\ \"\", \"Subheading\") \/\/\/\r\nkeep(_cons x1 x2 x3 x4) merge replace<\/pre>\n<p>x1, x2, x3 and x4 are independent variables that you want to report estimates for. Sometimes you may not want to report unimportant independent variables. If you include interaction terms in regressions like this:<\/p>\n<p><code>regress y c.x1##c.x2<\/code><\/p>\n<p>By the way, this is the highly recommended way to include interaction terms in regressions. If you want to report estimates for x1, x2, and x1 \u00d7 x2, please use the following <code>keep<\/code> option:<\/p>\n<p><code>keep(_cons x1 x2 c.x1#c.x2)<\/code><\/p>\n<p>I list other frequently used options that control the appearance of the results table:<\/p>\n<p><code>stats<\/code>: b, se, t, or p. Usually b and the other statistics will be reported.<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>b: coefficient estimates<\/li>\n<li>se: standard errors of estimate<\/li>\n<li>t: <em>t<\/em> statistics for the test of <em>b<\/em>=0<\/li>\n<li>p: <em>p<\/em> value of <em>t<\/em> statistics<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><code>nosubstat<\/code>: I do not include this option in the sample code. This option will report two selected statistics (usually b and the other one) in two columns, rather than putting one (e.g., <em>t<\/em> statistics) below the other (e.g., b).<\/p>\n<p><code>varlabels<\/code>: I do not include this option in the sample code. This option will report variable labels, rather than variable names in the generated table. Sometimes variable labels is easier to understand than variable names. In this case, you can set labels for independent variables and turn on this option.<\/p>\n<p><code>nosubstat<\/code> and <code>varlabels<\/code> can be placed anywhere after the comma.<\/p>\n<p>The complete help file for this command can be found <a href=\"http:\/\/fmwww.bc.edu\/RePEc\/bocode\/o\/outreg_complete.html\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/p>\n<p>There is a similar command <code>outreg2<\/code> that you can check. But I find <code>outreg<\/code> is good enough and works really well for me.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>outreg is a time-saving and must-have command in Stata. It will generate a ready-for-use results table like this. I&#8217;m sure you will see what a relief this can give us. outreg is not a built-in command and can be installed &hellip; <a href=\"https:\/\/www.kaichen.work\/?p=891\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"_links":{"self":[{"href":"https:\/\/www.kaichen.work\/index.php?rest_route=\/wp\/v2\/posts\/891"}],"collection":[{"href":"https:\/\/www.kaichen.work\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kaichen.work\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kaichen.work\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kaichen.work\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=891"}],"version-history":[{"count":19,"href":"https:\/\/www.kaichen.work\/index.php?rest_route=\/wp\/v2\/posts\/891\/revisions"}],"predecessor-version":[{"id":1331,"href":"https:\/\/www.kaichen.work\/index.php?rest_route=\/wp\/v2\/posts\/891\/revisions\/1331"}],"wp:attachment":[{"href":"https:\/\/www.kaichen.work\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=891"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kaichen.work\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=891"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kaichen.work\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=891"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}