def sasdata2dataframeCSV(self, table: str, libref: str ='<STR_LIT>', dsopts: dict = None, tempfile: str=None, tempkeep: bool=False, **kwargs) -> '<STR_LIT>':
dsopts = dsopts if dsopts is not None else {}<EOL>logf     = '<STR_LIT>'<EOL>lstf     = '<STR_LIT>'<EOL>logn     = self._logcnt()<EOL>logcodei = "<STR_LIT>" + logn + "<STR_LIT:;>"<EOL>lstcodeo =   "<STR_LIT>" + logn<EOL>logcodeo = "<STR_LIT>" + logn<EOL>if libref:<EOL><INDENT>tabname = libref+"<STR_LIT:.>"+table<EOL><DEDENT>else:<EOL><INDENT>tabname = table<EOL><DEDENT>tmpdir  = None<EOL>if tempfile is None:<EOL><INDENT>tmpdir = tf.TemporaryDirectory()<EOL>tmpcsv = tmpdir.name+os.sep+"<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>tmpcsv  = tempfile<EOL><DEDENT>code  = "<STR_LIT>"+tabname+self._sb._dsopts(dsopts)+"<STR_LIT>"<EOL>code += "<STR_LIT>"<EOL>code += "<STR_LIT>"<EOL>code += "<STR_LIT>"<EOL>code += "<STR_LIT>"<EOL>code += "<STR_LIT>"<EOL>code += "<STR_LIT>"<EOL>code += "<STR_LIT>"<EOL>code += "<STR_LIT>"<EOL>code += "<STR_LIT>"<EOL>ll = self.submit(code, "<STR_LIT:text>")<EOL>l2 = ll['<STR_LIT>'].rpartition("<STR_LIT>")<EOL>l2 = l2[<NUM_LIT:2>].partition("<STR_LIT:\n>")<EOL>lrecl = int(l2[<NUM_LIT:0>])<EOL>l2 = l2[<NUM_LIT:2>].partition("<STR_LIT>")<EOL>l2 = l2[<NUM_LIT:2>].partition("<STR_LIT:\n>")<EOL>nvars = int(l2[<NUM_LIT:0>])<EOL>l2 = l2[<NUM_LIT:2>].partition("<STR_LIT:\n>")<EOL>varlist = l2[<NUM_LIT:2>].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>topts             = dict(dsopts)<EOL>topts['<STR_LIT>']      = <NUM_LIT:0><EOL>topts['<STR_LIT>'] = '<STR_LIT>'<EOL>code  = "<STR_LIT>"<EOL>code += "<STR_LIT>"+tabname+self._sb._dsopts(topts)+"<STR_LIT>"<EOL>for i in range(nvars):<EOL><INDENT>code += "<STR_LIT>"+varlist[i]+"<STR_LIT>"<EOL><DEDENT>code += "<STR_LIT>"<EOL>ll = self.submit(code, "<STR_LIT:text>")<EOL>l2 = ll['<STR_LIT>'].rpartition("<STR_LIT>")<EOL>l2 = l2[<NUM_LIT:2>].partition("<STR_LIT:\n>")<EOL>varcat = l2[<NUM_LIT:2>].split("<STR_LIT:\n>", nvars)<EOL>del varcat[nvars]<EOL>code = "<STR_LIT>"+tabname+self._sb._dsopts(dsopts)+"<STR_LIT>"<EOL>for i in range(nvars):<EOL><INDENT>if vartype[i] == '<STR_LIT:N>':<EOL><INDENT>code += "<STR_LIT:'>"+varlist[i]+"<STR_LIT>"<EOL>if varcat[i] in self._sb.sas_date_fmts:<EOL><INDENT>code += '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>if varcat[i] in self._sb.sas_time_fmts:<EOL><INDENT>code += '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>if varcat[i] in self._sb.sas_datetime_fmts:<EOL><INDENT>code += '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>code += '<STR_LIT>'<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>code += "<STR_LIT>"<EOL>ll = self.submit(code, "<STR_LIT:text>")<EOL>if self.sascfg.iomhost.lower() in ('<STR_LIT>', '<STR_LIT:localhost>', '<STR_LIT:127.0.0.1>'):<EOL><INDENT>local   = True<EOL>outname = "<STR_LIT>"<EOL>code    = "<STR_LIT>"+tmpcsv+"<STR_LIT>"+str(self.sascfg.lrecl)+"<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>local   = False<EOL>outname = self._tomods1.decode()<EOL>code    = '<STR_LIT>'<EOL><DEDENT>code += "<STR_LIT>"+outname+"<STR_LIT>"<EOL>ll = self._asubmit(code, '<STR_LIT:text>')<EOL>self.stdin[<NUM_LIT:0>].send(b'<STR_LIT:\n>'+logcodei.encode()+b'<STR_LIT:\n>'+b'<STR_LIT>'+logcodeo.encode())<EOL>done  = False<EOL>bail  = False<EOL>datar = b"<STR_LIT>"<EOL>dts = kwargs.pop('<STR_LIT>', '<STR_LIT>')<EOL>if dts == '<STR_LIT>':<EOL><INDENT>dts = {}<EOL>for i in range(nvars):<EOL><INDENT>if vartype[i] == '<STR_LIT:N>':<EOL><INDENT>if varcat[i] not in self._sb.sas_date_fmts + self._sb.sas_time_fmts + self._sb.sas_datetime_fmts:<EOL><INDENT>dts[varlist[i]] = '<STR_LIT:float>'<EOL><DEDENT>else:<EOL><INDENT>dts[varlist[i]] = '<STR_LIT:str>'<EOL><DEDENT><DEDENT>else:<EOL><INDENT>dts[varlist[i]] = '<STR_LIT:str>'<EOL><DEDENT><DEDENT><DEDENT>if not local:<EOL><INDENT>csv = open(tmpcsv, mode='<STR_LIT:wb>')<EOL>while not done:<EOL><INDENT>while True:<EOL><INDENT>if os.name == '<STR_LIT>':<EOL><INDENT>try:<EOL><INDENT>rc = self.pid.wait(<NUM_LIT:0>)<EOL>self.pid = None<EOL>self._sb.SASpid = None<EOL>print('<STR_LIT>'+str(rc))<EOL>return None<EOL><DEDENT>except:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>else:<EOL><INDENT>rc = os.waitpid(self.pid, os.WNOHANG)<EOL>if rc[<NUM_LIT:1>]:<EOL><INDENT>self.pid = None<EOL>self._sb.SASpid = None<EOL>print('<STR_LIT>'+str(rc))<EOL>return None<EOL><DEDENT><DEDENT>try:<EOL><INDENT>data = self.stdout[<NUM_LIT:0>].recv(<NUM_LIT>)<EOL><DEDENT>except (BlockingIOError):<EOL><INDENT>data = b'<STR_LIT>'<EOL><DEDENT>if len(data) > <NUM_LIT:0>:<EOL><INDENT>datar += data<EOL>data   = datar.rpartition(b'<STR_LIT:\n>')<EOL>datap  = data[<NUM_LIT:0>]+data[<NUM_LIT:1>]<EOL>datar  = data[<NUM_LIT:2>]<EOL>if datap.count(lstcodeo.encode()) >= <NUM_LIT:1>:<EOL><INDENT>done  = True<EOL>datar = datap.rpartition(logcodeo.encode())<EOL>datap = datar[<NUM_LIT:0>]<EOL><DEDENT>csv.write(datap.decode(self.sascfg.encoding, errors='<STR_LIT:replace>').encode())<EOL>if bail and done:<EOL><INDENT>break<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if datar.count(lstcodeo.encode()) >= <NUM_LIT:1>:<EOL><INDENT>done = True<EOL><DEDENT>if bail and done:<EOL><INDENT>break<EOL><DEDENT>sleep(<NUM_LIT:0.1>)<EOL>try:<EOL><INDENT>log = self.stderr[<NUM_LIT:0>].recv(<NUM_LIT>).decode(errors='<STR_LIT:replace>')<EOL><DEDENT>except (BlockingIOError):<EOL><INDENT>log = b'<STR_LIT>'<EOL><DEDENT>if len(log) > <NUM_LIT:0>:<EOL><INDENT>logf += log<EOL>if logf.count(logcodeo) >= <NUM_LIT:1>:<EOL><INDENT>bail = True<EOL><DEDENT><DEDENT><DEDENT><DEDENT>done = True<EOL>self._log += logf<EOL><DEDENT>csv.close()<EOL>df = pd.read_csv(tmpcsv, index_col=False, engine='<STR_LIT:c>', dtype=dts, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>while True:<EOL><INDENT>try:<EOL><INDENT>lst = self.stdout[<NUM_LIT:0>].recv(<NUM_LIT>).decode(errors='<STR_LIT:replace>')<EOL><DEDENT>except (BlockingIOError):<EOL><INDENT>lst = b'<STR_LIT>'<EOL><DEDENT>if len(lst) > <NUM_LIT:0>:<EOL><INDENT>lstf += lst<EOL>if lstf.count(lstcodeo) >= <NUM_LIT:1>:<EOL><INDENT>done = True;<EOL><DEDENT><DEDENT>try:<EOL><INDENT>log = self.stderr[<NUM_LIT:0>].recv(<NUM_LIT>).decode(errors='<STR_LIT:replace>')<EOL><DEDENT>except (BlockingIOError):<EOL><INDENT>sleep(<NUM_LIT:0.1>)<EOL>log = b'<STR_LIT>'<EOL><DEDENT>if len(log) > <NUM_LIT:0>:<EOL><INDENT>logf += log<EOL>if logf.count(logcodeo) >= <NUM_LIT:1>:<EOL><INDENT>bail = True;<EOL>self._log += logf<EOL><DEDENT><DEDENT>if done and bail:<EOL><INDENT>break<EOL><DEDENT><DEDENT>df = pd.read_csv(tmpcsv, index_col=False, engine='<STR_LIT:c>', dtype=dts, **kwargs)<EOL><DEDENT>if tmpdir:<EOL><INDENT>tmpdir.cleanup()<EOL><DEDENT>else:<EOL><INDENT>if not tempkeep:<EOL><INDENT>os.remove(tmpcsv)<EOL><DEDENT><DEDENT>for i in range(nvars):<EOL><INDENT>if varcat[i] in self._sb.sas_date_fmts + self._sb.sas_time_fmts + self._sb.sas_datetime_fmts:<EOL><INDENT>df[varlist[i]] = pd.to_datetime(df[varlist[i]], errors='<STR_LIT>')<EOL><DEDENT><DEDENT>return df<EOL>
This method exports the SAS Data Set to a Pandas Data Frame, returning the Data Frame object.
table    - the name of the SAS Data Set you want to export to a Pandas Data Frame
libref   - the libref for the SAS Data Set.
dsopts   - data set options for the input SAS Data Set
tempfile - file to use to store CSV, else temporary file will be used.
tempkeep - if you specify your own file to use with tempfile=, this controls whether it's cleaned up after using it