Читать книгу Using Stata for Quantitative Analysis - Kyle C. Longest - Страница 13

Opening and Saving Stata Data Files

Оглавление

To open a data file that is in Stata format (i.e., one that has a .dta extension), select the File menu (in the upper left-hand corner) and then choose Open. Or alternatively, you can simply click on the icon. From here, you will need to search through the disk drives and folders on your computer to find your saved data file. Note that only files that are saved as .dta files will appear when searching from within Stata. This chapter uses the data file available at study.sagepub.com/longest3e named Chapter 1 Data.dta. Once you have found your data file, double-click the file. Having done this, you will notice that the Stata screen looks different from how it did initially (Figure 1.2).


FIGURE 1.2 • STATA DISPLAY WITH DATA OPEN

The first operation you performed is now displayed in both the Results and Review windows. Again, whenever we tell Stata to “do” something, whether through the point-and-click menus or by entering a command in the Command window, it will be displayed in the Results and Review windows. Because opening a data file does not have any “results,” only the command is displayed in the Results window. You can also see that the data file contains five variables, listed in the Variables window. All the information provided about each variable in this window is discussed in a later section, but for now, the most important aspect is the variable name. In this data set, the five variables are named ids, gender, agecats, employst, and religoth. These variable names should give you some indication of what type of information the variable contains. The variable gender, for example, says whether each respondent is a male or a female.

It is a good practice to always save a copy of your data files and only work with the duplicated version. When working with and analyzing data, you often will be forced to change aspects of the data files. For example, you may need to create a new variable or change something about an existing variable. But it is important to have an original version of the data, just in case something undesired occurs. Don’t worry too much; most alterations you perform can be undone or recovered. Working with a duplicate copy of the data is simply an added protection.

To save a duplicate copy of the data file you have just opened, open the File menu and click on Save As. You can then enter a new file name, such as Chapter 1 Data mycopy.dta, and click Save. This is the procedure you will use whenever you want to save a new version of your data file.

Using Stata for Quantitative Analysis

Подняться наверх