API Reference

Utility Functions

concat(objs, **kwargs) Concatenate data in given objects
merge(left, right, **kwargs) Merge data in given objects

CAS

The CAS object is the connection to the CAS server. CAS actions can be called on this object. It also incorporates many of the data reader functions of the Pandas package.

Constructor

CAS([hostname, port, username, password, …]) Create a connection to a CAS server.

Session Management

CAS.close() Close the CAS connection
CAS.terminate() End the session and close the CAS connection
CAS.copy() Create a copy of the connection
CAS.fork([num]) Create multiple copies of a connection
CAS.session_context(*args, **kwargs) Create a context of session options

Reading Data

There are various ways of loading data into CAS: server-side parsed and loaded, client-side parsed, and client-side files uploaded and parsed on the server. They follow the a naming convention to prevent confusion.

  • load_* : Loads server-side paths
  • read_* : Uses client-side parsers, then uploads the result
  • upload_* : Uploads client-side files as-is which are parsed on the server

Server-Side Files

CAS.load_path([path, readahead, …]) Load a path from a CASLib

Client-Side Files

CAS.read_pickle(path[, casout]) Load pickled pandas object from the specified path
CAS.read_table(filepath_or_buffer[, casout]) Read general delimited file into a CAS table
CAS.read_csv(filepath_or_buffer[, casout]) Read CSV file into a CAS table
CAS.read_fwf(filepath_or_buffer[, casout]) Read a table of fixed-width formatted lines into a CAS table
CAS.read_clipboard([casout]) Read text from clipboard and pass to read_table()
CAS.read_excel(io[, casout]) Read an Excel table into a CAS table
CAS.read_html(io[, casout]) Read HTML tables into a list of CASTable objects
CAS.read_hdf(path_or_buf[, casout]) Read from the HDF store and create a CAS table
CAS.read_sas(filepath_or_buffer[, casout]) Read SAS files stored as XPORT or SAS7BDAT into a CAS table
CAS.read_sql_table(table_name, con[, casout]) Read SQL database table into a CAS table
CAS.read_sql_query(sql, con[, casout]) Read SQL query table into a CAS table
CAS.read_sql(sql, con[, casout]) Read SQL query or database table into a CAS table
CAS.read_gbq(query[, casout]) Load data from a Google BigQuery into a CAS table
CAS.read_stata(filepath_or_buffer[, casout]) Read Stata file into a CAS table
CAS.upload_file(data[, importoptions, casout]) Upload a client-side data file to CAS and parse it into a CAS table

Client-Side DataFrames

CAS.upload_frame(data[, importoptions, casout]) Upload a client-side data file to CAS and parse it into a CAS table

Running Actions

CAS.retrieve(_name_, **kwargs) Call the action and aggregate the results
CAS.invoke(_name_, **kwargs) Call an action on the server
CAS.__iter__() Iterate over responses from CAS
getone(connection[, datamsghandler]) Get a single response from a connection
getnext(*objs, **kwargs) Return responses as they appear from multiple connections

CASResults

The CASResults object is a subclass of Python’s ordered dictionary. CAS actions can return any number of result objects which are accessible by the dictionary keys. This class also defines several methods for handling tables in By groups.

Constructor

CASResults(*args, **kwargs) Ordered collection of results from a CAS action

By Group Processing

CASResults.get_tables(name[, set, concat]) Return all tables ending with name in all By groups
CASResults.get_group(*name, **kwargs) Return a CASResults object of the specified By group tables
CASResults.get_set(num) Return a CASResults object of the By group set
CASResults.concat_bygroups([inplace]) Concatenate all tables within a By group into a single table

SASDataFrame

The SASDataFrame object is a simple subclass of pandas.DataFrame. It merely adds attributes to hold SAS metadata such as titles, labels, column metadata, etc. It also adds a few utility methods for handling By group representations.

Constructor

SASDataFrame([data, index, columns, dtype, …]) Two-dimensional tabular data structure with SAS metadata added

Column Metadata

SASColumnSpec(name[, label, dtype, width, …]) Create a SASDataFrame column information object

Utilities

reshape_bygroups(items[, bygroup_columns, …]) Convert current By group representation to the specified representation

SASFormatter

The SASFormatter object can be used to apply SAS data formats to Python values. It will only work with builtin SAS data formats; not user-defined formats. If you need user-defined formats, the fetch action can be configured to bring back formatted values rather than raw values.

Constructor

SASFormatter([locale, soptions]) Create a locale-aware SAS value formatter

Formatting Data

SASFormatter.format(value[, sasfmt, width]) Format the given value

CASTable

The CASTable is essentially a client-side view of a table in the CAS server. CAS actions can be called on it directly just like a CAS connection object, and it also supports much of the Pandas pandas.DataFrame API.

Constructor

CASTable(name, **table_params) Object for interacting with CAS tables

CAS Connections

CASTable.get_connection() Get the registered connection object
CASTable.set_connection(connection) Set the connection to use for action calls

Setters and Getters

CASTable.__setattr__(name, value) Set attribute or parameter value
CASTable.__getattr__(name) Get named parameter, CAS action, or table column
CASTable.__delattr__(name) Delete an attribute

Attributes and Underlying Data

  • columns: column labels
CASTable.as_matrix([columns, n]) Convert the CASTable to its Numpy-array representation
CASTable.dtypes Series of the data types in the table
CASTable.ftypes Series of the ftypes (indication of sparse/dense and dtype) in the table
CASTable.get_dtype_counts() Retrieve the frequency of CAS table column data types
CASTable.get_ftype_counts() Retrieve the frequency of CAS table column data types
CASTable.select_dtypes([include, exclude, …]) Return a subset CASTable including/excluding columns based on data type
CASTable.values Numpy representation of the table
CASTable.axes List of the row axis labels and column axis labels
CASTable.ndim Number of axes dimensions
CASTable.size Number of elements in the table
CASTable.shape Return a tuple representing the dimensionality of the table

Indexing, Iteration

CASTable.drop(labels[, axis, level, …]) Return a new CASTable object with the specified columns removed
CASTable.head([n, columns, …]) Retrieve first n rows
CASTable.ix Label-based indexer with integer position fallback
CASTable.loc Label-based indexer
CASTable.iloc Integer location based indexing for selection by position
CASTable.__iter__() Iterate through all visible column names in self
CASTable.iteritems() Iterate over column names and CASColumn objects
CASTable.iterrows([chunksize]) Iterate over the rows of a CAS table as (index, pandas.Series) pairs
CASTable.itertuples([index, chunksize]) Iterate over rows as tuples
CASTable.lookup(row_labels, col_labels) Retrieve values indicated by row_labels, col_labels positions
CASTable.tail([n, columns, …]) Retrieve last n rows
CASTable.query(expr[, inplace, engine]) Query the table with a boolean expression

For more information on .ix, .loc, and .iloc, see the indexing documentation.

GroupBy

CASTable.groupby(by[, axis, level, …]) Specify grouping variables for the table

Computations / Descriptive Stats

CASTable.abs() Return a new CASTable with absolute values of numerics
CASTable.all([axis, bool_only, skipna, level]) Return whether all elements in the column are True
CASTable.any([axis, bool_only, skipna, level]) Return whether any elements in the column are True
CASTable.clip([lower, upper, axis]) Clip values at thresholds
CASTable.clip_lower(threshold[, axis]) Clip values at lower threshold
CASTable.clip_upper(threshold[, axis]) Clip values at upper threshold
CASTable.corr([method, min_periods]) Compute pairwise correlation of columns
CASTable.count([axis, level, numeric_only]) Return total number of non-missing values in each column
CASTable.css([casout]) Return the corrected sum of squares of the values of each column
CASTable.cv([casout]) Return the coefficient of variation of the values of each column
CASTable.describe([percentiles, include, …]) Get descriptive statistics
CASTable.eval(expr[, inplace, kwargs]) Evaluate a CAS table expression
CASTable.kurt([axis, skipna, level, …]) Return the kurtosis of the values of each column
CASTable.max([axis, skipna, level, …]) Return the maximum value of each column
CASTable.mean([axis, skipna, level, …]) Return the mean value of each column
CASTable.median([axis, skipna, level, …]) Return the median value of each numeric column
CASTable.min([axis, skipna, level, …]) Return the minimum value of each column
CASTable.mode([axis, numeric_only, max_tie, …]) Return the mode of each column
CASTable.nmiss([axis, level, numeric_only, …]) Return total number of missing values in each column
CASTable.probt([casout]) Return the p-value of the T-statistics of the values of each column
CASTable.quantile([q, axis, numeric_only, …]) Return values at the given quantile
CASTable.skew([axis, skipna, level, …]) Return the skewness of the values of each column
CASTable.stderr([casout]) Return the standard error of the values of each column
CASTable.sum([axis, skipna, level, …]) Return the sum of the values of each column
CASTable.std([axis, skipna, level, ddof, …]) Return the standard deviation of the values of each column
CASTable.tvalue([casout]) Return the T-statistics for hypothesis testing of the values of each column
CASTable.uss([casout]) Return the uncorrected sum of squares of the values of each column
CASTable.var([axis, skipna, level, ddof, …]) Return the variance of the values of each column

Reindexing / Selection / Label manipulation

CASTable.head([n, columns, …]) Retrieve first n rows
CASTable.sample([n, frac, replace, weights, …]) Returns a random sample of the CAS table rows
CASTable.tail([n, columns, …]) Retrieve last n rows

Sorting

Note

There is no concept of a sorted table in the server. The sort_values merely stores sorting information that is applied when fetching data.

CASTable.sort_values(by[, axis, ascending, …]) Specify sort parameters for data in a CAS table
CASTable.nlargest(n, columns[, keep, casout]) Return the n largest values ordered by columns
CASTable.nsmallest(n, columns[, keep, casout]) Return the n smallest values ordered by columns
CASTable.to_xarray(*args, **kwargs) Return an numpy.xarray() from the CAS table

Combining / Merging

CASTable.append(other[, ignore_index, …]) Append rows of other to self
CASTable.merge(right[, how, on, left_on, …]) Merge CASTable objects using a database-style join on a column

Plotting

CASTable.plot() is both a callable method and a namespace attribute for specific plotting methods of the form CASTable.plot.<kind>.

Note

In all of the plotting methods, the rendering is done completely on the client side. This means that all of the data is fetched in the background prior to doing the plotting.

Since plotting is done on the client-side, data must be downloaded to create the graphs. By default, the amount of data pulled down is limited by the cas.dataset.max_rows_fetched option. Sampling is used to randomize the data that is plotted. You can control the sampling with the following options:

sample_pct=float
The percentage of the rows of the original table to return given as a float value between 0 and 1. Using this option disables the cas.dataset.max_rows_fetched option row limits.
sample_seed=int
The seed for the random number generator given an as integer. This can be set to create deterministic sampling.
stratify_by='var-name'
Specifies the variable to do stratified sampling by.
sample=bool
A boolean used to indicate that the values fetched should be sampled. This is used in conjunction with the cas.dataset.max_rows_fetched option to return random samples up to that limit. It is assumed to be true when sample_pct= is specified.
CASTable.plot Make plots of the data in the CAS table
CASTable.plot.area([x, y]) Area plot
CASTable.plot.bar([x, y]) Bar plot
CASTable.plot.barh([x, y]) Horizontal bar plot
CASTable.plot.box([by]) Boxplot
CASTable.plot.density(**kwargs) Kernel density estimate plot
CASTable.plot.hexbin([x, y, C, …]) Hexbin plot
CASTable.plot.hist([by, bins]) Histogram
CASTable.plot.kde(**kwargs) Kernel density estimate plot
CASTable.plot.line([x, y]) Line plot
CASTable.plot.pie([y]) Pie chart
CASTable.plot.scatter(x, y[, s, c]) Scatter plot
CASTable.boxplot([column, by]) Make a boxplot from the table data
CASTable.hist([column, by]) Make a histogram from the table data

Serialization / IO / Conversion

CASTable.from_csv(connection, path[, casout]) Create a CASTable from a CSV file
CASTable.from_dict(connection, data[, casout]) Create a CASTable from a dictionary
CASTable.from_items(connection, items[, casout]) Create a CASTable from a (key, value) pairs
CASTable.from_records(connection, data[, casout]) Create a CASTable from records
CASTable.info([verbose, buf, max_cols, …]) Print summary of CASTable information
CASTable.to_pickle(*args, **kwargs) Pickle (serialize) the CAS table data
CASTable.to_csv(*args, **kwargs) Write CAS table data to comma separated values (CSV)
CASTable.to_hdf(*args, **kwargs) Write CAS table data to HDF
CASTable.to_sql(*args, **kwargs) Write CAS table records to SQL database
CASTable.to_dict(*args, **kwargs) Convert CAS table data to a Python dictionary
CASTable.to_excel(*args, **kwargs) Write CAS table data to an Excel spreadsheet
CASTable.to_json(*args, **kwargs) Convert the CAS table data to a JSON string
CASTable.to_html(*args, **kwargs) Render the CAS table data to an HTML table
CASTable.to_latex(*args, **kwargs) Render the CAS table data to a LaTeX tabular environment
CASTable.to_stata(*args, **kwargs) Write CAS table data to Stata file
CASTable.to_msgpack(*args, **kwargs) Write CAS table data to msgpack object
CASTable.to_gbq(*args, **kwargs) Write CAS table data to a Google BigQuery table
CASTable.to_records(*args, **kwargs) Convert CAS table data to record array
CASTable.to_sparse(*args, **kwargs) Convert CAS table data to SparseDataFrame
CASTable.to_dense(*args, **kwargs) Return dense representation of CAS table data
CASTable.to_string(*args, **kwargs) Render the CAS table to a console-friendly tabular output
CASTable.to_clipboard(*args, **kwargs) Write the CAS table data to the clipboard

Utilities

CASTable.copy([deep, exclude]) Make a copy of the CASTable object
CASTable.with_params(**kwargs) Create copy of table with kwargs inserted as parameters

CASColumn

While CAS does not have a true concept of a standalone column, the CASColumn object emulates one by creating a client-side view of the CAS table using just a single column. CASColumn objects are used much in the same way as pandas.Series objects. They support many of the pandas.Series methods, and can also be used in indexing operations to filter data in a CAS table.

Constructor

CASColumn(name, **table_params) Special subclass of CASTable for holding single columns

Attributes

CASColumn.values Return column data as numpy.ndarray()
CASColumn.dtype The data type of the underlying data
CASColumn.ftype The data type and whether it is sparse or dense
CASColumn.shape Return a tuple of the shape of the underlying data
CASColumn.ndim Return the number of dimensions of the underlying data
CASColumn.size Return the number of elements in the underlying data

Indexing, Iteration

CASColumn.ix Label-based indexer with integer position fallback
CASColumn.loc Label-based indexer
CASColumn.iloc Integer location based indexing for selection by position
CASColumn.__iter__() Iterate through all visible column names in self
CASColumn.iteritems([chunksize]) Lazily iterate over (index, value) tuples

For more information on .ix, .loc, and .iloc, see the indexing documentation.

Binary Operator Functions

CASColumn.add(other[, level, fill_value, axis]) Addition of CASColumn with other, element-wise
CASColumn.sub(other[, level, fill_value, axis]) Subtraction of CASColumn with other, element-wise
CASColumn.mul(other[, level, fill_value, axis]) Multiplication of CASColumn with other, element-wise
CASColumn.div(other[, level, fill_value, axis]) Floating division of CASColumn and other, element-wise
CASColumn.truediv(other[, level, …]) Floating division of CASColumn and other, element-wise
CASColumn.floordiv(other[, level, …]) Integer division of CASColumn and other, element-wise
CASColumn.mod(other[, level, fill_value, axis]) Modulo of CASColumn and other, element-wise
CASColumn.pow(other[, level, fill_value, axis]) Exponential power of CASColumn and other, element-wise
CASColumn.radd(other[, level, fill_value, axis]) Addition of CASColumn and other, element-wise
CASColumn.rsub(other[, level, fill_value, axis]) Subtraction of CASColumn and other, element-wise
CASColumn.rmul(other[, level, fill_value, axis]) Multiplication of CASColumn and other, element-wise
CASColumn.rdiv(other[, level, fill_value, axis]) Floating division of CASColumn and other, element-wise
CASColumn.rtruediv(other[, level, …]) Floating division of CASColumn and other, element-wise
CASColumn.rfloordiv(other[, level, …]) Integer division of CASColumn and other, element-wise
CASColumn.rmod(other[, level, fill_value, axis]) Modulo of CASColumn and other, element-wise
CASColumn.rpow(other[, level, fill_value, axis]) Exponential power of CASColumn and other, element-wise
CASColumn.round([decimals, out]) Round each value of the CASColumn to the given number of decimals
CASColumn.lt(other[, axis]) Less-than comparison of CASColumn and other, element-wise
CASColumn.gt(other[, axis]) Greater-than comparison of CASColumn and other, element-wise
CASColumn.le(other[, axis]) Less-than-or-equal-to comparison of CASColumn and other, element-wise
CASColumn.ge(other[, axis]) Greater-than-or-equal-to comparison of CASColumn and other, element-wise
CASColumn.ne(other[, axis]) Not-equal-to comparison of CASColumn and other, element-wise
CASColumn.eq(other[, axis]) Equal-to comparison of CASColumn and other, element-wise

GroupBy

CASColumn.groupby(by[, axis, level, …]) Specify grouping variables for the table

Computations / Descriptive Stats

CASColumn.abs() Return absolute values element-wise
CASColumn.all([axis, bool_only, skipna, level]) Return whether all elements are True
CASColumn.any([axis, bool_only, skipna, level]) Return whether any elements are True
CASColumn.between(left, right[, inclusive]) Return boolean CASColumn equivalent to left <= value <= right
CASColumn.clip([lower, upper, out, axis]) Trim values at input threshold(s)
CASColumn.clip_lower(threshold[, axis]) Trim values below given threshold
CASColumn.clip_upper(threshold[, axis]) Trim values above given threshold
CASColumn.count([level]) Return the number of non-NA/null observations in the CASColumn
CASColumn.describe([percentiles, include, …]) Generate various summary statistics
CASColumn.max([axis, skipna, level, casout]) Return the maximum value
CASColumn.mean([axis, skipna, level, casout]) Return the mean value
CASColumn.median([q, axis, interpolation, …]) Return the median value
CASColumn.min([axis, skipna, level, casout]) Return the minimum value
CASColumn.mode([axis, max_tie]) Return the mode values
CASColumn.nlargest([n, keep, casout]) Return the n largest values
CASColumn.nsmallest([n, keep, casout]) Return the n smallest values
CASColumn.quantile([q, axis, interpolation, …]) Return the value at the given quantile
CASColumn.std([axis, skipna, level, ddof, …]) Return the standard deviation of the values
CASColumn.sum([axis, skipna, level, casout]) Return the sum of the values
CASColumn.var([axis, skipna, level, ddof, …]) Return the unbiased variance of the values
CASColumn.nmiss([casout]) Return number of missing values
CASColumn.stderr([casout]) Return standard error of the values
CASColumn.uss([casout]) Return uncorrected sum of squares of the values
CASColumn.css([casout]) Return corrected sum of squares of the values
CASColumn.cv([casout]) Return coefficient of variation of the values
CASColumn.tvalue([casout]) Return value of T-statistic for hypothetical testing
CASColumn.probt([casout]) Return p-value of the T-statistic
CASColumn.skew([casout]) Return skewness
CASColumn.kurt([casout]) Return kurtosis
CASColumn.unique([casout]) Return array of unique values in the CASColumn
CASColumn.nunique([dropna, casout]) Return number of unique elements in the CASColumn
CASColumn.is_unique Return boolean indicating if the values in the CASColumn are unique
CASColumn.value_counts([normalize, sort, …]) Return object containing counts of unique values

Selection

CASColumn.head([n, bygroup_as_index, casout]) Return first n rows of the column in a Series
CASColumn.isin(values) Return a boolean CASColumn indicating if the value is in the given values
CASColumn.sample([n, frac, replace, …]) Returns a random sample of the CAS table rows
CASColumn.tail([n, bygroup_as_index, casout]) Return last n rows of the column in a Series

Sorting

Note

There is no concept of a sorted table in the server. The sort_values merely stores sorting information that is applied when fetching data.

CASColumn.sort_values([axis, ascending, …]) Apply sort order parameters to fetches of the data in this column

Datetime Properties

CASColumn.dt can be used to access the values of a CAS table column as datetime-like properties. They are accessed as CASColumn.dt.<property>.

CASColumn.dt.year The year of the datetime
CASColumn.dt.month The month of the datetime January=1, December=12
CASColumn.dt.day The day of the datetime
CASColumn.dt.hour The hour of the datetime
CASColumn.dt.minute The minute of the datetime
CASColumn.dt.second The second of the datetime
CASColumn.dt.microsecond The microsecond of the datetime
CASColumn.dt.nanosecond The nanosecond of the datetime (always zero)
CASColumn.dt.week The week ordinal of the year
CASColumn.dt.weekofyear The week ordinal of the year
CASColumn.dt.dayofweek The day of the week (Monday=0, Sunday=6)
CASColumn.dt.weekday The day of the week (Monday=0, Sunday=6)
CASColumn.dt.dayofyear The ordinal day of the year
CASColumn.dt.quarter The quarter of the date
CASColumn.dt.is_month_start Logical indicating if first day of the month
CASColumn.dt.is_month_end Logical indicating if last day of the month
CASColumn.dt.is_quarter_start Logical indicating if first day of quarter
CASColumn.dt.is_quarter_end Logical indicating if last day of the quarter
CASColumn.dt.is_year_start Logical indicating if first day of the year
CASColumn.dt.is_year_end Logical indicating if the last day of the year
CASColumn.dt.daysinmonth The number of days in the month
CASColumn.dt.days_in_month The number of days in the month

String Handling

CASColumn.str can be used to access the values of a CAS table column as strings and apply operations. They are accessed as CASColumn.str.<method/property>.

CASColumn.str.capitalize() Capitalize first letter, lowercase the rest
CASColumn.str.contains(pat[, case, …]) Does the value contain the specified pattern?
CASColumn.str.count(pat[, flags]) Count occurrences of pattern in each value
CASColumn.str.endswith(pat[, case, …]) Does the table column end with the given pattern?
CASColumn.str.find(sub[, start, end]) Return lowest index of pattern in each value, or -1 on failure
CASColumn.str.index(sub[, start, end]) Return lowest index of pattern in each value
CASColumn.str.len() Compute the length of each value
CASColumn.str.lower() Lowercase the value
CASColumn.str.lstrip([to_strip]) Strip leading spaces
CASColumn.str.repeat(repeats) Duplicate value the specified number of times
CASColumn.str.replace(pat, repl[, …]) Replace a pattern in the data
CASColumn.str.rfind(sub[, start, end]) Return highest index of the pattern
CASColumn.str.rindex(sub[, start, end]) Return highest index of the pattern
CASColumn.str.rstrip([to_strip]) Strip trailing whitespace
CASColumn.str.startswith(pat[, …]) Does the table column start with the given pattern?
CASColumn.str.strip([to_strip]) Strip leading and trailing whitespace
CASColumn.str.title() Capitalize each word in the value
CASColumn.str.upper() Uppercase the value
CASColumn.str.isalpha() Does the value contain only alpha characters?
CASColumn.str.isdigit() Does the value contain only digits?
CASColumn.str.isspace() Does the value contain only whitespace?
CASColumn.str.islower() Does the value contain only lowercase characters?
CASColumn.str.isupper() Does the value contain only uppercase characters?
CASColumn.str.istitle() Is the value equivalent to the title representation?
CASColumn.str.isnumeric() Does the value contain a numeric representation?
CASColumn.str.isdecimal() Does the value contain a decimal representation?

SAS Functions

CASColumn.sas can be used to apply SAS functions to values in a table column. They are accessed as CASColumn.sas.<method>. Documentation for SAS functions can be seen at support.sas.com.

CASColumn.sas.abs() Computes the absolute value
CASColumn.sas.airy() Computes the value of the Airy function
CASColumn.sas.beta(param) Computes the value of the beta function
CASColumn.sas.cnonct(df, prob) Computes the noncentrality parameter from a chi-square distribution
CASColumn.sas.constant(name[, parameter]) Computes machine and mathematical constants
CASColumn.sas.dairy() Computes the derivative of the AIRY function
CASColumn.sas.digamma() Computes the value of the digamma function
CASColumn.sas.erf() Computes the value of the (normal) error function
CASColumn.sas.erfc() Computes the value of the complementary (normal) error function
CASColumn.sas.exp() Computes the value of the exponential function
CASColumn.sas.fact() Computes a factorial
CASColumn.sas.fnonct(ndf, ddf, prob) Computes the value of the noncentrality parameter of an F distribution
CASColumn.sas.gamma() Computes the value of the gamma function
CASColumn.sas.lgamma() Computes the natural logarithm of the Gamma function
CASColumn.sas.log() Computes the natural (base e) logarithm
CASColumn.sas.log1px() Computes the log of 1 plus the argument
CASColumn.sas.log10() Computes the logarithm to the base 10
CASColumn.sas.log2() Computes the logarithm to the base 2
CASColumn.sas.logbeta(param) Computes the logarithm of the beta function
CASColumn.sas.mod(divisor) Computes the remainder from the division with fuzzing
CASColumn.sas.modz(divisor) Computes the remainder from the division without fuzzing
CASColumn.sas.sign() Returns the sign of a value
CASColumn.sas.sqrt() Computes the square root of a value
CASColumn.sas.tnonct(df, prob) Computes the noncentrality parameter from the Student’s t distribution
CASColumn.sas.trigamma() Returns the value of the trigamma function

CASTableGroupBy

CASTableGroupBy objects are returned by CASTable.grouppby() and CASColumn.groupby().

Constructor

CASTableGroupBy(table, by[, axis, level, …]) Group CASTable / CASColumn objects by specified values

Indexing and Iteration

CASTableGroupBy.__iter__()
CASTableGroupBy.get_group(name[, obj]) Construct a CASTable / CASColumn with the given group key
CASTableGroupBy.query(*args, **kwargs) Query the table with a boolean expression

Conversion

CASTableGroupBy.to_frame(**kwargs) Retrieve all values into a DataFrame
CASTableGroupBy.to_series([name]) Retrieve all values into a Series

Computations / Descriptive Statistics

CASTableGroupBy.css(*args, **kwargs) Get css using groups
CASTableGroupBy.cv(*args, **kwargs) Get cv using groups
CASTableGroupBy.describe(*args, **kwargs) Get basic statistics using groups
CASTableGroupBy.head(*args, **kwargs) Retrieve first values of each group
CASTableGroupBy.max(*args, **kwargs) Get maximum values using groups
CASTableGroupBy.mean(*args, **kwargs) Get mean values using groups
CASTableGroupBy.median(*args, **kwargs) Get median values using groups
CASTableGroupBy.min(*args, **kwargs) Get minimum values using groups
CASTableGroupBy.mode(*args, **kwargs) Get mode values using groups
CASTableGroupBy.nth(n[, dropna]) Return the nth row from each group
CASTableGroupBy.nmiss(*args, **kwargs) Get nmiss using groups
CASTableGroupBy.nlargest(*args, **kwargs) Return the n largest values ordered by columns
CASTableGroupBy.nsmallest(*args, **kwargs) Return the n smallest values ordered by columns
CASTableGroupBy.nunique(*args, **kwargs) Get number of unique values using groups
CASTableGroupBy.probt(*args, **kwargs) Get probt using groups
CASTableGroupBy.quantile(*args, **kwargs) Get quantiles using groups
CASTableGroupBy.std(*args, **kwargs) Get std using groups
CASTableGroupBy.stderr(*args, **kwargs) Get stderr using groups
CASTableGroupBy.sum(*args, **kwargs) Get sum using groups
CASTableGroupBy.tvalue(*args, **kwargs) Get tvalue using groups
CASTableGroupBy.skew(*args, **kwargs) Get skewness using groups
CASTableGroupBy.kurt(*args, **kwargs) Get kurtosis using groups
CASTableGroupBy.unique(*args, **kwargs) Get unique values using groups
CASTableGroupBy.uss(*args, **kwargs) Get uss using groups
CASTableGroupBy.value_counts(*args, **kwargs) Get value counts using groups
CASTableGroupBy.var(*args, **kwargs) Get var using groups

CASResponse

CASResponse objects are primarily used internally, but they can be used in more advanced workflows. They are never instantiated directly, they will always be created by the CAS connection object and returned by an iterator.

Constructor

CASResponse(_sw_response[, soptions, connection]) Response from a CAS action

Response Properties

CASDisposition(_sw_response) Disposition of a CAS response
CASPerformance(_sw_response) Performance metrics of a CAS response

Data Message Handlers

Data message handlers are used to create custom data loaders. They construct the parameters to the addtable CAS action and handle the piece-wise loading of data into the server.

Note

Data message handlers are not currently supported in the REST interface.

CASDataMsgHandler(vars[, nrecs, reclen, …]) Base class for all CAS data message handlers
PandasDataFrame(data[, nrecs, dtype, …]) CAS data message handler for pandas.DataFrame objects
SAS7BDAT(path[, nrecs, transformers]) Create a SAS7BDAT data message handler
CSV(path[, nrecs, transformers]) Create a CSV data messsage handler
Text(path[, nrecs, transformers]) Create a Text data message handler
FWF(path[, nrecs, transformers]) Create an FWF data message handler
JSON(path[, nrecs, transformers]) Create a JSON data message handler
HTML(path[, index, nrecs, transformers]) Create an HTML data message handler
SQLTable(table, engine[, nrecs, transformers]) Create an SQLTable data message handler
SQLQuery(query, engine[, nrecs, transformers]) Create an SQLQuery data message handler
Excel(path[, sheet, nrecs, transformers]) Create an Excel data message handler
Clipboard([nrecs, transformers]) Create a Clipboard data message handler
DBAPI(module, cursor[, nrecs, transformers]) Create a Python DB-API 2.0 compliant data message handler

Date and Time Functions

The following date / time / datetime functions can be used to convert dates to and from Python, CAS, and SAS date values.

CAS Dates and Times

cas2python_timestamp(cts) Convert a CAS datetime to Python datetime
cas2python_datetime(cts) Convert a CAS datetime to Python datetime
cas2python_date(cdt) Convert a CAS date to a Python date
cas2python_time(ctm) Convert a CAS time to a Python time
python2cas_timestamp(pyts) Convert a Python datetime to CAS datetime
python2cas_datetime(pyts) Convert a Python datetime to CAS datetime
python2cas_date(pydt) Convert a Python date to a CAS date
python2cas_time(pytm) Convert a Python time to a CAS time
str2cas_timestamp(dts) Convert a string to a CAS timestamp
str2cas_datetime(dts) Convert a string to a CAS timestamp
str2cas_date(dts) Convert a string to a CAS date
str2cas_time(dts) Convert a string to a CAS time
cas2sas_timestamp(cdt) Convert a CAS timestamp to a SAS timestamp
cas2sas_datetime(cdt) Convert a CAS timestamp to a SAS timestamp
cas2sas_date(cdt) Convert a CAS date to a SAS date
cas2sas_time(cdt) Convert a CAS time to a SAS time

SAS Dates and Times

sas2python_timestamp(sts) Convert a SAS datetime to Python datetime
sas2python_datetime(sts) Convert a SAS datetime to Python datetime
sas2python_date(sdt) Convert a SAS date to a Python date
sas2python_time(sts) Convert a SAS time to a Python time
python2sas_timestamp(pyts) Convert a Python datetime to SAS datetime
python2sas_datetime(pyts) Convert a Python datetime to SAS datetime
python2sas_date(pydt) Convert a Python date to a SAS date
python2sas_time(pytm) Convert a Python time to a SAS time
str2sas_timestamp(dts) Convert a string to a SAS timestamp
str2sas_datetime(dts) Convert a string to a SAS timestamp
str2sas_date(dts) Convert a string to a SAS date
str2sas_time(dts) Convert a string to a SAS time
sas2cas_timestamp(sts) Convert a SAS datetime to CAS datetime
sas2cas_datetime(sts) Convert a SAS datetime to CAS datetime
sas2cas_date(sdt) Convert a SAS date to a CAS date
sas2cas_time(sts) Convert a SAS time to a CAS time