Data Lab One Due Monday, Sep

Yüklə 11.11 Kb.
ölçüsü11.11 Kb.
Econ 401

Data Lab One

Due Monday, Sept. 15

Find the median weekly earnings of full-time workers in July 2008, by sex, for whites and blacks. You will end up with four numbers: median weekly earnings for white males, white females, black males, and black females.
Turn in your answers, and save your dataset in your Caleb.Courses folder, clearly titled.
Note: You could do this homework in Excel rather than Stata, but please don’t. The main purpose of this homework is to give you practice downloading a dataset and opening it in Stata, so that next time that step will be easy, and we can concentrate on more interesting data analysis.
How to:
1. Decide what variables you need to answer the questions.
Make a list of the variables you will need. Check this list before downloading the dataset. If you forget a variable you have to go through the process again and download another dataset.
2. Download the DataFerrett application.
Go to the ferrett homepage at

Follow the directions there to download and install the DataFerrett application.

Find the DataFerrett application on your desktop and launch it.
3. Use Ferret to download the data set you want.
• Enter your e-mail address

• Choose the “Get Data Now” button.

• From the list of datasets at the left, choose the Current Population Survey, Basic. Choose the correct month. Select “View Variables” from the box.

• Search for the variable names you want. Enter a search term in the box and choose Search. Choose the variable you want from the list, and double-click on it to open a new window.

Look at the question carefully to make sure it is what you want. Look at the “Edited Universe” to see if the question was only asked to a small subset of participants.

• Check the “Select” box. Then the “OK” box will add that variable to your data basket.

At this point you can edit data our of your data set. For example, you can choose to include only individuals in the full-time workforce. Be careful not to edit out any categories that you will need.

• Continue until you have all the variables you need.

• Choose the “Step 2” tab.

• Click on the “Download” button.

• Choose to download the data as a STATA file (default is “Display on Screen” so you must switch to “Download Data”).

A new window will appear, with two files, the data (.asc) and a file of Stata commands (.do).

• Save both files created by DataFerrett into your eco401-2 folder.

Save the second file as a text file with the ending “.do”.

4. Open the data in Stata.
• Open the Stata command file (*.do) in Word. Change the “using” and “save” commands so that the location of the data file is correct. The “using” command must have the correct name of the data file you downloaded. For the “save” command you can change the title of the file.
When I did this, I changed the commands to:

using N:\eco401\burnettj\burnettjf5wgkeev1.asc

save N:\eco401\burnettj\CPSjuly07

If you can’t get it to work, here is an easy way to check the address of your files. Try to open the .do file using the Do command on the File menu in Stata. You will get an error message, but the correct address of the file will show up in the Stata log. If you do this, you have to type “clear” before you actually try to run the corrected do file.

• Launch Stata (from Programs - Courses - Economics).

• Increase Stata’s memory size

set mem 100m

• Run the Do file in Stata. (Choose “Do” from the File menu and open the Do file that you just edited.

• Check the data using the command “summarize”.
5. Do the calculations.
The following command will give you a table with variable 1 in rows, variable 2 in columns, and the median of variable 3 in the cells of the table:
table variable1 variable2, c(median variable3)

Some Useful Stata Commands

Gives summary statistics for all the variables in the data set.

summarize variable1

Gives summary statistics for only variable1.

drop if age < 16

Drops observations with age below 16.

table var1 var2, c(mean var3)

Creates a table giving the average value of var3 by var1 and var2.

Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur © 2016
rəhbərliyinə müraciət

    Ana səhifə