SAS To Table (Conversion)

Summary

Converts a SAS dataset to a table.

Usage

  • This tool supports connection to SAS Desktop installed on a local computer or connection to SAS Cloud Analytic Services (CAS). If you're using CAS, the order of the records may change during conversion.

  • The Custom Session Configuration File parameter must be used for remote deployments of SAS, such as Workspace Server, UNIX, and Mainframe. If SAS is installed on the same machine as ArcGIS Pro, the configuration file is not required.

    Learn more about SAS session configurations

  • Provide the SAS dataset in the form libref.tablename in which libref is the name of a SAS or CAS library and tablename is the name of the SAS dataset. For example, SASUSER.MYTABLE references a SAS dataset named MYTABLE in the SASUSER library.

  • SAS libraries, dataset names, and column names are not case sensitive. For example, SASUSER.MYTABLE is treated the same as sasuser.mytable and SASUser.MyTable.

  • The number of records that can be converted depends on the available memory of your computer.

  • SAS dataset column formats will not be preserved in the output table.

  • For a local SAS deployment, the SASUSER, WORK, SASHELP, MAPS, MAPSSAS, and MAPSGFK libraries are available by default. To use a custom library, the libref must be defined in your SAS Autoexec file.

    Learn more about Autoexec configurations

Parameters

LabelExplanationData Type
Input SAS Dataset (libref.tablename)

The input SAS dataset. Provide the dataset in the form libref.tablename in which libref is the name of a SAS library and tablename is the name of the SAS dataset.

String
Output Table

The output table.

Table
Download SAS Dataset from SAS Cloud Analytic Services (CAS)
(Optional)

Specifies whether the input SAS dataset will be downloaded from CAS or accessed from a local SAS library.

  • Checked—The input SAS dataset will be downloaded from CAS.
  • Unchecked—The input SAS dataset will be accessed from a local SAS library. This is the default.

Boolean
CAS Hostname URL
(Optional)

The URL of the CAS host.

String
Port
(Optional)

The port of the CAS connection.

Long
CAS Username
(Optional)

The user name for the CAS connection.

String
Password
(Optional)

The password for the CAS connection. This password is hidden and not accessible after running the tool.

String Hidden
Custom Session Configuration File
(Optional)

The file specifying custom configurations for the SAS session. The file is only required for customized local or remote SAS deployments.

File

arcpy.conversion.SASToTable(in_sas_dataset, out_table, {use_cas_connection}, {hostname}, {port}, {username}, {password}, {custom_cfg_file})
NameExplanationData Type
in_sas_dataset

The input SAS dataset. Provide the dataset in the form libref.tablename in which libref is the name of a SAS library and tablename is the name of the SAS dataset.

String
out_table

The output table.

Table
use_cas_connection
(Optional)

Specifies whether the input SAS dataset will be downloaded from CAS or accessed from a local SAS library.

  • USE_CASThe input SAS dataset will be downloaded from CAS.
  • LOCAL_SASThe input SAS dataset will be accessed from a local SAS library. This is the default.
Boolean
hostname
(Optional)

The URL of the CAS host.

String
port
(Optional)

The port of the CAS connection.

Long
username
(Optional)

The user name for the CAS connection.

String
password
(Optional)

The password for the CAS connection. This password is hidden and not accessible after running the tool.

String Hidden
custom_cfg_file
(Optional)

The file specifying custom configurations for the SAS session. The file is only required for customized local or remote SAS deployments.

File

Code sample

SASToTable example 1 (Python window)

The following Python window script demonstrates how to use the SASToTable function with a local SAS installation.

import arcpy
arcpy.conversion.SASToTable("sashelp.cars", "CarsTable", "LOCAL_SAS")
SASToTable example 2 (stand-alone script)

The following stand-alone Python script demonstrates how to use the SASToTable function using a connection to CAS.

# Import system modules
import arcpy
import getpass

# Provide tool parameters
in_SASDS = "casuser.MySASData"
out_table = "MyEsriData"
connection = "USE_CAS"
hosturl = https://XXX.vdp.sas.com/XXX-XXXXX-default-http/ 
port = 100
username = "CAS_user"

# Provide password securely
password = getpass.getpass()

try:
    # Set the workspace and run the tool.
    arcpy.env.workspace = r"C:\\SASToTable\\MyData.gdb"
    arcpy.conversion.SASToTable(in_SASDS, out_table, connection, hosturl,
                     port, username, password)

except arcpy.ExecuteError:
    # If an error occurred when running the tool, print the error message.
    print(arcpy.GetMessages())

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics