This package provides load support for Stata, SPSS, and SAS files under the FileIO.jl package.
Use Pkg.add("StatFiles")
in Julia to install StatFiles and its dependencies.
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)
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, DataFrames 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.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4