Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
kwargs = SASProcCommons._processNominals(self, kwargs, data)
t_str, tcls_str = SASProcCommons._target_stmt(self, kwargs['target'])
i_str, icls_str = SASProcCommons._input_stmt(self, kwargs['input'])
kwargs['model'] = str(t_str + ' = ' + i_str)
if len(icls_str) > 0:
kwargs['cls'] = str(tcls_str + " " + icls_str)
legal_set.add('cls')
drop_target = kwargs.pop('target', None)
drop_input = kwargs.pop('input', None)
self.logger.debug(drop_target)
self.logger.debug(drop_input)
elif {'target'}.intersection(required_set) and 'model' in kwargs.keys() and 'target' not in kwargs.keys():
SASProcCommons._convert_model_to_target(self)
verifiedKwargs = SASProcCommons._stmt_check(self, required_set, legal_set, kwargs)
obj1 = []
nosub = False
objname = ''
log = ''
if len(verifiedKwargs):
objname = procname[:3].lower() + self.sas._objcnt() # translate to a libname so needs to be less than 8
code = SASProcCommons._makeProcCallMacro(self, objtype, objname, data, verifiedKwargs)
self.logger.debug(procname + " macro submission: " + str(code))
if not self.sas.nosub:
ll = self.sas.submit(code, "text")
log = ll['LOG']
error = SASProcCommons._errorLog(self, log)
isinstance(error, str)
if len(error) > 1:
RuntimeWarning("ERRORS found in SAS log: \n%s" % error)
return SASresults(obj1, self.sas, objname, nosub, log)
proc_kwargs = dict(
cls=' '.join(sets['classes']),
var=' '.join(sets['vars']),
table=table
)
# permit additional valid options if passed; for now, just 'where'
proc_kwargs.update(kwargs)
# we can't easily use the SASProcCommons approach for submiting,
# since this is merely an output / display proc for us;
# but we can at least use it to check valid options in the canonical saspy way
required_options = {'cls', 'var', 'table'}
allowed_options = {'cls', 'var', 'table', 'where'}
verifiedKwargs = sp.sasproccommons.SASProcCommons._stmt_check(self, required_options, allowed_options,
proc_kwargs)
if (_output_type == 'Pandas'):
# for pandas, use the out= directive
code = "proc tabulate data=%s.%s %s out=temptab;\n" % (
self.data.libref, self.data.table, self.data._dsopts())
else:
code = "proc tabulate data=%s.%s %s;\n" % (self.data.libref, self.data.table, self.data._dsopts())
# build the code
for arg, value in verifiedKwargs.items():
code += " %s %s;\n" % (arg == 'cls' and 'class' or arg, value)
code += "run;"
# teach_me_SAS
if self.sas.nosub: