def impute(self, vars: dict, replace: bool = False, prefix: str = '<STR_LIT>', out: '<STR_LIT>' = None) -> '<STR_LIT>':
outstr = '<STR_LIT>'<EOL>if out:<EOL><INDENT>if isinstance(out, str):<EOL><INDENT>fn = out.partition('<STR_LIT:.>')<EOL>if fn[<NUM_LIT:1>] == '<STR_LIT:.>':<EOL><INDENT>out_libref = fn[<NUM_LIT:0>]<EOL>out_table = fn[<NUM_LIT:2>]<EOL><DEDENT>else:<EOL><INDENT>out_libref = '<STR_LIT>'<EOL>out_table = fn[<NUM_LIT:0>]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>out_libref = out.libref<EOL>out_table = out.table<EOL><DEDENT>outstr = "<STR_LIT>" % (out_libref, out_table)<EOL><DEDENT>else:<EOL><INDENT>out_table = self.table<EOL>out_libref = self.libref<EOL><DEDENT>varcode = "<STR_LIT>" + self.libref + "<STR_LIT:.>" + self.table + "<STR_LIT>"<EOL>varcode += "<STR_LIT>"<EOL>varcode += "<STR_LIT>"<EOL>varcode += "<STR_LIT>"<EOL>varcode += "<STR_LIT>"<EOL>varcode += "<STR_LIT>"<EOL>varcode += "<STR_LIT>"<EOL>varcode += "<STR_LIT>"<EOL>print(varcode)<EOL>ll = self.sas._io.submit(varcode, "<STR_LIT:text>")<EOL>l2 = ll['<STR_LIT>'].rpartition("<STR_LIT>")<EOL>l2 = l2[<NUM_LIT:2>].partition("<STR_LIT:\n>")<EOL>nvars = int(float(l2[<NUM_LIT:0>]))<EOL>l2 = l2[<NUM_LIT:2>].partition("<STR_LIT:\n>")<EOL>varlist = l2[<NUM_LIT:2>].upper().split("<STR_LIT:\n>", nvars)<EOL>del varlist[nvars]<EOL>l2 = l2[<NUM_LIT:2>].partition("<STR_LIT>")<EOL>l2 = l2[<NUM_LIT:2>].partition("<STR_LIT:\n>")<EOL>vartype = l2[<NUM_LIT:2>].split("<STR_LIT:\n>", nvars)<EOL>del vartype[nvars]<EOL>varListType = dict(zip(varlist, vartype))<EOL>sql = "<STR_LIT>"<EOL>sqlsel = '<STR_LIT>'<EOL>sqlinto = '<STR_LIT>'<EOL>if len(out_libref)><NUM_LIT:0> :<EOL><INDENT>ds1 = "<STR_LIT>" + out_libref + "<STR_LIT:.>" + out_table + "<STR_LIT>" + self.libref + "<STR_LIT:.>" + self.table + self._dsopts() + "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>ds1 = "<STR_LIT>" + out_table + "<STR_LIT>" + self.libref + "<STR_LIT:.>" + self.table + self._dsopts() + "<STR_LIT>"<EOL><DEDENT>dsmiss = '<STR_LIT>'<EOL>if replace:<EOL><INDENT>dsmiss = prefix+'<STR_LIT>' % prefix<EOL><DEDENT>modesql = '<STR_LIT>'<EOL>modeq = "<STR_LIT>"<EOL>modeq += "<STR_LIT>"<EOL>contantValues = vars.pop('<STR_LIT:value>', None)<EOL>if contantValues is not None:<EOL><INDENT>if not all(isinstance(x, tuple) for x in contantValues):<EOL><INDENT>raise SyntaxError("<STR_LIT>")<EOL><DEDENT>for t in contantValues:<EOL><INDENT>if varListType.get(t[<NUM_LIT:0>].upper()) == "<STR_LIT:N>":<EOL><INDENT>ds1 += dsmiss.format((t[<NUM_LIT:0>], t[<NUM_LIT:0>], t[<NUM_LIT:1>]))<EOL><DEDENT>else:<EOL><INDENT>ds1 += dsmiss.format(t[<NUM_LIT:0>], t[<NUM_LIT:0>], '<STR_LIT:">' + str(t[<NUM_LIT:1>]) + '<STR_LIT:">')<EOL><DEDENT><DEDENT><DEDENT>for key, values in vars.items():<EOL><INDENT>if key.lower() in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>for v in values:<EOL><INDENT>sql += sqlsel % ('<STR_LIT>', v)<EOL>sql += sqlsel % ('<STR_LIT>', v)<EOL>sqlinto += '<STR_LIT>' + v + '<STR_LIT>'<EOL>sqlinto += '<STR_LIT>' + v + '<STR_LIT>'<EOL>if key.lower() == '<STR_LIT>':<EOL><INDENT>ds1 += dsmiss.format(v, v, '<STR_LIT>' + v + '<STR_LIT:.>' + '<STR_LIT>' + '<STR_LIT>' + v + '<STR_LIT:.>' + '<STR_LIT>')<EOL><DEDENT>elif key.lower() == '<STR_LIT>':<EOL><INDENT>ds1 += dsmiss.format(v, v, '<STR_LIT>' + v + '<STR_LIT:.>' + '<STR_LIT>' + '<STR_LIT>' + v + '<STR_LIT:.>' + '<STR_LIT>' + '<STR_LIT>' + v + '<STR_LIT:.>')<EOL><DEDENT>else:<EOL><INDENT>raise SyntaxError("<STR_LIT>")<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>for v in values:<EOL><INDENT>sql += sqlsel % (key, v)<EOL>sqlinto += '<STR_LIT>' + v + '<STR_LIT>'<EOL>if key.lower == '<STR_LIT>':<EOL><INDENT>modesql += modeq % (v, v, self.libref + "<STR_LIT:.>" + self.table + self._dsopts() , v, v, v)<EOL><DEDENT>if varListType.get(v.upper()) == "<STR_LIT:N>":<EOL><INDENT>ds1 += dsmiss.format(v, v, '<STR_LIT>' + v + '<STR_LIT:.>')<EOL><DEDENT>else:<EOL><INDENT>ds1 += dsmiss.format(v, v, '<STR_LIT>' + v + '<STR_LIT>')<EOL><DEDENT><DEDENT><DEDENT><DEDENT>if len(sql) > <NUM_LIT:20>:<EOL><INDENT>sql = sql.rstrip('<STR_LIT>') + '<STR_LIT:\n>' + sqlinto.rstrip('<STR_LIT>') + '<STR_LIT>' + self.libref + '<STR_LIT:.>' + self.table + self._dsopts() + '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>sql = '<STR_LIT>'<EOL><DEDENT>ds1 += '<STR_LIT>'<EOL>if self.sas.nosub:<EOL><INDENT>print(modesql + sql + ds1)<EOL>return None<EOL><DEDENT>ll = self.sas.submit(modesql + sql + ds1)<EOL>return self.sas.sasdata(out_table, libref=out_libref, results=self.results, dsopts=self._dsopts())<EOL>
Imputes missing values for a SASdata object.

:param vars: a dictionary in the form of {'varname':'impute type'} or {'impute type':'[var1, var2]'}
:param replace:
:param prefix:
:param out:
:return: