def sasdata2dataframe(self, table: str, libref: str ='<STR_LIT>', dsopts: dict = None, rowsep: str = '<STR_LIT>', colsep: str = '<STR_LIT>', **kwargs) -> '<STR_LIT>':
dsopts = dsopts if dsopts is not None else {}<EOL>method = kwargs.pop('<STR_LIT>', None)<EOL>if method and method.lower() == '<STR_LIT>':<EOL><INDENT>return self.sasdata2dataframeCSV(table, libref, dsopts, **kwargs)<EOL><DEDENT>logf     = '<STR_LIT>'<EOL>logn     = self._logcnt()<EOL>logcodei = "<STR_LIT>" + logn + "<STR_LIT:;>"<EOL>logcodeo = "<STR_LIT>" + logn<EOL>logcodeb =  logcodeo.encode()<EOL>if libref:<EOL><INDENT>tabname = libref+"<STR_LIT:.>"+table<EOL><DEDENT>else:<EOL><INDENT>tabname = table<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>rdelim = "<STR_LIT:'>"+'<STR_LIT>' % ord(rowsep.encode(self.sascfg.encoding))+"<STR_LIT>"<EOL>cdelim = "<STR_LIT:'>"+'<STR_LIT>' % ord(colsep.encode(self.sascfg.encoding))+"<STR_LIT>"<EOL>code = "<STR_LIT>"+tabname+self._sb._dsopts(dsopts)+"<STR_LIT>"+self._tomods1.decode()+"<STR_LIT>"+cdelim+"<STR_LIT>"<EOL>for i in range(nvars):<EOL><INDENT>code += "<STR_LIT:'>"+varlist[i]+"<STR_LIT>"<EOL>if vartype[i] == '<STR_LIT:N>':<EOL><INDENT>if varcat[i] in self._sb.sas_date_fmts:<EOL><INDENT>code += '<STR_LIT>'+cdelim<EOL><DEDENT>else:<EOL><INDENT>if varcat[i] in self._sb.sas_time_fmts:<EOL><INDENT>code += '<STR_LIT>'+cdelim<EOL><DEDENT>else:<EOL><INDENT>if varcat[i] in self._sb.sas_datetime_fmts:<EOL><INDENT>code += '<STR_LIT>'+cdelim<EOL><DEDENT>else:<EOL><INDENT>code += '<STR_LIT>'+cdelim<EOL><DEDENT><DEDENT><DEDENT><DEDENT>if not (i < (len(varlist)-<NUM_LIT:1>)):<EOL><INDENT>code += rdelim<EOL><DEDENT><DEDENT>code += "<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>'+logcodeb+b'<STR_LIT:\n>')<EOL>BOM   = "<STR_LIT>".encode()<EOL>done  = False<EOL>first = True<EOL>datar = b'<STR_LIT>'<EOL>bail  = False<EOL>r     = []<EOL>df    = None<EOL>trows = kwargs.get('<STR_LIT>', None)<EOL>if not trows:<EOL><INDENT>trows = <NUM_LIT><EOL><DEDENT>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>if bail:<EOL><INDENT>if datar.count(logcodeb) >= <NUM_LIT:1>:<EOL><INDENT>break<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>if first:<EOL><INDENT>if data[<NUM_LIT:0>:<NUM_LIT:3>] == BOM:<EOL><INDENT>data = data[<NUM_LIT:3>:len(data)]<EOL><DEDENT>first = False<EOL><DEDENT>datar += data<EOL>data   = datar.rpartition(colsep.encode()+rowsep.encode()+b'<STR_LIT:\n>')<EOL>datap  = data[<NUM_LIT:0>]+data[<NUM_LIT:1>]<EOL>datar  = data[<NUM_LIT:2>]<EOL>datap = datap.decode(self.sascfg.encoding, errors='<STR_LIT:replace>')<EOL>for i in datap.split(sep=colsep+rowsep+'<STR_LIT:\n>'):<EOL><INDENT>if i != '<STR_LIT>':<EOL><INDENT>r.append(tuple(i.split(sep=colsep)))<EOL><DEDENT><DEDENT>if len(r) > trows:<EOL><INDENT>tdf = pd.DataFrame.from_records(r, columns=varlist)<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>if tdf.dtypes[tdf.columns[i]].kind not in ('<STR_LIT:f>','<STR_LIT:u>','<STR_LIT:i>','<STR_LIT:b>','<STR_LIT:B>','<STR_LIT:c>','<STR_LIT:?>'):<EOL><INDENT>tdf[varlist[i]] = pd.to_numeric(tdf[varlist[i]], errors='<STR_LIT>')<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if tdf.dtypes[tdf.columns[i]].kind not in ('<STR_LIT:M>'):<EOL><INDENT>tdf[varlist[i]] = pd.to_datetime(tdf[varlist[i]], errors='<STR_LIT>')<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>tdf[varlist[i]].replace('<STR_LIT:U+0020>', np.NaN, True)<EOL><DEDENT><DEDENT>if df is not None:<EOL><INDENT>df = df.append(tdf, ignore_index=True)<EOL><DEDENT>else:<EOL><INDENT>df = tdf<EOL><DEDENT>r = []<EOL><DEDENT><DEDENT>else:<EOL><INDENT>sleep(<NUM_LIT:0.1>)<EOL>try:<EOL><INDENT>log = self.stderr[<NUM_LIT:0>].recv(<NUM_LIT>).decode(self.sascfg.encoding, 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><DEDENT>if len(r) > <NUM_LIT:0> or df is None:<EOL><INDENT>tdf = pd.DataFrame.from_records(r, columns=varlist)<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>if tdf.dtypes[tdf.columns[i]].kind not in ('<STR_LIT:f>','<STR_LIT:u>','<STR_LIT:i>','<STR_LIT:b>','<STR_LIT:B>','<STR_LIT:c>','<STR_LIT:?>'):<EOL><INDENT>tdf[varlist[i]] = pd.to_numeric(tdf[varlist[i]], errors='<STR_LIT>')<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if tdf.dtypes[tdf.columns[i]].kind not in ('<STR_LIT:M>'):<EOL><INDENT>tdf[varlist[i]] = pd.to_datetime(tdf[varlist[i]], errors='<STR_LIT>')<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>tdf[varlist[i]].replace('<STR_LIT:U+0020>', np.NaN, True)<EOL><DEDENT><DEDENT>if df is not None:<EOL><INDENT>df = df.append(tdf, ignore_index=True)<EOL><DEDENT>else:<EOL><INDENT>df = tdf<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.
rowsep  - the row seperator character to use; defaults to '\n'
colsep  - the column seperator character to use; defaults to '\t'