Skip to main content

A helper class for reading sas7bdat database files

Project description

Sasdbpy

This is a simple helper class to read and use data stored in sas7bdat format, without having Sas.

This code will help you:

  • explore a folder and identify all sas7bdat present therein
  • have them organized in a python dictionary with, for each file:
    • the data as a pandas Dataframe
    • a field name mapper from the coded field name to the description from the meta data
    • a more detailed fields characteristics dataframe with information of Type, Length, Format
  • Two search functions on the field names:
    • search_field, to identify fields from the database containing a certain string
    • search_field_description, to reverse search fields from a string contained in their description

Usage

from sasdbpy.sasdbreader import SasDbReader
sdb = SasDbReader("[the folder path with the sas files]")

# get list of tables found
list_tables = list(sdb.res_data.keys())

#get the dataframe for one of the tables
table_name = list_tables[0]
df = sbd.res_data[table_name]['data']

#get field description map
sdb.res_data[table_name]['detail_fields']

# search for a field in the whole database
sdb.search_field('USERID')
# with information on the table where it sits
sdb.search_field('USERID', location=True)

# reverse search
sdb.search_field_description('identity')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sasdbpy-0.0.8.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sasdbpy-0.0.8-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file sasdbpy-0.0.8.tar.gz.

File metadata

  • Download URL: sasdbpy-0.0.8.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.10

File hashes

Hashes for sasdbpy-0.0.8.tar.gz
Algorithm Hash digest
SHA256 5c3491b63738a0966e8886dc1efe6637f5f252e9162c086e46bb5221c50e0163
MD5 c4aecec88d2b9208a94a7ab2b4c8a2ba
BLAKE2b-256 182f013e4d27b68232206b2d0d692bbe5e976509f317c1919ab2109d9a362424

See more details on using hashes here.

File details

Details for the file sasdbpy-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: sasdbpy-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.10

File hashes

Hashes for sasdbpy-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 e5b36cded5e4e4de53b36b00f5de48f1efe9e29108fd941677d3067e8d96f1c0
MD5 71405d3ac21aa1b512d83a3716bbfcca
BLAKE2b-256 6a7261d61eae8917f14d71a81758f57ec68f0e62ab815fd5f198b7ba20ff33cf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page