Skip to content
FileIO.jl integration for Stata, SPSS, and SAS files
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
src
test
.codecov.yml
.gitignore
.travis.yml
LICENSE.md
NEWS.md
README.md
REQUIRE
appveyor.yml

README.md

StatFiles

Project Status: Active - The project has reached a stable, usable state and is being actively developed. Build Status Build status StatFiles codecov.io

Overview

This package provides load support for Stata, SPSS, and SAS files under the FileIO.jl package.

Installation

Use Pkg.add("StatFiles") in Julia to install StatFiles and its dependencies.

Usage

Load a Stata, SPSS, or SAS file

To read a Stata, SPSS, or SAS file into a DataFrame, use the following julia code:

using StatFiles, DataFrames

df = DataFrame(load("data.dta"))

The call to load returns a struct that is an IterableTable.jl, so it can be passed to any function that can handle iterable tables, i.e. all the sinks in IterableTable.jl. Here are some examples of materializing a Stata, SPSS, or SAS file into data structures that are not a DataFrame:

using StatFiles, DataTables, IndexedTables, TimeSeries, Temporal, Gadfly

# Load into a DataTable
dt = DataTable(load("data.dta"))

# Load into an IndexedTable
it = IndexedTable(load("data.dta"))

# Load into a TimeArray
ta = TimeArray(load("data.dta"))

# Load into a TS
ts = TS(load("data.dta"))

# Plot directly with Gadfly
plot(load("data.dta"), x=:a, y=:b, Geom.line)

Using the pipe syntax

load also support the pipe syntax. For example, to load a Stata, SPSS, or SAS file into a DataFrame, one can use the following code:

using StatFiles, DataFrame

df = load("data.dta") |> DataFrame

The pipe syntax is especially useful when combining it with Query.jl queries, for example one can easily load a Stata, SPSS, or SAS file, pipe it into a query, then pipe it to the save function to store the results in a new file.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.