sas7bdat.py
===========
This module will read sas7bdat files using pure Python (2.6+, 3+). No SAS software
required! The module started out as a port of the R script of the same name
found here: <https://github.com/BioStatMatt/sas7bdat> but has since been
completely rewritten.
Also included with this library is a simple command line script,
`sas7bdat_to_csv`, which converts sas7bdat files to csv files. It will also
print out header information and meta data using the `--header` option and it
will batch convert files as well. Use the `--help` option for more information.
As is, I've successfully tested the script almost three hundred sample files I
found on the internet. For the most part, it works well. We can now read
compressed files!
I'm sure there are more issues that I haven't come across yet. Please let me
know if you come across a data file that isn't supported and I'll see if I can
add support for the file.
This module is modified by Yao Xiao.
Usage
=====
To install, run:
```
pip install sas7bdat
```
To create a sas7bdat object, simply pass the constructor a file path. The
object is iterable so you can read the contents like this:
```
#!python
from sas7bdat import SAS7BDAT
with SAS7BDAT('foo.sas7bdat', skip_header=True) as reader:
for row in reader:
print row
```
Each row will be a list of values of type `string`, `float`, `datetime.date`,
`datetime.datetime`, or `datetime.time`. Without `skip_header`, the first row
returned will be the SAS variable names.
If you'd like to get a pandas DataFrame, use the `to_data_frame` method:
```
#!python
df = reader.to_data_frame()
```
[Variable
attributes](https://support.sas.com/documentation/cdl/en/lrcon/65287/HTML/default/viewer.htm#n08fs0rt7fikeln1uh0t8v5pt25d.htm)
are available from `reader.columns`. The order of these columns will be the same
as the corresponding values in each `row`. Each `Column` has the following
attributes:
* `col_id` (`int`) - the column number
* `name` (`bytes`)
* `label` (`bytes`)
* `format` (`str`)
* `type` (`str`)
* `length` (`int`)
Raw data
{
"_id": null,
"home_page": "https://github.com/kaellwen/sas7bdat.git",
"name": "sas7bdatx",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "sas, sas7bdat, csv, converter",
"author": "Jared Hobbs, Yao Xiao",
"author_email": "kaellwen@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/d7/7e/279b85d0b6d120e3a286c15122a19d623145fae0bacc54a2564cff518d78/sas7bdatx-2.2.3.3.tar.gz",
"platform": null,
"description": "sas7bdat.py\r\n===========\r\n\r\nThis module will read sas7bdat files using pure Python (2.6+, 3+). No SAS software\r\nrequired! The module started out as a port of the R script of the same name\r\nfound here: <https://github.com/BioStatMatt/sas7bdat> but has since been\r\ncompletely rewritten.\r\n\r\nAlso included with this library is a simple command line script,\r\n`sas7bdat_to_csv`, which converts sas7bdat files to csv files. It will also\r\nprint out header information and meta data using the `--header` option and it\r\nwill batch convert files as well. Use the `--help` option for more information.\r\n\r\nAs is, I've successfully tested the script almost three hundred sample files I\r\nfound on the internet. For the most part, it works well. We can now read\r\ncompressed files!\r\n\r\nI'm sure there are more issues that I haven't come across yet. Please let me\r\nknow if you come across a data file that isn't supported and I'll see if I can\r\nadd support for the file.\r\n\r\nThis module is modified by Yao Xiao.\r\n\r\nUsage\r\n=====\r\n\r\nTo install, run:\r\n\r\n```\r\npip install sas7bdat\r\n```\r\n\r\nTo create a sas7bdat object, simply pass the constructor a file path. The\r\nobject is iterable so you can read the contents like this:\r\n\r\n```\r\n#!python\r\nfrom sas7bdat import SAS7BDAT\r\nwith SAS7BDAT('foo.sas7bdat', skip_header=True) as reader:\r\n for row in reader:\r\n print row\r\n```\r\n\r\nEach row will be a list of values of type `string`, `float`, `datetime.date`,\r\n`datetime.datetime`, or `datetime.time`. Without `skip_header`, the first row\r\nreturned will be the SAS variable names.\r\n\r\nIf you'd like to get a pandas DataFrame, use the `to_data_frame` method:\r\n\r\n```\r\n#!python\r\ndf = reader.to_data_frame()\r\n```\r\n\r\n[Variable\r\nattributes](https://support.sas.com/documentation/cdl/en/lrcon/65287/HTML/default/viewer.htm#n08fs0rt7fikeln1uh0t8v5pt25d.htm)\r\nare available from `reader.columns`. The order of these columns will be the same\r\nas the corresponding values in each `row`. Each `Column` has the following\r\nattributes:\r\n\r\n* `col_id` (`int`) - the column number\r\n* `name` (`bytes`)\r\n* `label` (`bytes`)\r\n* `format` (`str`)\r\n* `type` (`str`)\r\n* `length` (`int`)\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A sas7bdat file reader for Python",
"version": "2.2.3.3",
"project_urls": {
"Homepage": "https://github.com/kaellwen/sas7bdat.git"
},
"split_keywords": [
"sas",
" sas7bdat",
" csv",
" converter"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9fcca8568cc29a7c1972aaff02f033cddd9950eb81a3dcec6d3265b43a4be9c0",
"md5": "f728be2ca786512838ab51c7b253c4b4",
"sha256": "a7b67eb85d8a19b4d6d644854ad1c06fc91c69ec05fbfd1a0183045688c8c135"
},
"downloads": -1,
"filename": "sas7bdatx-2.2.3.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f728be2ca786512838ab51c7b253c4b4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 16883,
"upload_time": "2024-12-04T06:05:08",
"upload_time_iso_8601": "2024-12-04T06:05:08.186678Z",
"url": "https://files.pythonhosted.org/packages/9f/cc/a8568cc29a7c1972aaff02f033cddd9950eb81a3dcec6d3265b43a4be9c0/sas7bdatx-2.2.3.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d77e279b85d0b6d120e3a286c15122a19d623145fae0bacc54a2564cff518d78",
"md5": "23fb674af5772b2725be125b0efdf1d9",
"sha256": "3e5555976488dbd112e4a1c6e406311a1b575f19a3b01bfff7d93297036923ca"
},
"downloads": -1,
"filename": "sas7bdatx-2.2.3.3.tar.gz",
"has_sig": false,
"md5_digest": "23fb674af5772b2725be125b0efdf1d9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 19282,
"upload_time": "2024-12-04T06:05:09",
"upload_time_iso_8601": "2024-12-04T06:05:09.491580Z",
"url": "https://files.pythonhosted.org/packages/d7/7e/279b85d0b6d120e3a286c15122a19d623145fae0bacc54a2564cff518d78/sas7bdatx-2.2.3.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-04 06:05:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kaellwen",
"github_project": "sas7bdat",
"github_not_found": true,
"lcname": "sas7bdatx"
}