capture log close /* CLOSES ANY LOG FILE THAT MAY HAVE BEEN OPEN */
clear /* CLEARS ANY DATA THAT MAY BE OPEN IN MEMORY */
set more 1 /* SETS SCROLLING PREFERENCE SO COMMANDS ARE ALL SCROLLED THROUGH IN ONE WITHOUT HALTING SCREEN BY SCREEN */
set memory 10m /* SETS MEMORY - SHOULD CHANGE TO HIGHER FIGURE WHEN WORKING WITH A VERY LARGE DATA SET */
log using filename.log, replace /* SPECIFIES WHAT FILE TO USE FOR LOGGING ALL ACTIONS, IF YOU DON'T SPECIFY .log THEN IT WILL USE THE NEW FORMAT WHICH IS HARD TO MANIPULATE IN A TEXT EDITOR, ,replace WILL OVERRIDE ANY PREVIOUS VERSIONS OF SUCH A LOG FILE */
use filename /* SPECIFIES NAME OF DATA FILE YOU ARE USING (DO NOT NEED TO ADD .dta, THAT IS AUTOMATIC */  

/* PROJECT: STATA GOODIES WEB PAGE, http://www.eszter.com/stata.html */
/* BY: Eszter Hargittai */
/* DATE: 04/03/02 */
/* LOCATION: H:\public_html\stataexample.do */
/* PURPOSE:  To offer Stata newbies a do file template. */ 
/* THIS ABOVE SECTION IS FOR YOU TO KEEP TRACK OF WHAT THIS FILE IS FOR */

/* START COMMANDS */ /* THIS IS JUST SO YOU CAN CLEARLY SEE WHERE YOU STARTED THE FILE SPECIFIC COMMANDS */

insheet age male black white other nrtheast nthctrl south west metro using hw5.txt /* THIS IS AN EXAMPLE COMMAND, HERE YOU ARE READING IN DATA FROM THE hw5.txt FILE */

/* END COMMANDS */ /* FOR YOU TO KEEP TRACK OF WHERE YOUR FILE SPECIFIC COMMANDS END */

save filename, replace /* SAVES NEWLY GENERATED DATA IN THIS FILE, REPLACES ANY FILE PREVIOUSLY WITH THIS NAME */
set more 0 /* SETS SCROLLING BACK TO SCREEN-BY-SCREEN */