Ready to get started?

Download a free trial of the SASxpt Cmdlets to get started:

 Download Now

Learn more:

SAS XPORT files Icon SASxpt Data Cmdlets

An easy-to-use set of PowerShell Cmdlets offering real-time access to SAS xpt (XPORT) files. The Cmdlets allow users to easily read, write, update, and delete live data - just like working with SQL server.

Pipe SAS xpt Data to CSV in PowerShell



Use standard PowerShell cmdlets to access SAS xpt tables.

The CData Cmdlets Module for SAS xpt is a standard PowerShell module offering straightforward integration with SAS xpt. Below, you will find examples of using our SASXpt Cmdlets with native PowerShell cmdlets.

Creating a Connection to Your SAS xpt Data

Connecting to Local SASXpt Files

You can connect to local SASXpt file by setting the URI to a folder containing SASXpt files.

Connecting to S3 data source

You can connect to Amazon S3 source to read SASXpt files. Set the following properties to connect:

  • URI: Set this to the folder within your bucket that you would like to connect to.
  • AWSAccessKey: Set this to your AWS account access key.
  • AWSSecretKey: Set this to your AWS account secret key.
  • TemporaryLocalFolder: Set this to the path, or URI, to the folder that is used to temporarily download SASXpt file(s).

Connecting to Azure Data Lake Storage Gen2

You can connect to ADLS Gen2 to read SASXpt files. Set the following properties to connect:

  • URI: Set this to the name of the file system and the name of the folder which contacts your SASXpt files.
  • AzureAccount: Set this to the name of the Azure Data Lake storage account.
  • AzureAccessKey: Set this to our Azure DataLakeStore Gen 2 storage account access key.
  • TemporaryLocalFolder: Set this to the path, or URI, to the folder that is used to temporarily download SASXpt file(s).

$conn = Connect-SASXpt  -URI "$URI"

Selecting Data

Follow the steps below to retrieve data from the SampleTable_1 table and pipe the result into to a CSV file:

Select-SASXpt -Connection $conn -Table SampleTable_1 | Select -Property * -ExcludeProperty Connection,Table,Columns | Export-Csv -Path c:\mySampleTable_1Data.csv -NoTypeInformation

You will notice that we piped the results from Select-SASXpt into a Select-Object cmdlet and excluded some properties before piping them into an Export-Csv cmdlet. We do this because the CData Cmdlets append Connection, Table, and Columns information onto each "row" in the result set, and we do not necessarily want that information in our CSV file.

The Connection, Table, and Columns are appended to the results in order to facilitate piping results from one of the CData Cmdlets directly into another one.