Download presentation
Presentation is loading. Please wait.
1
Have you signed up (or had) your meeting?
QM222 Class 3 Section D1 Using Stata – Basics and inputting Data (see Chapter 26, summary of commands at end of coursenotes) Assignment 1 due Monday – in 520F by 6 (or class) AND uploaded onto Questrom Tools Assignments Have you signed up (or had) your meeting? QM222 Fall 2016 Section D1
2
Background on Computers
Data sets (not originally in Stata form) should have Variables in columns Variable labels on top row Strings v. Numbers Strings need to be exactly the same to match them. If one value has a string, the whole variable will be considered a string. Be sure to tell the program that You can check if something is a string by getting averages – I’ll show how Once everything is numeric, you can change the type to a number not a string. In Stata or Excel, when you want to refer to a value of a string variable, you need to put it in quotation marks, e.g. “government”. QM222 Fall 2016 Section D1
3
Missing values and Number of observations
We cannot do regression analysis on observations with ANY variable (in your regression). So the number of observations you have is the number of observations with all variables you use not missing. Different data sets use different ways to write missing: na NA skip etc. In Stata, missing is a dot But some stata sets (GSS) have different kinds of missings that all start with a dot. Cleaning the data means that you need to make all missing values into a dot. QM222 Fall 2016 Section D1
4
Click on the Stata icon or open the program Stata and you will see something like this:
QM222 Fall 2016 Section D1
5
Review of Stata view The Command pane on the bottom middle where you type in commands. A Review pane on the left with all of the commands you’ve typed since you opened Stata. A pane on the upper right with all the Variables in your data set. The largest panel: the Results pane in the top middle that gives your results, as well as everything you have typed in. The icons on top may look different in macs & pcs, in different Stata versions. QM222 Fall 2016 Section D1
6
A few things to remember
The help icon (or just typing help or help topic) is very useful. You can click icons, click on menus, or type commands. Stata usually accepts the first few letters of a typed command (as long as this is the only command that starts with these letters.) In variable names, Stata cares about capital letters. The variable Education is not the same as the variable education. Suggestion: always use lower case for variable names. Stata commands can only be typed in lower case. Stata will not let you open a new data set if you already have one open. Only one can be opened at a time. QM222 Fall 2016 Section D1
7
Inputting data Many data sets are available in Stata format.
Otherwise, get it in .csv format if you can (comma separated variables and use the Stata command “ QM222 Fall 2016 Section D1
8
Logical (if) statements
Many commands in Stata can be applied to a subset of the data only with an if statement. “If” statements are also called logical statements. In Stata logical statements (only), you can use these “operators”: == ( double equal signs) equals (use in logical statements only) & and | or != not equal to < > <= >= obvious Example: sum wagp if agep>=25 If you have a comma in your command (e.g. sum varname, detail), put the if statement before the comma: sum wagp if agep>=25, detail QM222 Fall 2016 Section D1
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.