Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Session 4 (21-22 October tasks) for STATA

Section 1 data management

1. Importing NLS88wage.xlsx in Stata


2. Save the data file
3. Begin the log File and do file
4. Save the do File
5. Get summary statistics of wage variable including skewness and kurtosis
6. Create a histogram of wage and comment on distribution.
7. Create natural log of wage variable
8. label variable ln_wage "Log of hourly wage"
9. label variable wage "Hourly wage"
10. label variable collgrad "College graduate"
11. label variable union "Union member"
12. label variable tenure "Job tenure (years)"
13. label define yesno 0 "no" 1 "yes"
14. label values for union: 0 “Non- Union” and 1 “Union”
15. label values for collgrad 0 “Non-graduate”, 1 “College Graduate”

Section 2

1. summarize ln_wage
2. Create a histogram of lnwage and comment on distribution.
3. Try following commands
a. table union, contents(mean wage sd wage)
b. table collgrad, contents(mean wage sd wage)
4. Get crosstab of union and College graduate, What percentage of college graduates are union
member? (Answer in the do file)

Section 3: Bivariate relationship

1. Obtain the association through a scatter plot for wage and age; wage and tenure

2. Obtain the association through a scatter with regression line for wage and tenure
3. Obtain Correlations between variable wage and age; wage and tenure using correlation
matrix
Section 4 Graphs

1. Draw a   twoway  scatter on  wage tenure and comment on direction of


association
2. Draw a scatter wage tenure for union and non-union
3. Draw the absolute frequency column bar chart of the variable age
4. Save the graph
5. Draw the relative frequency  column   bar chart of the variable age
6. Draw the relative frequency  horizontal bar chart of the variable age
7. Draw the relative frequency  horizontal bar chart of the variable age in
descending order
8. Depict the mean of wage over Union in column bar-chart
9. Generate square of age variable.

Section 5

10.  look at drop command in help window.


11. drop idcode variable 
12. Generating idcode variable with this command: gen idcode = _n
13. look at xtile command in help window:   xtile command  Create variable
containing quantile categories
14. I want you to create a new variable wageG which is divided into 4 quantiles
with the command: xtile wageG = wage, nq(4)

15. Create a new variable wage_cat; where wage <10 is “low”, Wage 10.01-30
is medium, >30 is “High”

Using replace command & recode

Saving and exporting data

4. Try Regression models with wage as dependent variable and independent variables
being union collgrad tenure race. Note race is a string variable, it needs to be converted
as numeric variable with the help of encode command.

You might also like