Using Stata for Survey Data Analysis


Download 1.39 Mb.
Pdf ko'rish
bet25/61
Sana08.03.2023
Hajmi1.39 Mb.
#1252470
1   ...   21   22   23   24   25   26   27   28   ...   61
Bog'liq
2009 Usingstataforsurveydataanalysis (1)

set logtype text 
This command tells Stata to always save the log files in text (ASCII) format. It is the same as adding 
the “text” subcommand to every “log using” command, but it is easier. If you prefer text format files 
(as we do), this is the best way to make sure all the log files are in this format. 
set logtype smcl
This command tells Stata to always save log files in SMCL format. It is the same as adding the 
“smcl” subcommand to every “log using” command. 
Example 7 shows how the log command can be used. First, the log is opened using the filename 
“temp1.” Since no folder was specified, it saved the file to the current default folder. The results 
from “tab urban” are saved in the log file. Then the log is turned off, so the results of “sum hhsize” is 
not logged. Third, the log is turned on so the results from “sum agehead” are logged. Finally, the log 
is closed. 
Example 7 shows the operation of the log command. In order to save the table we are going to create, 
we enter the command “log using hhtable, text”. By using the text option, we are telling Stata to save 
the log file in text (ASCII) format. What ever is produced by Stata after this point will be recorded in 
the log file. Later, we use the “log off” command to stop recording.


Minot
 
 
 
 
 
Using Stata for Survey Analysis 
Page 20 
 

Example 7: Using “log” to save output 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Using Stata output
To look at a log file, the easiest way is to click on File/Log/View. However, there are numerous other 
ways to do it, including clicking on the Eye buttom, opening it from the Do-File Editor, and opening it 
from WordPad.
To print output from the Results window, you can click File/Print Results. 
To print output from a log file, you open the log file with Viewer (File/Log/View) and then click on 
File/Print/Viewer. 
Unfortunately, it is not easy to copy Stata output to other software such as word processors and 
spreadsheets. It is best to copy tables from a log file or from the Results window using Edit/Copy 
Table. 
To move tables from a log file to an Excel table,
1) Open the log file by clicking on File/Log/View 
2) Mark the table by dragging the cursor across it 



Download 1.39 Mb.

Do'stlaringiz bilan baham:
1   ...   21   22   23   24   25   26   27   28   ...   61




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling