Stata for Mac and Stata for Unix: cd (synonym chdir) changes the current working directory to. By using cd or by selecting File > Change Working Directory. Stata for Researchers: Do Files This is part three of the Stata for Researchers series. For a list of topics covered by this series, see the. If you're new to Stata we highly recommend reading the articles in order. Graphicspath for mac and windows 10. Up to this point we've used Stata interactively: we've typed commands in the command window, hit Enter, and observed the results. But now that we've covered the basics of Stata syntax, the next step is learning how to create and change variables. You should never change your data interactively, so we'll first talk about how to write do files. Writing a Do File Do files are simply text files whose names end with.do and which contain Stata commands exactly the way you'd type them into the command window. Sometimes people call them programs, though Stata uses this term for something else (see ). You can write do files using any text editor, but the Do File Editor built into Stata has tools and features designed to help programmers so we recommend using it. ![]() Do not write Stata code using Word—it will automatically insert things like 'smart quotes' and other formatting that Stata cannot understand. To start logging, the command is: log using filename.log, replace where filename is the name of the file you want Stata to use as a log. Painting games for download machine. Give the log file the same name as the do file it records, so it's obvious which log file goes with which do file. The replace option tells Stata that if a log file with that name already exists, usually from a previous attempt to run the do file, it should be replaced by the current log. If you do not specify the.log at the end of the filename, Stata will save the log using its Stata Markup and Control Language. SMCL has its uses, but it can only be read by Stata's Viewer. If your filename ends with.log, Stata will save the log as plain text which you can read in any text editor. Loading Data Next you will usually load a data set: use dataset If the dataset is in the current working directory, you don't need to specify its location. Do Your Work At this point you'll be ready to do your work. Generally this means data preparation, exploratory analysis, or analysis you intend to report or publish. We recommend you have separate do files for each of these, as they are very different processes and have different requirements. We'll talk more about this in. Save your Data If this do file is for data preparation, you'll need to save your work at the end: save newDataset, replace The replace option again allows Stata to overwrite the output from previous attempts to run the do file.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2019
Categories |