BasicStataInstructions

BasicStataInstructions - Your first Stata project This...

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

View Full Document Right Arrow Icon
This guide will take you through the steps of starting a Stata .do file, importing data, and doing some analysis. Along the way, several useful functions will be introduced. 1. In your internet browser, go to http://goo.gl/DUNcW . This should bring you to a page that offers you the chance to download a file called “ACC Basketball Players.csv.” 2. Download the file. My suggestion is to right- click on the link, choose the “Save Link As…” option from the context-menu, and save it to a folde r you’ll remember, perhaps even the Desktop. 3. Open Stata 4. From the menu, go to Window > Do-file Editor > New Do-file. Or, hit Ctrl-8. a. This is a Do-file, in which you will type commands for Stata to execute. 5. I suggest starting all Do-files with a description of what the file does. Anything on a line that begins with an “*” character will not be read and executed by Stata. Thus, the asterisk can be called a comment character. You may want to begin your Do-file with something like: * This file is my first Do-file, in which I load data and run a few analyses. 6. Next, I suggest you type the clear command, which will empty Stata’s memory every time you run the Do-file from the beginning. You will also want to set memory to something larger (so Stata can handle more data and more complicated operations: clear set mem 400m 7. Now, find the file path that points to where you saved “ACC Basketball Players.csv” on your hard drive. It might be something like “ C:\Users\dbs9\Desktop\ ACC Basketball Players.csv” 8. You load this into Stata with the command: insheet using "C:\Users\dbs9\Desktop\ACC Basketball Players.csv", comma 9. Here, insheet is the command for loading data, and comma tells Stata that the file is a .csv, or comma-separated value file. 10. At this point, you’ll want to run your Do-file. You can do this in many ways: a. On the Do-file editor menu, go to Tools > Do b. Select all of the code you’ve written (Ctrl - A), and then hit the keyboard shortcut for “do,” Ctrl-D. c. You can also run one line at a time. If your cursor is on a line of code, or selecting part of a line or several lines of code, you can “do” that selection alone. d.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/21/2011 for the course POL SCI 102 taught by Professor Gelpi during the Spring '11 term at Duke.

Page1 / 5

BasicStataInstructions - Your first Stata project This...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online