Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem reading file due to BoundsError in _process_columnname_subheader #44

Closed
tk3369 opened this issue May 12, 2018 · 3 comments
Closed
Assignees
Labels

Comments

@tk3369
Copy link
Owner

tk3369 commented May 12, 2018

Error when reading this file
https://github.com/ppham27/sas_to_csv/blob/master/test_files/flightdelays.sas7bdat

julia> readsas("E:/ppham27/ flightdelays.sas7bdat")
Warning: Unknown file encoding value (0), defaulting to UTF-8
ERROR: BoundsError: attempt to access 1-element Array{Array{UInt8,1},1} at index [2]
Stacktrace:
 [1] _process_columnname_subheader( ::SASLib.Handler, ::Int64, ::Int64) at C:\Users\Folio\.julia\v0.6\ SASLib\src\SASLib.jl:744
 [2] _process_subheader(::SASLib. Handler, ::Int64, ::SASLib.SubHeaderPointer) at C:\Users\Folio\.julia\v0.6\ SASLib\src\SASLib.jl:582
 [3] _process_page_metadata(:: SASLib.Handler) at C:\Users\Folio\.julia\v0.6\ SASLib\src\SASLib.jl:476
 [4] _process_page_meta(::SASLib. Handler) at C:\Users\Folio\.julia\v0.6\ SASLib\src\SASLib.jl:427
 [5] _parse_metadata(::SASLib. Handler) at C:\Users\Folio\.julia\v0.6\ SASLib\src\SASLib.jl:400
 [6] _open(::SASLib.ReaderConfig) at C:\Users\Folio\.julia\v0.6\ SASLib\src\SASLib.jl:35
 [7] #readsas#16(::String, ::Bool, ::Array{Any,1}, ::Array{Any,1}, ::Dict{Any,Any}, ::Dict{Any,Any}, ::Dict{Symbol,Type}, ::Int64, ::SASLib.#readsas, ::String) at C:\Users\Folio\.julia\v0.6\ SASLib\src\SASLib.jl:162
 [8] readsas(::String) at C:\Users\Folio\.julia\v0.6\ SASLib\src\SASLib.jl:160
@tk3369 tk3369 added the bug label May 12, 2018
@tk3369 tk3369 self-assigned this May 12, 2018
@tk3369
Copy link
Owner Author

tk3369 commented May 12, 2018

The issue is that these files have metadata split into the pages and they are not necessary at the top of the file. The current code assumes that all meta info appears at the top before any data appears, which isn't the case here.

Layout for supervisors.sas7bdat:

  1. MIX (which contains meta info, data)
  2. AMD (which contains the rest of meta info)

Layout for flightdelays.sas7bdat:

  1. MIX (which contains meta info, data)
  2. DATA (10 pages)
  3. AMD (which contains the rest of meta info)

tk3369 added a commit that referenced this issue May 13, 2018
tk3369 added a commit that referenced this issue Aug 8, 2018
tk3369 added a commit that referenced this issue Aug 9, 2018
* Fixed issue #44 and #45
* Fixed all deprecation warnings from running in v0.7
@tk3369
Copy link
Owner Author

tk3369 commented Aug 10, 2018

Fixed in v0.6.2

@xiaodaigh
Copy link
Contributor

Not sure if one should worry about this and create the issue in #50 because if I tried to open the file in SAS it says

The open data operation failed. The following error occurred [Error] File xxxxx.......DATA is not a SAS data set.

I assume the data was written by something like haven?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants