11.07.2015 Views

[U] User's Guide

[U] User's Guide

[U] User's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

184 [ U ] 16 Do-files* a sample analysis jobversion 11use http://www.stata-press.com/data/r11/censusbegin myjob.dotabulate region /* obtain summary statistics */summarize marriage_rate divorce_rate median_age if state!="Nevada"end myjob.doIn fact, /* */ can be put anywhere, even in the middle of a line:* a sample analysis jobversion 11begin myjob.douse /* confirm this is latest */ http://www.stata-press.com/data/r11/censustabulate region /* obtain summary statistics */summarize marriage_rate divorce_rate median_age if state!="Nevada"end myjob.doYou can achieve the same results with the // and /// methods:or// a sample analysis jobversion 11use http://www.stata-press.com/data/r11/censusbegin myjob.dotabulate region// obtain summary statisticssummarize marriage_rate divorce_rate median_age if state!="Nevada"end myjob.do// a sample analysis jobversion 11use /// confirm this is latesthttp://www.stata-press.com/data/r11/censusbegin myjob.dotabulate region// obtain summary statisticssummarize marriage_rate divorce_rate median_age if state!="Nevada"end myjob.do16.1.3 Long lines in do-filesWhen you use Stata interactively, you press Enter to end a line and tell Stata to execute it. If youneed to type a line that is wider than the screen, you simply do it, letting it wrap or scroll.You can follow the same procedure in do-files—if your editor or word processor will let you—butyou can do better. You can change the end-of-line delimiter to ‘;’ by using #delimit, you cancomment out the line break by using /* */ comment delimiters, or you can use the /// line-joinindicator.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!