# Contributing new methods¶

## Overview¶

This module is broken into product areas that largely follow the SAS product areas. There are many many procedures, which translate to object methods, that are not currently included in the package. The aim of this document is to outline the steps you can take to add additional methods (procedures).

A copy of the process is included inline of each product file (sasstat.py, sasets.py, sasqc.py, and so on). The project maintainers expect that a new contribution should take less than 30 minutes the first time and less than 15 minutes for subsequent methods.

Your contribution and feedback is greatly appreciated!

### Process¶

1. Identify the product of the procedure (SAS/STAT, SAS/ETS, SAS Enterprise Miner, etc).

2. Find the corresponding file in saspy sasstat.py, sasets.py, sasml.py, etc.

3. Create a set of valid statements. Here is an example:

lset = {'ARIMA', 'BY', 'ID', 'MACURVES', 'MONTHLY', 'OUTPUT', 'VAR'}


The case and order of the items will be formated.

4. Call the doc_convert method to generate then method call as well as the docstring markup

import saspy
print(saspy.sasdecorator.procDecorator.doc_convert(lset, 'x11')['method_stmt'])
print(saspy.sasdecorator.procDecorator.doc_convert(lset, 'x11')['markup_stmt'])


The doc_convert method takes two arguments: a list of the valid statements and the proc name. It returns a dictionary with two keys, method_stmt and markup_stmt. These outputs can be copied into the appropriate product file.

5. Add the proc decorator to the new method.

The decorator should be on the line above the method declaration. The decorator takes one argument, the required statements for the procedure. If there are no required statements than an empty list {} should be passed. Here are two examples one with no required arguments:

@procDecorator.proc_decorator({})
def esm(self, data: ['SASdata', str] = None, ...


And one with required arguments:

@procDecorator.proc_decorator({'model'})
def mixed(self, data: ['SASdata', str] = None, ...