lightweight Java library designed to read SAS7BDAT datasets
19 February 2021
17 December 2020
19 August 2020
25 March 2019
28 September 2018
26 April 2018
12 January 2018
24 March 2017
14 March 2017
10 March 2017
8 March 2017
15 December 2016
24 October 2016
28 September 2016
28 March 2016
13 February 2016
Parso is a lightweight Java library that is designed to read SAS7BDAT datasets. The Parso interfaces are analogous to those that belong to libraries designed to read table-storing files, for example, CSVReader library. Despite its small size, the Parso library is the only full-featured open-source solution to process SAS7BDAT datasets (uncompressed, CHAR-compressed or BINARY-compressed). It is effective in processing clinical and statistical data, which is often stored in SAS7BDAT format. In addition, the Parso library allows users to convert data into CSV format.
EPAM has wide experience in integration services and will help you integrate Parso into your project. We will price those services based on your individual needs.
If you use Maven, add the following dependency into the pom.xml file:
<dependency>
<groupId>com.epam</groupId>
<artifactId>parso</artifactId>
<version>2.0.14</version>
</dependency>
Create a variable of the SasFileReader class and indicate your InputStream that contains the SAS7BDAT file as a parameter in the SasFileReader constructor:
com.epam.parso.SasFileReader sasFileReader = new SasFileReaderImpl(is);
To get the properties of a SAS7BDAT file, use:
sasFileReader.getSasFileProperties();
To get the description of the SAS7BDAT columns, use:
sasFileReader.getColumns();
To get the data of the SAS7BDAT file, use:
sasFileReader.readAll(); //to read all rows at once
sasFileReader.readNext(); //to read rows one by one
To convert the metadata of the file into CSV format, use:
Writer writer = new StringWriter();
CSVMetadataWriter csvMetadataWriter = new CSVMetadataWriterImpl(writer);
csvMetadataWriter.writeMetadata(sasFileReader.getColumns());
To convert the data of the file into CSV format, use:
Writer writer = new StringWriter();
CSVDataWriter csvDataWriter = new CSVDataWriterImpl(writer);
csvDataWriter.writeColumnNames(sasFileReader.getColumns());
To write all rows at once to the ‘writer’ variable:
csvDataWriter.writeRowsArray(sasFileReader.getColumns(), sasFileReader.readAll());
To write rows one by one to the ‘writer’ variable:
csvDataWriter.writeRow(sasFileReader.getColumns(), sasFileReader.readNext());
Copyright (C) 2015 EPAM
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
If the ALv2-licensed Parso does not satisfy your needs, please contact us at [email protected] to discuss the possibility of a commercial license.
We hope that you decide to use the Parso library. At EPAM, we are available to help you use, integrate, and support Parso.