If you order your assignment right now, you will be eligible for a great discount.

file is instuction on what to do 1. Load and observe the data (a) Download and o

file is instuction on what to do
1. Load and observe the data
(a) Download and open the file MLB team values.dta and save it to
the Desktop.
(b) Browse the data. What are some problems you notice?
2. Cleaning the data
(a) By browsing or typing describe, we notice that some of the team
values are string variables. We want to “destring” them.
(b) Type
destring V2003, gen(test)
This command will turn V2003 into a numeric variable called test.
Browse both variables to ensure the transformation went as planned.
(c) When you are satisfied that the destring command did what we
wanted it to, drop the test variable and type
destring V2003, replace
This turns V2003 into a numeric variable and overwrites the old
V2003. Be very careful when using the replace option! Make sure
you are confident in what you are doing.
(d) Try to destring V2004. What happens when you do?
(e) To destring a variable that has non-numeric characters, we have to
tell Stata to ignore the actual string characters. Type
destring V2004, ignore(“$”) replace
(f) Using this command, destring the remaining yearly values except
for 1998 and 2016. What other problem exists with the 1998 and
2016 values? For 1998 you can figure out how to handle the variable.
For 2016 we need to think more about what’s going on.

Default image
Articles: 233206

Quick Quote