I need to solve this STATA question.
There is a typo in PS2. For Q2.2, the value label should be == 1 if male, == 2 if female.
Please help me.
ECON424 Problem Set 2
Due: April 10, 11:59pm
You should write all your commands in one do-?le. Comment your do-?le properly so that
it is readable. To start, save all the data ?les into your working folder and start your do-?le with
the ?cd? command. Write the answers as comments in the do-?le after each question.
Submit your do-?le and log-?le to ELMS.
Q1. Generate variables
Use data pwt.xlsx
1. Import the data from excel to Stata and save the imported data as a .dta ?le.
2. How many observations are there in the data set? How many variables are there?
3. Using the commands you have studied so far, generate the median rgdpe (name it med rgdep)
of all the countries by year? Display med rgdpe for each year in the results window.
Bonus: Produce a table with its rows being year and columns being med rgdpe. Write
the command(s) in the do-?le (you don?t need to type the table yourself and it should be
produced by the command(s) and stored in the log-?le).
4. Suppose you need to use demeaned GDP for each country, dgdp, as an independent variable
for your regression. Generate dgdp, such that
dgdp = rgdpe ? rgdpe,
where rgdpe is the average rgdpe for each country.
5. Keep data from 2011 only. Generate the variable rank 2011 which is the ranking of the
countries by their 2011 rgdpe, in descending order.
Q2. Labels and dummy variables
Use data ?rstsurvey.dta
1. List the ?rst 10 observations.
2. Generate a value label sex lb (== 1 if male, == 0 for female).
3. Apply the value label sex lb to the variable gender.
4. Generate a dummy variable edu15, which is 1 if years of education greater than 15, and 0
5. Label the variable edu15, so we know what it stands for.
6. Keep observations with years of education greater than 15. What is the gender distribution
(percentage of male and female) in the remaining sample?
Q3. Descriptive statistics
1. Merge the two data sets descriptive gss1.dta and descriptive gss2.dta by id, and save the
merged data set as descriptive gss.dta.
2. Do a detailed summary of the variable hrs1 (hours worked las week). Also create a histogram
of the variable. Looking at the histogram, explain why the skewness is close to zero and why
the kurtosis is positive.
3. Do a detailed summary of the variable satjob7 (job satisfaction). Type the command numlabel satjob7, add and then do a tabulation of satjob7. Interpret the mean and median
4. Do a tabulation of deckids (who makes decisions about how to bring up children) and do
this by sex. Why would it make no sense to report the mean, median, or standard deviation
for deckids? Creat a column chart by using the histogram dialog box (remember to select
by sex and data is discrete) and use Stata?s Graph Editor to make the chart look as nice as
5. Do a tabulation of trustpeo, wantbest, advantge and goodlife. Use the tabstat command
to produce a table that summarizes descriptive statistics for this set of variables by gender.
Include the median, mean, standard deviation, and count for each variable. Interpret the
means by using the variable labels you get with the tabulation command.