{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

stata_intro - Introduction to Stata1 This handout contains...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Introduction to Stata 1 This handout contains basic material that will be used during this quarter. Opening Stata Open Stata by going to Start, Programs, Stata, Intercooled Stata. You will see 4 windows: REVIEW, VARIABLES, STATA COMMAND, and STATA RESULTS. REVIEW window keeps track of all the commands that you have used recently. VARIABLES window displays the variables that are in the dataset you are using. STATA COMMAND window is where you type the commands. You have to hit enter after typing the command for Stata to execute the command. STATA RESULTS window displays what you asked Stata to do (the output). Before we start practicing with an actual dataset, a few general comments on the functioning of the program: 1. All Stata commands must be entered in lower case; everything in Stata is case sensitive, including variable names. 2. Press Enter to execute commands. 3. help commandname : this is pull up everything in the help file on this command 4. search keywords : use this if you know what you want to do but don’t know the command name 5. Space bar moves you to the following screen when Stata tell you “ more” 6. To interrupt the execution of a command, hit Q or CTRL+C 7. If you want to move over the different commands you have typed in a session, place the cursor in the command window, and use the Page Up – Page Down keys 8. Clear will clear all data in memory; you can only have one dataset open at a time. Getting the data If the file is in Stata format (.dta) Go to File, Open and choose the file with dta extension that you want to open. If you get a message that data are already in memory then you must type clear , which will clear all data from memory prior to loading the one you want to use. Stata cannot handle two different datasets in memory at the same time. 1 This handout is based on Facundo Cuevas’ and Gissele Gajate Garrido’s handout for ECON 103.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2 If the file is in Excel format 1st option: Open your excel file, highlight the data of interest, then pull down Edit and choose Copy. Start Stata and enter the data editor (type edit once Stata is running). Paste data into editor by pulling down Edit and choosing Paste. 2nd option: Save your excel file as a text file (tab delimited or comma delimited) by pulling down File and choosing Save As. If the original filename is filename.xls, then save the file under the name filename.txt or filename.csv. (Be sure to use the “Save as type” list — specifying an extension such as .txt is not sufficient to produce a text file.) In Stata, type insheet using filename.txt where .txt is the extension that you used when saving the file in Excel. Saving a dataset To save the dataset in Stata format, and avoid having to import it from Excel every time, use save filename . Stata automatically assigns the extension dta.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}