0% found this document useful (0 votes)
12 views3 pages

Stata Class Activity

Uploaded by

wasay usmani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views3 pages

Stata Class Activity

Uploaded by

wasay usmani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

1 STATA [Total Marks: 25]

Wasay Usmani and Shayan Askari

We will be exploring data using an example dataset within STATA.


1. Load data.
a. Load the population data “nlsw88.dta” available as an example dataset [0.5 mark]
2. Create new variables.
a. Generate a variable named grade4 with the following categories: Not high School
(HS) if they have less than twelve years of education, High School grad if they
have completed twelve years of education, Some college for those with less than
sixteen years of education (but more than twelve) and, College grad for the
remaining. Make sure to define appropriate value labels [4 marks]
b. Report the median wage for High School grads.
Ans) Hourly median wage of High School Grad’s is 5.507 [1.5 marks]

3. Visualize results.
a. Construct a single graph showing boxplots of wage for each of the grade4
categories. Moreover, there should be two sets of boxplots to compare the wages
of those who live in the South and those who do not. Hint: look for the
“group_options” in the boxplot command. Your graph should have the following
characteristics:
i. Boxplots should be horizontal, that is, wage should be on x-axis.
ii. Treat grade4 as the y-variable. Hint: Lookup “asyvars”.
iii. The legend should have value labels for each level of grade4.
iv. The markers for extreme values of wages for those without high school
education should be large hollow circles, that is, they should have a large
size and the symbol should be a hollow circle. Hint: Look up “marker”
Export the graph as a png file and paste it below. [5 marks]
b. Make a single graph of boxplots showing wages of different occupations.
Moreover, your graph should have two sets of boxplots to compare those who
completed college with those who did not. Using the collgrad variable, your graph
should have the following characteristics:
i. The bars are vertical and have a color intensity of 40 percent.
ii. The y-axis is on the right-hand side.
iii. The y-axis scale runs from 5 to 45.
iv. The markers for extreme values of wages should be very large and as
follows: Management (hollow triangles), Sales (hollow circles),
Clerical/Unskilled (hollow diamonds)
v. The boxplot for professionals has a thick black line containing a white fill.
vi. The legend is stacked in two rows above the boxplots.
vii. There is no grid showing in the background of the boxplots.
viii. The legend has corrected labels for Professional and Management
categories. [10 marks]
Note: The final output is pasted below but you need to write the code to produce it
in STATA. Paste your graph below for comparison.

4. Replicate
a. Create a fully functional DO file of all the commands used in this exercise. Your
DO file should include group number, names of members, date, title, and
comments for each command so that it can be easily read by others. [4 marks]
Have fun!

You might also like