1 / 17

MPP Stats Bootcamp W (12:00-1:50), Week 9

MPP Stats Bootcamp W (12:00-1:50), Week 9. SOC 516 Class Tutor: Daniel Hauser ( hauserd@onid.orst.edu ) ECON 524 GTA (and SOC 516 substitute tutor): Joey Carroll Instructor : Dr . Alison Johnston ( Alison.Johnston@oregonstate.edu ) http://oregonstate.edu/cla/polisci/alison-johnston.

terrel
Download Presentation

MPP Stats Bootcamp W (12:00-1:50), Week 9

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. MPP Stats BootcampW (12:00-1:50), Week 9 SOC 516 Class Tutor: Daniel Hauser (hauserd@onid.orst.edu) ECON 524 GTA (and SOC 516 substitute tutor): Joey Carroll Instructor: Dr. Alison Johnston (Alison.Johnston@oregonstate.edu) http://oregonstate.edu/cla/polisci/alison-johnston

  2. Bootcamp Outline • Questions from previous three weeks? • Especially last week? • Data Management Commands • Stata Practice • Testimonial • Bootcamp concluding comments

  3. Comparison of Popular Data Management & Analysis Packages

  4. Pre-Lecture • Open the dataset • 2nd to last sheet in the Bootcamp’s Excel Workbook • Copy into Stata, type describe • Minimize Stata and follow along with Powerpoint

  5. Why Learn Data Management in Stata? • Efficiency • Accuracy • Consistency

  6. Random Useful Commands • help X • Opens a box with help on a specific command, “X” • findit X • Searches for a command “X” in a new window • ssc install X • Installs a new command, “X”. If you don’t know the exact command name, findit!

  7. Data Management Commands • set memory 100m, permanently • If you use Stata 12… • describe • General description of dataset and format of variables • ‘describe x’ displays same information but only about variable x • clear • Removes all data currently loaded

  8. Loading Stata data into Stata • use (only if data is in Stata format: dataset.dta) • If data is in home directory: • use dataset • If not in home directory, need full file name: • use “z:/hauserd/soc/dataset.dta” • Hosted on a website: • use http://www.oregonstate.edu/data/dataset.dta

  9. Loading SPSS or SAS data into Stata • Stat/Transfer: Great program (costs money) • Re-Save in SPSS and SAS • SPSS: Can save as Stata data file (.dta) • SAS: Can save as .csv then copy+pastein Excel • Downloadable Commands (ssc install …) • usesas: usesas using “myfile.sas7dbat” • Need SAS installed • usespss: usespss using “myfile.sav” • Can only be used in 32bit version of Stata…open Stata 10/SE in Umbrella to utilize • Do NOT need SPSS installed

  10. Data Management Commands • destringvar1 • Convert data from string to numeric variable. • Remove missing data in a variable: • destring var1, replace ignore(NR) • sort var1 • Arranges the observations alphabetically or numerically based upon the variable indicated. • order var1 var2 • Brings the variables to the top of the variable list, in the order listed.

  11. Data Management Commands • drop var1 • Eliminate a variable or an observation. • Drop observations in a range: • drop in 500/800 • Can also use if: • drop in 500/800 if > 0 • keep var1 • Opposite of drop, only the variables indicated are retained, the rest are removed. Same rules as drop. • rename var1 party • Changes the name of a variable.

  12. Data Management Commands • label var1 ... • Multi-faceted tool, but we will only go into one use today, the labeling of groups of observations in a variable. • encode var1, gen(var2) • Creates a new numeric variable (var2) out of a string variable (var1). • replace var1=. if var1==4 • Allows for modification of numerical observations within a variable.

  13. Data Management Commands • generate var1 • Commonly used command that creates a new variable. • Normally incorporating other operators or functions: • gen var1=fargo if var1>3 • egen • Super-generate.

  14. StataConditional Operators • After the if statement…and other uses!

  15. Common Mathematical Functionsin Stata

  16. Stata Lab Exercises • How to remove string data from an otherwise numeric variable • How to arrange your variables and observations • How to keep and drop specific portions of the data • How to create a new numeric variable out of a string variable • How to replace numeric values with other numeric values within a variable • How to replicate data with a different codification • How to rename a variable in Stata.

  17. Ending Comments • Do practice problems over break!!! • Use all of your resources • Your cohort • help command • Online resources • SOC 516 Social Research Methods Tutor: • Daniel Hauser (me) • ECON 524 Econometrics GTA: • Joey Carroll (her)

More Related