Stata data management reference manual release 11

ISBN 9781597180504 - Stata Data

Unformatted text preview: Data Processing with Stata 14.1 Cheat Sheet For more info see Stata’s reference manual (stata.com) Basic Syntax All Stata functions have the same format (syntax): [by varlist1:] command [varlist2] apply the command across each unique combination of variables in varlist1 Useful Shortcuts keyboard buttons F2 describe data Ctrl 8 open the data editor clear delete data in memory Ctrl 9 open a new file Ctrl D hht text in file, then ctrl d executes it in the command line Arithmetic Pg Up combine (strings) Tab cls scroll through previous commands add (numbers) autocompletes variable name after typing part − subtract clear the console (where results are displayed) * multiply Set up pwd print current (working) directory cd "C:\Program Files (x86)\Stata13" change working drive dir display filenames in working directory fs *List all Stata files in working directory underlined parts are shortcuts – capture log close use "capture" close the log on any existing do files or "cap" log using "my Do File.do", replace create a new log file to record your work and results search mdesc packages contain find the package mdesc to install extra commands that expand Stata’s toolkit ssc install mdesc install the package mdesc; needs to be done once Import Data sysuse auto, clear for many examples, we load system data (Auto data) use the auto dataset.

Stata Reference Manual Release 3 Statistics Graphics Data.

Use "your Stata File.dta", clear load a dataset from the current directory frequently used commands are import excel "your Spreadsheet.x", /* hhted in yellow */ sheet("Sheet1") cellrange(A2: H11) firstrow import an Excel spreadsheet import delimited"your File.csv", /* */ rowrange() colrange(1:8) varnames(2) import a file webuse set "https://github.com/Geo Center/Stata Training/raw/master/Day2/Data" webuse "wb_indicators_long" set web-based directory and load data from the web / divide ^ raise to a power [if exp] [in range] bysort rep78 : summarize price [weht] [using filename] [,options] apply wehts pull data from a file (if not loaded) special options for command In this example, we want a detailed summary with stats like kurtosis, plus mean and median if foren == 0 & price = 10000 make Chevy Colt Buick Riviera Honda Civic Volvo 260 foren 0 0 1 1 Change Data Types Stata has 6 data types, and data can also be missing: == tests if something is equal = assns a value to a variable price 3,984 10,372 4,499 11,995 no data = 10000 make Chevy Colt Buick Riviera Honda Civic Volvo 260 foren 0 0 1 1 VIEW DATA ORGANIZATION describe make price display variable type, format, and any value/variable labels count count if price 5000 number of rows (observations) Can be combined with logic ds, has(type string) lookfor "in." search for variable types, variable name, or variable label isid mpg check if mpg uniquely identifies the data price 3,984 10,372 4,499 11,995 1 histogram mpg, frequency plot a histogram of the distribution of a variable BROWSE OBSERVATIONS WITHIN THE DATA Missing values are treated as the largest browse or Ctrl 8 positive number.

ISBN 9781597180504 - <strong>Stata</strong> <strong>Data</strong>

Stata Workshop 2 Data Management - Office of

Stata is a powerful statistical package with smart data-management facilities, a wide array of up-to-date statistical ques, and an excellent system for producing publication-quality graphs. In this tutorial we start with a quick introduction and overview and then discuss data management, statistics, graphs, and programming.You can write a book review and share your experiences.

Stata release 11 Book, 2009

To exclude missing values, ask whether the value is less than "." open the data editor list make price if price $10,000 display price[4] display the 4th observation in price; only works on single values gsort price mpg (ascending) gsort –price –mpg (descending) sort in order, first by price then miles per gallon duplicates report finds all duplicate values in each variable levelsof rep78 display the unique values for rep78 numbers words gen foren Numeric = real(foren String) "1" destring foren String, gen(foren Numeric) "1" encode foren String, gen(foren Numeric) "foren" recast double mpg generic way to convert between types SEE DATA DISTRIBUTION codebook make price overview of variable type, stats, number of missing/unique values summarize make price mpg print summary statistics (mean, stdev, min, max) for variables inspect mpg show histogram of data, number of missing or zero observations true/false missing string int long float double byte To convert between numbers & strings: gen foren String = string(foren) "1" 1 tostring foren, gen(foren String) "1" decode foren , gen(foren String) "foren" Explore Data Tim Essam ([email protected]) • Laura Hughes ([email protected]) Disclaimer: we are not affiliated with Stata. [=exp] column to save output as condition: only apply to apply a new variable apply the function specific rows command to if something is true To find out more about any command – like what options it takes – type help command AT COMMAND PROMPT Pg Dn function: what are you going to do to varlists?


Stata data management reference manual release 11:

Rating: 93 / 100

Overall: 98 Rates