Stata 15 help for import

[D] import -- Overview of importing data into Stata

Description

This entry provides a quick reference for determining which method to use for reading non-Stata data into memory. See [U] 21 Entering and importing data for more details.

Summary of the different methods

import excel (see [D] import excel)

1. import excel reads worksheets from Microsoft Excel (.xls and .xlsx) files.

2. Entire worksheets can be read, or custom cell ranges can be read.

import delimited (see [D] import delimited)

1. import delimited reads text-delimited files.

2. The data can be tab-separated or comma-separated. A custom delimiter may also be specified.

3. An observation must be on only one line.

4. The first line of the file can optionally contain the names of the variables.

odbc (see [D] odbc)

1. ODBC, an acronym for Open DataBase Connectivity, is a standard for exchanging data between programs. Stata supports the ODBC standard for importing data via the odbc command and can read from any ODBC data source on your computer.

infile (free format) -- infile without a dictionary (see infile1)

1. The data can be space-separated, tab-separated, or comma-separated.

2. Strings with embedded spaces or commas must be enclosed in quotes (even if tab- or comma-separated).

3. An observation can be on more than one line, or there can even be multiple observations per line.

infix (fixed format) (see [D] infix (fixed format))

1. The data must be in fixed-column format.

2. An observation can be on more than one line.

3. infix has simpler syntax than infile (fixed format).

infile (fixed format) -- infile with a dictionary (see infile2)

1. The data may be in fixed-column format.

2. An observation can be on more than one line.

3. ASCII or EBCDIC data can be read.

4. infile (fixed format) has the most capabilities for reading data.

import sasxport (see [D] import sasxport)

1. import sasxport reads SAS XPORT Transport format files.

2. import sasxport will also read value label information from a formats.xpf XPORT file, if available.

import fred (see [D] import fred)

1. import fred reads Federal Reserve Economic Data.

2. To use import fred, you must have a valid API key obtained from the St. Louis Federal Reserve.

import haver (Windows only) (see [D] import haver)

1. import haver reads Haver Analytics (http://www.haver.com/) database files.

import dbase (see [D] import dbase)

1. import dbase reads a version III or version IV dBase (.dbf) file.

spshape2dta (see [SP] spshape2dta)

1. spshape2dta translates the .dbf and .shp files of a shapefile into two Stata datasets.

Video example

Copy/paste data from Excel into Stata


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index