STATA 11 for Windows SAMPLE SESSION - Food Security Group ...
STATA 11 for Windows SAMPLE SESSION - Food Security Group ...
STATA 11 for Windows SAMPLE SESSION - Food Security Group ...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Stata <strong>11</strong> Sample Session Section 0 – File structure and Basic Operations <strong>for</strong> Stata <strong>11</strong><br />
or type:<br />
log using session1, append text<br />
The above command opens a file to record the session and uses<br />
ASCII <strong>for</strong>mat. This file can be opened in any text editor or word<br />
processor.<br />
The cmdlog using command The other type of log file records only the commands and not the<br />
output from the commands. The command is<br />
cmdlog<br />
This command creates a file that records only the commands.<br />
cmdlog using session1, append<br />
In the Stata<br />
Command<br />
window, type:<br />
A file is opened which is named “session1.txt", and in<strong>for</strong>mation will<br />
be appended to anything that already exists in this file.<br />
The log close command To close the log, in the Command window, type<br />
log close<br />
Reminder: The log file that is written in SMCL <strong>for</strong>mat can only<br />
be opened in Stata. It is a specific <strong>for</strong>mat as mentioned earlier. If<br />
you want to share your commands and results from the log files with<br />
another person who might not have Stata, you should save your log<br />
files in the TEXT <strong>for</strong>mat with the extension of .log. Any editor or<br />
word processor can open this file. However, in the word processor,<br />
the font must be set to a fixed font, such as Courier New.<br />
Otherwise, the output will be difficult to read.<br />
3. Do files -Stata commands (Extension *.do)<br />
A “.do” file contains commands that Stata can execute. The “do” file<br />
is created in the Do-file Editor. The user can type commands or<br />
paste commands into the editor. Other ways to create a do file are:<br />
a) You can create a log file that contains only the commands,<br />
using the “cmdlog” command, see above.<br />
b) You can select the Review window, click the right mouse<br />
button and select “Save Review contents”. The extension .do<br />
will be automatically added to the file name you enter into the “File<br />
name” box.<br />
c) You can copy the command to the clipboard, using the option<br />
9