Econometrics 704 Emilio Cuilty

Slides:



Advertisements
Similar presentations
Stata as a Data Entry Management Tool
Advertisements

1. Overview Basic commands for writing do-files
{ Advanced Stata Programming Andrew Hicks CCPR Statistics and Methods Core.
Statistical Methods Lynne Stokes Department of Statistical Science Lecture 7: Introduction to SAS Programming Language.
Introduction to MATLAB for Biomedical Engineering BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Lesson 2: Element-wise vs. matrix operations.
1. Overview Brief guide to the display windows and toolbar
INTRODUCTION TO STATA Võ Tuấn Khoa Trần Thế Trung.
Computing for Research I Spring 2011 Primary Instructor: Elizabeth Garrett-Mayer Stata Programming February 28.
Computing for Research I Spring 2013 Primary Instructor: Elizabeth Garrett-Mayer Stata Programming February 21.
Getting Started with your data
CSCI 330 T HE UNIX S YSTEM Editing files. E DITOR C ONCEPTS Editing a file is to modify the content of a file Text editor: Enter and modify text in a.
STATA User Group September 2007 Shuk-Li Man and Hannah Evans.
1 CCPR Computing Services Introduction to Stata Courtney Engel October 26, 2007.
Day 1: Getting Started Department of Economics
Stata 12 Merging Guide Nathan Favero Texas A&M University October 19, 2012.
1 CCPR Computing Services Workshop: Introduction to Stata June, 2006.
Stata Workshop #1 Chiu-Hsieh (Paul) Hsu Associate Professor College of Public Health
Project organisation in Stata Adrian Spoerri and Marcel Zwahlen Department of Social and Preventive Medicine University of Berne, Switzerland Research.
Session I How to use STATA & Basic Data Management Commands.
A Brief Introduction to Stata(1). 1. Getting Started.
Key Data Management Tasks in Stata
Tricks in Stata Anke Huss Generating „automatic“ tables in a do-file.
STATA Mini Course Fall 2015 Jane Leber Herr Littauer 113 1Stata Mini Course – Spring 2015.
SAS Efficiency Techniques and Methods By Kelley Weston Sr. Statistical Programmer Quintiles.
Linux+ Guide to Linux Certification, Third Edition
Generating new variables and manipulating data with STATA Biostatistics 212 Lecture 3.
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
Introduction to Enterprise Guide Jennifer Schmidt Rhonda Ellis Cassandra Hall.
STATA for S-052 M. Shane Tutwiler Your Friendly S-040 Lecturer William Johnston IT Services Harvard Graduate School of Education.
Dec-15H.S.1 Stata 8, Programing Hein Stigum Presentation, data and programs at:
Comparison of different output options from Stata
Lecture 26: Reusable Methods: Enviable Sloth. Creating Function M-files User defined functions are stored as M- files To use them, they must be in the.
Today Introduction to Stata – Files / directories – Stata syntax – Useful commands / functions Logistic regression analysis with Stata – Estimation – GOF.
Econometrics-3 XENA BONDARENKO. I. Preparation for Data Analysis a)Create / change working directory b)Specify data c)End Stata d)The four Stata windows.
Data Analysis using Stata workshop #4 / Kristin Bott reed.edu > K.Bott / Instructional Technology Services Reed College / Portland, OR.
Before the class starts: 1) login to a computer 2) start Stata 13.
Introduction to STATA Before you get frustrated, imagine processing data by hand and think dearly of STATA.
Create Stored Procedures and Functions Database Management Fundamentals LESSON 2.4.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
LINGO TUTORIAL.
Advanced Quantitative Techniques
Introduction to the SPSS Interface
Econ 326 Prof. Mariana Carrera Lab Session X [DATE]
SQL and SQL*Plus Interaction
Lecture 3: Changing Data
ECONOMETRICS ii – spring 2018
Introduction Introduction to Stata 2016.
Chapter 1: Introduction to SAS
Instructor: Raul Cruz-Cano
Topics Introduction to File Input and Output
Chapter 7 Files and Exceptions
Introduction to Stata Spring 2017.
STATA User Group September 2007
Introduction to SAS A SAS program is a list of SAS statements executed in order Every SAS statement ends with a semicolon! SAS statements can be in caps.
Objectives This is an introduction to the statistical software STATA aiming at: Preparing the participants in STATA basics (interphase and commands) for.
Stata Basic Course Lab 4.
Chapter 2: Creating And Modifying Database Tables
Using SQL*Plus.
Stata Basic Course Lab 2.
Presentation, data and programs at:
Functions continued.
Topics Introduction to File Input and Output
Amos Introduction In this tutorial, you will be briefly introduced to the student version of the SEM software known as Amos. You should download the current.
Instructor: Raul Cruz 9/4/13
CSCI The UNIX System Editing files
Two Issues on Remote Data Access
Topics Introduction to File Input and Output
A Brief Introduction to Stata(2)
Introduction to the SPSS Interface
Evaluation of Public Policy
Presentation transcript:

Econometrics 704 Emilio Cuilty 1. Introduction to Stata Econometrics 704 Emilio Cuilty

Stata Stata versions: On the available Memory (IC, SE, MP) Sata works directly with the memory of the CPU Uses both commands and Windows New shortcuts available online Differentiates between upper and lower cases

Ventanas de Stata 3 2 4 1

Data File extension is .dta Thousands (,) and decimals (.) Commands for memory management: Show memory: query memory Change memory: set memory #[b|k|m|g] [, permanently] Change max variables: set maxvar # [, permanently] Open an existent data in the directory: auto.dta Window: File/Open Comand: use filename [, clear nolabel] (use F:/auto.dta)

Data Erase data set: clear Description of the data: window: Data/Describe data/Describe data in memory Command: describe Creating/editing: Editor Types: string, numeric, labeled numeric Missing values:: numeric (.) Labels: Variable: label variable varname ["label"] Values: Define: label define lblname # "label" [# "label" ...] Asiggment: label values varlist [lblname|.]

Command Sintax Help: help, search (web) Basic sintax: [prefix: ] command [varlist] [=exp] [if exp] [in range] [weight] [, options] […]: Options and qualifiers prefix: repeats execution of a command or modifies either the input or output of the command varlist: variable list command: Stata command exp: algebraic expression range: observation range weight: How to weight obs options: options for that command

Expresions Operators Functions help functions Errors

Examples: Commands Descriptive Stats:: summarize [varlist] [if] [in] [weight] [, options] Examples: sum by foreign: sum length sum length if price>=6165.257 sum length price in 1/10 Frequency table: tabulate varname [if] [in] [weight] [, options] Show values of expressions and scalars: display [“”] [exp]

Variables, observations Create generate: generate [type] newvar[:lblname] =exp [if] [in] egen: egen [type] newvar = fcn(arguments) [if] [in] Remplace replace: replace oldvar =exp [if] [in] delete/lkeep (drop/keep) Variables: {drop|keep} varlist Observations: {drop|keep} if exp Observations Rnge.: {drop|keep} in range [if exp]

do and log files do File with a list of commands to execute Is a text file with extension .do To introduce comments in the file: *texto, //texto// To run a do file: {do|run} filename [, nostop ] Log File that keeps track on the results window Extension .log Start a log: log using filename [, append replace [text|smcl] ] Close a log: log close See the log: view filename.smcl

Scalars Save a unique number or text A Common use if for saving estimates Create: scalar scalar_name = exp List content: scalar { dir | list } [ _all | scalar_names ] delete: scalar drop { _all | scalar_names }

Matrix Stata saves number or text matrixes Two ways: command ( usually using the prefix matrix) Mata program Start program: mata Back to stata: end

Matrix: commands Operators Functions help matrix functions

Matrices: Mediante comandos Create matrix matrix_name = {matrix_expression, (#,..,# \ #,..,# \ #,..,#)} (, ): column (\): row See: matrix list matrix_name Directory: matrix dir Rename: matrix rename oldname newname delete: matrix drop {_all | matrix_name} Choose submatrix: matrix A = B[ri..rj, ck..cs] replace: matrix A[ri..rj, ck..cs] = B Matrix to Variable: svmat A Variable to Matrix: mkmat varlist [if] [in] [, matrix(matname) …]

Using results from Stata commands r clase e clase From data, but not from estimation Are saved in r() Dissapear after another command is used Example: use auto sum mpg return list scalar rango = r(max) – r(min) display “mpg range = ” rango From estimation Saved in e() Example: regress mpg price weight ereturn list matrix b = e(b) matrix list b

Macros global local global variables “trunk weight length” Characters list Reduces the burden of coding Two types: local: only available in do file or in one session global: once defined available across do files or sessions Ejs: global local global variables “trunk weight length” sum $variables local variables “trunk weight length” sum `variables'

Looping commands Ways of repeating the same command several times foreach: Repeats over a list of items forvalues: Repeats over consecutive numbers while: Repeats command until a condition is met