Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# http://support.sas.com/documentation/cdl/en/statug/68162/HTML/default/viewer.htm#statug_glm_syntax.htm#statug.glm.glmpostable
uoargs = {}
orderedargs = {}
keyorder = ['by', 'input', 'target', 'cls', 'model', 'output']
for k, v in args.items():
if k in keyorder:
orderedargs[k] = v
else:
uoargs[k] = v
orderedargs = OrderedDict(sorted(orderedargs.items(), key=lambda i: keyorder.index(i[0])))
for k, v in uoargs.items():
orderedargs[k] = v
orderedargs.move_to_end(k)
for key, value in orderedargs.items():
gen = Codegen.new(key, value)
gen.objtype = objtype
gen.data = data
gen.outmeth = outmeth
gen.objname = objname
code += gen.codestmt
if gen.debug is not None:
debug_code += gen.debug
code += "run; quit; %mend;\n"
code += "%%mangobj(%s,%s,'%s'n);" % (objname, objtype, data.table)
if self.logger.level == 10:
print("Proc code submission:\n " + str(code))
print("\n\n\n" + debug_code)
return code
outmeth = 'out'
plot = 'plot=all'
if self.sasproduct.lower() == 'em':
pass
if self.sasproduct.lower() == 'vddml':
outmeth = 'out'
if self.sasproduct.lower() == 'util':
outmeth = 'out'
if objtype.lower() =='univariate' and not ('ODSGraphics' in args.keys() or ODSGraphics == False):
plot = 'plot'
outmeth = ''
outds = args.pop('out', None)
if outds == None:
outds = args.pop('output', None)
outcodegen = Codegen.new('out', outds)
outcodegen.outmeth = outmeth
outcodegen.objname = objname
outstr = outcodegen.codestmt
self.logger.debug("product caller: " + self.sasproduct.lower())
debug_code= ''
code = "%macro proccall(d);\n"
# resolve issues withe Proc options, out= and plots=
# The procopts statement should be in every procedure as a way to pass arbitrary options to the procedures
if 'outmeth' in args:
outmeth = args['outmeth']
if 'plot' in args:
plot = args['plot']
if len(outmeth) and not outds == None:
code += "proc %s data=%s.'%s'n %s %s %s=%s %s ;\n" % (
objtype, data.libref, data.table, data._dsopts(), plot, outmeth, outstr, procopts)
else: