def partition(self, var: str='', fraction: float=0.7, seed: int=9878, kfold: int=1, out: 'SASdata'=None, singleOut: bool=True) -> object:
    '\n        Partition a sas data object using SRS sampling or if a variable is specified then\n        stratifying with respect to that variable\n\n        :param var: variable(s) for stratification. If multiple then space delimited list\n        :param fraction: fraction to split\n        :param seed: random seed\n        :param kfold: number of k folds\n        :param out: the SAS data object\n        :param singleOut: boolean to return single table or seperate tables\n        :return: Tuples or SAS data object\n        '
    i = 1
    code = ''
    try:
        k = int(kfold)
    except ValueError:
        print('Kfold must be an integer')
    if (out is None):
        out_table = self.table
        out_libref = self.libref
    elif (not isinstance(out, str)):
        out_table = out.table
        out_libref = out.libref
    else:
        try:
            out_table = out.split('.')[1]
            out_libref = out.split('.')[0]
        except IndexError:
            out_table = out
            out_libref = 'work'
    while (i <= k):
        if (k == 1):
            code += ('proc hpsample data=%s.%s %s out=%s.%s %s samppct=%s seed=%s Partition;\n' % (self.libref, self.table, self._dsopts(), out_libref, out_table, self._dsopts(), (fraction * 100), seed))
        else:
            seed += 1
            code += ('proc hpsample data=%s.%s %s out=%s.%s %s samppct=%s seed=%s partition PARTINDNAME=_cvfold%s;\n' % (self.libref, self.table, self._dsopts(), out_libref, out_table, self._dsopts(), (fraction * 100), seed, i))
        if (len(var) > 0):
            if (i == 1):
                num_string = "\n                        data _null_; file LOG;\n                          d = open('{0}.{1}');\n                          nvars = attrn(d, 'NVARS'); \n                          put 'VARLIST=';\n                          do i = 1 to nvars; \n                             vart = vartype(d, i);\n                             var  = varname(d, i);\n                             if vart eq 'N' then\n                                put %upcase('var=') var %upcase('varEND=');\n                          end;\n                          put 'VARLISTEND=';\n                        run;\n                        "
                nosub = self.sas.nosub
                self.sas.nosub = False
                ll = self.sas.submit(num_string.format(self.libref, (self.table + self._dsopts())))
                self.sas.nosub = nosub
                numlist = []
                log = ll['LOG'].rpartition('VARLISTEND=')[0].rpartition('VARLIST=')
                for vari in range(log[2].count('VAR=')):
                    log = log[2].partition('VAR=')[2].partition(' VAREND=')
                    numlist.append(log[0].strip())
                if isinstance(var, str):
                    tlist = var.split()
                elif isinstance(var, list):
                    tlist = var
                else:
                    raise SyntaxError(('var must be a string or list you submitted: %s' % str(type(var))))
            if set(numlist).isdisjoint(tlist):
                if isinstance(var, str):
                    code += ('class _character_;\ntarget %s;\nvar _numeric_;\n' % var)
                else:
                    code += ('class _character_;\ntarget %s;\nvar _numeric_;\n' % ' '.join(var))
            else:
                varlist = [x for x in numlist if (x not in tlist)]
                varlist.extend([('_cvfold%s' % j) for j in range(1, i) if ((k > 1) and (i > 1))])
                code += ('class %s _character_;\ntarget %s;\nvar %s;\n' % (var, var, ' '.join(varlist)))
        else:
            code += 'class _character_;\nvar _numeric_;\n'
        code += 'run;\n'
        i += 1
    split_code = ''
    if (not singleOut):
        split_code += 'DATA '
        for j in range(1, (k + 1)):
            split_code += ('\t%s.%s%s_train(drop=_Partind_ _cvfold:)\n' % (out_libref, out_table, j))
            split_code += ('\t%s.%s%s_score(drop=_Partind_ _cvfold:)\n' % (out_libref, out_table, j))
        split_code += (';\n \tset %s.%s;\n' % (out_libref, out_table))
        for z in range(1, (k + 1)):
            split_code += ('\tif _cvfold%s = 1 or _partind_ = 1 then output %s.%s%s_train;\n' % (z, out_libref, out_table, z))
            split_code += ('\telse output %s.%s%s_score;\n' % (out_libref, out_table, z))
        split_code += 'run;'
    runcode = True
    if self.sas.nosub:
        print(((code + '\n\n') + split_code))
        runcode = False
    ll = self._is_valid()
    if ll:
        runcode = False
    if runcode:
        ll = self.sas.submit((code + split_code), 'text')
        elog = []
        for line in ll['LOG'].splitlines():
            if line[self.sas.logoffset:].startswith('ERROR'):
                elog.append(line)
        if len(elog):
            raise RuntimeError('\n'.join(elog))
        if (not singleOut):
            outTableList = []
            if (k == 1):
                return (self.sas.sasdata(((out_table + str(k)) + '_train'), out_libref, dsopts=self._dsopts()), self.sas.sasdata(((out_table + str(k)) + '_score'), out_libref, dsopts=self._dsopts()))
            for j in range(1, (k + 1)):
                outTableList.append((self.sas.sasdata(((out_table + str(j)) + '_train'), out_libref, dsopts=self._dsopts()), self.sas.sasdata(((out_table + str(j)) + '_score'), out_libref, dsopts=self._dsopts())))
            return outTableList
        if out:
            if (not isinstance(out, str)):
                return out
            else:
                return self.sas.sasdata(out_table, out_libref, self.results)
        else:
            return self
Partition a sas data object using SRS sampling or if a variable is specified then
stratifying with respect to that variable

:param var: variable(s) for stratification. If multiple then space delimited list
:param fraction: fraction to split
:param seed: random seed
:param kfold: number of k folds
:param out: the SAS data object
:param singleOut: boolean to return single table or seperate tables
:return: Tuples or SAS data object
def partition(self, var: str=, fraction: float=0.7, seed: int=9878, kfold: int=1, out: 'SASdata'=None, singleOut: bool=True) -> object:
    '\n        Partition a sas data object using SRS sampling or if a variable is specified then\n        stratifying with respect to that variable\n\n        :param var: variable(s) for stratification. If multiple then space delimited list\n        :param fraction: fraction to split\n        :param seed: random seed\n        :param kfold: number of k folds\n        :param out: the SAS data object\n        :param singleOut: boolean to return single table or seperate tables\n        :return: Tuples or SAS data object\n        '
    i = 1
    code = 
    try:
        k = int(kfold)
    except ValueError:
        print('Kfold must be an integer')
    if (out is None):
        out_table = self.table
        out_libref = self.libref
    elif (not isinstance(out, str)):
        out_table = out.table
        out_libref = out.libref
    else:
        try:
            out_table = out.split('.')[1]
            out_libref = out.split('.')[0]
        except IndexError:
            out_table = out
            out_libref = 'work'
    while (i <= k):
        if (k == 1):
            code += ('proc hpsample data=%s.%s %s out=%s.%s %s samppct=%s seed=%s Partition;\n' % (self.libref, self.table, self._dsopts(), out_libref, out_table, self._dsopts(), (fraction * 100), seed))
        else:
            seed += 1
            code += ('proc hpsample data=%s.%s %s out=%s.%s %s samppct=%s seed=%s partition PARTINDNAME=_cvfold%s;\n' % (self.libref, self.table, self._dsopts(), out_libref, out_table, self._dsopts(), (fraction * 100), seed, i))
        if (len(var) > 0):
            if (i == 1):
                num_string = "\n                        data _null_; file LOG;\n                          d = open('{0}.{1}');\n                          nvars = attrn(d, 'NVARS'); \n                          put 'VARLIST=';\n                          do i = 1 to nvars; \n                             vart = vartype(d, i);\n                             var  = varname(d, i);\n                             if vart eq 'N' then\n                                put %upcase('var=') var %upcase('varEND=');\n                          end;\n                          put 'VARLISTEND=';\n                        run;\n                        "
                nosub = self.sas.nosub
                self.sas.nosub = False
                ll = self.sas.submit(num_string.format(self.libref, (self.table + self._dsopts())))
                self.sas.nosub = nosub
                numlist = []
                log = ll['LOG'].rpartition('VARLISTEND=')[0].rpartition('VARLIST=')
                for vari in range(log[2].count('VAR=')):
                    log = log[2].partition('VAR=')[2].partition(' VAREND=')
                    numlist.append(log[0].strip())
                if isinstance(var, str):
                    tlist = var.split()
                elif isinstance(var, list):
                    tlist = var
                else:
                    raise SyntaxError(('var must be a string or list you submitted: %s' % str(type(var))))
            if set(numlist).isdisjoint(tlist):
                if isinstance(var, str):
                    code += ('class _character_;\ntarget %s;\nvar _numeric_;\n' % var)
                else:
                    code += ('class _character_;\ntarget %s;\nvar _numeric_;\n' % ' '.join(var))
            else:
                varlist = [x for x in numlist if (x not in tlist)]
                varlist.extend([('_cvfold%s' % j) for j in range(1, i) if ((k > 1) and (i > 1))])
                code += ('class %s _character_;\ntarget %s;\nvar %s;\n' % (var, var, ' '.join(varlist)))
        else:
            code += 'class _character_;\nvar _numeric_;\n'
        code += 'run;\n'
        i += 1
    split_code = 
    if (not singleOut):
        split_code += 'DATA '
        for j in range(1, (k + 1)):
            split_code += ('\t%s.%s%s_train(drop=_Partind_ _cvfold:)\n' % (out_libref, out_table, j))
            split_code += ('\t%s.%s%s_score(drop=_Partind_ _cvfold:)\n' % (out_libref, out_table, j))
        split_code += (';\n \tset %s.%s;\n' % (out_libref, out_table))
        for z in range(1, (k + 1)):
            split_code += ('\tif _cvfold%s = 1 or _partind_ = 1 then output %s.%s%s_train;\n' % (z, out_libref, out_table, z))
            split_code += ('\telse output %s.%s%s_score;\n' % (out_libref, out_table, z))
        split_code += 'run;'
    runcode = True
    if self.sas.nosub:
        print(((code + '\n\n') + split_code))
        runcode = False
    ll = self._is_valid()
    if ll:
        runcode = False
    if runcode:
        ll = self.sas.submit((code + split_code), 'text')
        elog = []
        for line in ll['LOG'].splitlines():
            if line[self.sas.logoffset:].startswith('ERROR'):
                elog.append(line)
        if len(elog):
            raise RuntimeError('\n'.join(elog))
        if (not singleOut):
            outTableList = []
            if (k == 1):
                return (self.sas.sasdata(((out_table + str(k)) + '_train'), out_libref, dsopts=self._dsopts()), self.sas.sasdata(((out_table + str(k)) + '_score'), out_libref, dsopts=self._dsopts()))
            for j in range(1, (k + 1)):
                outTableList.append((self.sas.sasdata(((out_table + str(j)) + '_train'), out_libref, dsopts=self._dsopts()), self.sas.sasdata(((out_table + str(j)) + '_score'), out_libref, dsopts=self._dsopts())))
            return outTableList
        if out:
            if (not isinstance(out, str)):
                return out
            else:
                return self.sas.sasdata(out_table, out_libref, self.results)
        else:
            return self