Using Stata for Quantitative Analysis. Kyle C. Longest

Чтение книги онлайн.

Читать онлайн книгу Using Stata for Quantitative Analysis - Kyle C. Longest страница 3

Автор:
Серия:
Издательство:
Using Stata for Quantitative Analysis - Kyle C. Longest

Скачать книгу

task. When that computer program involves statistics, the stress level generally increases exponentially. If you have similar feelings as you begin your journey into becoming a Stata1 user, do not fear. You are not alone. This book is designed with this apprehension in mind. One of the primary goals of this book is to help alleviate, or at least minimize, this anxiety as we move toward becoming effective and proficient Stata users. Keep in mind that at one time you may have had similar feelings about using e-mail or the Internet, and just as many people now feel extremely comfortable using these programs, by the end of this book, you will have a similar grasp of and comfort with Stata.

      1Stata is a registered trademark of StataCorp LLC.

      Before diving into all the details of using Stata, it is important to have an understanding of its various components. This chapter will serve as an introduction to the basic building blocks of the Stata program. Each of these aspects will be covered in much more detail throughout the book, but this chapter provides an overview of the basic functionality of the Stata program. The second section of the chapter explains how data are opened, imported, and entered.

      What You See2

      2If you are using Stata 14, all of the commands and screenshots presented will be very similar, although there may be very minor discrepancies. If you are using Stata 13 or prior, I would recommend seeing the second edition of this text as it specifically describes these procedures for Stata 13 and Stata 12. Starting from Chapter 2, the vast majority of operations and commands are similar across versions. And the text specifically notes any particular features that are different for previous versions.

      When you open Stata, by double-clicking on the Stata icon, for the first time, you will see the screen as shown in Figure 1.1.

jpg

      FIGURE 1.1 • BASIC STATA DISPLAY

      3This layout is what you would see if Stata was opened “right out of the box.” If you are working on a shared computer (or over a network), there is a chance that these windows have been moved, resized, or even deleted by another user, making what you see slightly different from the screenshot presented. If any of these windows are missing, you can click on the Windows tab, and then click on the desired window. You can also move these windows by simply clicking on them with your mouse and dragging them to the desired location.

      1 Results Window: The Results window is where everything that Stata “does” will be displayed. Anytime Stata executes some operation, it will display that operation and its results in this window. These results, however, are not automatically saved. How to save these results is covered in the Data Management: Saving Results section of Chapter 3.

      2 Review Window: The Review window contains a running history of all the operations that have been performed during the current session of Stata. Whenever you enter and execute a command, it will appear both in the Results window and in the Review window. The most useful aspect of the Review window is that it can be used as a shortcut to work with a previously executed command. When you click on a command in the Review window, that command will appear in the Command window, from which you can alter the command or simply rerun the same command. If the command is shown in red in the Review window, it means something is not quite right. We will discuss how to handle this situation in the 5 Essential Commands section of Chapter 2.

      3 Variables Window: When you open a data file in Stata, the variables contained in that data set will be listed in the Variables window. This window can be used to scroll through and see all the variables that are contained in the active data. Whenever you click on a variable name listed in the Variables window, several characteristics of that variable are displayed in the Properties window. If you place your cursor over a variable, a small arrow will appear. By clicking on that arrow, the variable name will automatically appear in the Command window. Double-clicking on the variable will also place the variable name in the Command window. This window also lists the variable “Label,” which presents more detailed information about the variable. Labels are discussed in more detail in the Data Management: Working With Labels section of Chapter 3.

      4 Properties Window: The Properties window provides details about the data set that is currently being used and any variable that has been selected (by clicking on it) from the Variables window. For the data, this window provides the file name, the number of variables that are included in the data, and the number of “observations” (e.g., survey respondents). For a given variable, the Properties window lists the variable name, its type, format, and value label. Details on each of these descriptors are discussed later in this chapter. By default, the Properties window is “locked,” meaning you cannot change any of these characteristics directly from the Properties window. Clicking on the padlock icon (located in the upper left corner of the Properties window), however, unlocks the Properties window and allows you to change the aspects of the variable simply by clicking on that property (e.g., the variable name). More details on this process are provided later in this chapter.

      5 Command Window: The Command window is where you will enter the operations that you want Stata to perform, when using the “syntax” interface. Syntax, or code, is another term for Stata’s command language. These are the words that tell Stata what procedures to execute. Commands are entered, one at a time, in this window. After you type a command into the Command window, pressing the Enter key on your keyboard makes Stata execute the procedure that is defined by the Command. One helpful feature of the Command window is that you can scroll through previously executed commands by pressing the Page Up key. When you find the previous command you are interested in, you can either alter it or simply press Enter again to rerun the same command. The majority of this book will be devoted to explaining and describing the various commands that you will need to use to perform quantitative analyses.

      There also are several icons at the top of the screen. The purpose and use of these icons are covered throughout the book. Each of these basic windows will become familiar to you as we go through this book. For now, be sure that you feel comfortable identifying the main purpose of each of the windows.

      Getting Started With Data Files

      When working with Stata, you will be using what is referred to as a “data file.” If you are familiar with typical database programs, then you already know what a data file basically is. These files contain information (often numerical) on a set of cases, such as respondents to a survey, a sample of schools, or each of the states in the United States. Generally, data files are organized such that information regarding each case is contained in one row in the file, whereas each column represents a variable (i.e., information about that case), such as a person’s gender, a school’s total number of students, or a state’s total square miles.

      Similar to most computer files, data files come in many different types. But just as a PDF (portable document format) file is very similar to a word document, so too are all data files essential derivations of a similar structure. Each of these derivations is denoted by a different file extension—the letters that come after the “ . ” in a file name. The primary file for Stata data files is .dta. Moving other types of data files into Stata

Скачать книгу