In [1]:
import saspy
sas = saspy.SASsession(cfgname='winlocal')
sas
SAS Connection established. Subprocess id is 21820

Out[1]:
Access Method         = IOM
SAS Config name       = winlocal
WORK Path             = C:\Users\sastpw\AppData\Local\Temp\SAS Temporary Files\_TD6444_d10a626_\Prc2\
SAS Version           = 9.04.01M4P11092016
SASPy Version         = 2.2.4
Teach me SAS          = False
Batch                 = False
Results               = Pandas
SAS Session Encoding  = WLATIN1
Python Encoding value = cp1252
In [2]:
ll = sas.submit("data a;x = '404142434401454647024849'x;run;")
In [3]:
print(ll['LOG'])
5                                                          The SAS System                               09:53 Friday, April 20, 2018

31         ods listing close;ods html5 (id=saspy_internal) file=_tomods1 options(bitmap_mode='inline') device=svg; ods graphics on /
31       !  outputfmt=png;
NOTE: Writing HTML5(SASPY_INTERNAL) Body file: _TOMODS1
32         
33         data a;x = '404142434401454647024849'x;run;

NOTE: The data set WORK.A has 1 observations and 1 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

34         
35         ods html5 (id=saspy_internal) close;ods listing;
36         
In [4]:
sd1 = sas.sasdata('a', results='text')
sd1.head()
                                                           The SAS System                           09:53 Friday, April 20, 2018   1

                                                        Obs         x

                                                         1     @ABCDEFGHI

In [5]:
sd1 = sas.sasdata('a', results='pandas')
sd1.head()
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-5-161fd513fabf> in <module>()
      1 sd1 = sas.sasdata('a', results='pandas')
----> 2 sd1.head()

C:\ProgramData\Anaconda3\lib\site-packages\saspy\sasbase.py in head(self, obs)
   1124         if self.results.upper() == 'PANDAS':
   1125             code = "data _head ; set %s.%s %s; run;" % (self.libref, self.table, self.sas._dsopts(topts))
-> 1126             return self._returnPD(code, '_head')
   1127         else:
   1128             ll = self._is_valid()

C:\ProgramData\Anaconda3\lib\site-packages\saspy\sasbase.py in _returnPD(self, code, tablename, **kwargs)
   1074             raise ValueError("Internal code execution failed: " + errorMsg)
   1075         if isinstance(tablename, str):
-> 1076             pd = self.sas._io.sasdata2dataframe(tablename, libref)
   1077             self.sas._io.submit("proc delete data=%s.%s; run;" % (libref, tablename))
   1078         elif isinstance(tablename, list):

C:\ProgramData\Anaconda3\lib\site-packages\saspy\sasioiom.py in sasdata2dataframe(self, table, libref, dsopts, rowsep, colsep, **kwargs)
   1340 
   1341       if len(r) > 0:
-> 1342          tdf = pd.DataFrame.from_records(r, columns=varlist)
   1343 
   1344          for i in range(nvars):

C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\frame.py in from_records(cls, data, index, exclude, columns, coerce_float, nrows)
   1021         else:
   1022             arrays, arr_columns = _to_arrays(data, columns,
-> 1023                                              coerce_float=coerce_float)
   1024 
   1025             arr_columns = _ensure_index(arr_columns)

C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\frame.py in _to_arrays(data, columns, coerce_float, dtype)
   5517     if isinstance(data[0], (list, tuple)):
   5518         return _list_to_arrays(data, columns, coerce_float=coerce_float,
-> 5519                                dtype=dtype)
   5520     elif isinstance(data[0], collections.Mapping):
   5521         return _list_of_dict_to_arrays(data, columns,

C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\frame.py in _list_to_arrays(data, columns, coerce_float, dtype)
   5596         content = list(lib.to_object_array(data).T)
   5597     return _convert_object_array(content, columns, dtype=dtype,
-> 5598                                  coerce_float=coerce_float)
   5599 
   5600 

C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\frame.py in _convert_object_array(content, columns, coerce_float, dtype)
   5655             # caller's responsibility to check for this...
   5656             raise AssertionError('%d columns passed, passed data had %s '
-> 5657                                  'columns' % (len(columns), len(content)))
   5658 
   5659     # provide soft conversion of object dtypes

AssertionError: 1 columns passed, passed data had 2 columns
In [6]:
sd1 = sas.sasdata('a', results='html')
sd1.head()
SAS Output

The SAS System

Obs x
1 @ABCDEFGHI
In [7]:
df1 = sd1.to_df()
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-7-036e71eff80e> in <module>()
----> 1 df1 = sd1.to_df()

C:\ProgramData\Anaconda3\lib\site-packages\saspy\sasbase.py in to_df(self, method, **kwargs)
   1894             return None
   1895         else:
-> 1896             return self.sas.sasdata2dataframe(self.table, self.libref, self.dsopts, method, **kwargs)
   1897 
   1898     def to_df_CSV(self, tempfile: str=None, tempkeep: bool=False, **kwargs) -> 'pd.DataFrame':

C:\ProgramData\Anaconda3\lib\site-packages\saspy\sasbase.py in sasdata2dataframe(self, table, libref, dsopts, method, **kwargs)
    750             return None
    751         else:
--> 752             return self._io.sasdata2dataframe(table, libref, dsopts, method=method, **kwargs)
    753 
    754     def _dsopts(self, dsopts):

C:\ProgramData\Anaconda3\lib\site-packages\saspy\sasioiom.py in sasdata2dataframe(self, table, libref, dsopts, rowsep, colsep, **kwargs)
   1340 
   1341       if len(r) > 0:
-> 1342          tdf = pd.DataFrame.from_records(r, columns=varlist)
   1343 
   1344          for i in range(nvars):

C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\frame.py in from_records(cls, data, index, exclude, columns, coerce_float, nrows)
   1021         else:
   1022             arrays, arr_columns = _to_arrays(data, columns,
-> 1023                                              coerce_float=coerce_float)
   1024 
   1025             arr_columns = _ensure_index(arr_columns)

C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\frame.py in _to_arrays(data, columns, coerce_float, dtype)
   5517     if isinstance(data[0], (list, tuple)):
   5518         return _list_to_arrays(data, columns, coerce_float=coerce_float,
-> 5519                                dtype=dtype)
   5520     elif isinstance(data[0], collections.Mapping):
   5521         return _list_of_dict_to_arrays(data, columns,

C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\frame.py in _list_to_arrays(data, columns, coerce_float, dtype)
   5596         content = list(lib.to_object_array(data).T)
   5597     return _convert_object_array(content, columns, dtype=dtype,
-> 5598                                  coerce_float=coerce_float)
   5599 
   5600 

C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\frame.py in _convert_object_array(content, columns, coerce_float, dtype)
   5655             # caller's responsibility to check for this...
   5656             raise AssertionError('%d columns passed, passed data had %s '
-> 5657                                  'columns' % (len(columns), len(content)))
   5658 
   5659     # provide soft conversion of object dtypes

AssertionError: 1 columns passed, passed data had 2 columns
In [8]:
df1 = sd1.to_df(colsep=',', rowsep=';')
In [9]:
df1
Out[9]:
x
0 @ABCDEFGHI
In [10]:
df1 = sd1.to_df_CSV()
In [11]:
df1
Out[11]:
x
0 @ABCDEFGHI
In [12]:
df1 = sd1.to_df_CSV(tempfile='C:\\Public\\binary.csv', tempkeep=True)
In [13]:
df1
Out[13]:
x
0 @ABCDEFGHI
In [14]:
print(sas.saslog())
1                                                          The SAS System                               09:53 Friday, April 20, 2018

NOTE: Copyright (c) 2002-2012 by SAS Institute Inc., Cary, NC, USA. 
NOTE: SAS (r) Proprietary Software 9.4 (TS1M4) 
      Licensed to winIOMlocal, Site 70068128.
NOTE: This session is executing on the X64_10PRO  platform.



NOTE: Updated analytical products:
      
      SAS/STAT 14.2
      SAS/OR 14.2
      SAS/IML 14.2
      SAS/QC 14.2

WARNING: Your system is scheduled to expire on May 21, 2018, which is 31 days from now. The SAS System will no longer function on 
         or after that date. Please contact your SAS Installation Representative to obtain your updated SAS Installation Data (SID) 
         file, which includes SETINIT information.
To locate the name of your SAS Installation Representative go to http://support.sas.com/repfinder and provide your site number 
70068128 and company name as winIOMlocal. On the SAS REP list provided, locate the REP for operating system Windows.
NOTE: Additional host information:

 X64_10PRO WIN 10.0.16299  Workstation

NOTE: SAS Initialization used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      
1          ;*';*";*/;
2          options svgtitle='svgtitle'; options validvarname=any pagesize=max nosyntaxcheck; ods graphics on;
3          
4          ;*';*";*/;
5          %put E3969440A681A2408885998500000001;
E3969440A681A2408885998500000001
6          
2                                                          The SAS System                               09:53 Friday, April 20, 2018

7          ods listing close;ods html5 (id=saspy_internal) file=_tomods1 options(bitmap_mode='inline') device=svg; ods graphics on /
7        !  outputfmt=png;
NOTE: Writing HTML5(SASPY_INTERNAL) Body file: _TOMODS1
8          ;*';*";*/;
9          libname work list;
NOTE: Libref=   WORK 
      Scope=    IOM ROOT COMP ENV
      Engine=   V9
      Access=   TEMP
      Physical Name= C:\Users\sastpw\AppData\Local\Temp\SAS Temporary Files\_TD6444_d10a626_\Prc2
      Filename= C:\Users\sastpw\AppData\Local\Temp\SAS Temporary Files\_TD6444_d10a626_\Prc2
      Owner Name= CARYNT\sastpw
      File Size=              4KB
      File Size (bytes)= 4096
10         
11         ;*';*";*/;ods html5 (id=saspy_internal) close;ods listing;
12         
13         %put E3969440A681A2408885998500000002;
E3969440A681A2408885998500000002
14         
3                                                          The SAS System                               09:53 Friday, April 20, 2018

15         ods listing close;ods html5 (id=saspy_internal) file=_tomods1 options(bitmap_mode='inline') device=svg; ods graphics on /
15       !  outputfmt=png;
NOTE: Writing HTML5(SASPY_INTERNAL) Body file: _TOMODS1
16         ;*';*";*/;
17         %put SYSV=&sysvlong4;
SYSV=9.04.01M4P11092016
18         
19         ;*';*";*/;ods html5 (id=saspy_internal) close;ods listing;
20         
21         %put E3969440A681A2408885998500000003;
E3969440A681A2408885998500000003
22         
4                                                          The SAS System                               09:53 Friday, April 20, 2018

23         ods listing close;ods html5 (id=saspy_internal) file=_tomods1 options(bitmap_mode='inline') device=svg; ods graphics on /
23       !  outputfmt=png;
NOTE: Writing HTML5(SASPY_INTERNAL) Body file: _TOMODS1
24         ;*';*";*/;
25         proc options option=encoding;run;

    SAS (r) Proprietary Software Release 9.4  TS1M4

 ENCODING=WLATIN1  Specifies the default character-set encoding for the SAS session.
NOTE: PROCEDURE OPTIONS used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

26         
27         ;*';*";*/;ods html5 (id=saspy_internal) close;ods listing;
28         
29         %put E3969440A681A2408885998500000004;
E3969440A681A2408885998500000004
30         
5                                                          The SAS System                               09:53 Friday, April 20, 2018

31         ods listing close;ods html5 (id=saspy_internal) file=_tomods1 options(bitmap_mode='inline') device=svg; ods graphics on /
31       !  outputfmt=png;
NOTE: Writing HTML5(SASPY_INTERNAL) Body file: _TOMODS1
32         ;*';*";*/;
33         data a;x = '404142434401454647024849'x;run;

NOTE: The data set WORK.A has 1 observations and 1 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      

34         
35         ;*';*";*/;ods html5 (id=saspy_internal) close;ods listing;
36         
37         %put E3969440A681A2408885998500000005;
E3969440A681A2408885998500000005
38         
6                                                          The SAS System                               09:53 Friday, April 20, 2018

39         ;*';*";*/;
40         data _null_; e = exist('user.a');
41         te='TABLE_EXISTS='; put te e;run;

TABLE_EXISTS= 0
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

42         
43         
44         ;*';*";*/;
45         %put E3969440A681A2408885998500000006;
E3969440A681A2408885998500000006
46         
7                                                          The SAS System                               09:53 Friday, April 20, 2018

47         ;*';*";*/;
48         data _null_; e = exist('WORK.a');
49         te='TABLE_EXISTS='; put te e;run;

TABLE_EXISTS= 1
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

50         
51         
52         ;*';*";*/;
53         %put E3969440A681A2408885998500000007;
E3969440A681A2408885998500000007
54         
8                                                          The SAS System                               09:53 Friday, April 20, 2018

55         ;*';*";*/;
56         data _null_; e = exist('WORK.a');
57         te='TABLE_EXISTS='; put te e;run;

TABLE_EXISTS= 1
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

58         
59         
60         ;*';*";*/;
61         %put E3969440A681A2408885998500000008;
E3969440A681A2408885998500000008
62         
9                                                          The SAS System                               09:53 Friday, April 20, 2018

63         ;*';*";*/;
64         proc print data=WORK.a(obs=5 );run;

NOTE: There were 1 observations read from the data set WORK.A.
NOTE: The PROCEDURE PRINT printed page 1.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

65         
66         ;*';*";*/;
67         %put E3969440A681A2408885998500000009;
E3969440A681A2408885998500000009
68         
10                                                         The SAS System                               09:53 Friday, April 20, 2018

69         ;*';*";*/;
70         data _null_; e = exist('user.a');
71         te='TABLE_EXISTS='; put te e;run;

TABLE_EXISTS= 0
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

72         
73         
74         ;*';*";*/;
75         %put E3969440A681A2408885998500000010;
E3969440A681A2408885998500000010
76         
11                                                         The SAS System                               09:53 Friday, April 20, 2018

77         ;*';*";*/;
78         data _null_; e = exist('WORK.a');
79         te='TABLE_EXISTS='; put te e;run;

TABLE_EXISTS= 1
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

80         
81         
82         ;*';*";*/;
83         %put E3969440A681A2408885998500000011;
E3969440A681A2408885998500000011
84         
12                                                         The SAS System                               09:53 Friday, April 20, 2018

85         ods listing close;ods html5 (id=saspy_internal) file=_tomods1 options(bitmap_mode='inline') device=svg; ods graphics on /
85       !  outputfmt=png;
NOTE: Writing HTML5(SASPY_INTERNAL) Body file: _TOMODS1
86         ;*';*";*/;
87         data _head ; set WORK.a (obs=5 ); run;

NOTE: There were 1 observations read from the data set WORK.A.
NOTE: The data set WORK._HEAD has 1 observations and 1 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
      

88         
89         ;*';*";*/;ods html5 (id=saspy_internal) close;ods listing;
90         
91         %put E3969440A681A2408885998500000012;
E3969440A681A2408885998500000012
92         
13                                                         The SAS System                               09:53 Friday, April 20, 2018

93         ;*';*";*/;
94         proc sql;
94       !           create view sasdata2dataframe as select * from work._head;
NOTE: SQL view WORK.SASDATA2DATAFRAME has been defined.
94       !                                                                     quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
      

95         data _null_; file LOG; d = open('sasdata2dataframe');
96         length var $256;
97         lrecl = attrn(d, 'LRECL'); nvars = attrn(d, 'NVARS');
98         lr='LRECL='; vn='VARNUMS='; vl='VARLIST='; vt='VARTYPE='; vf='VARFMT=';
99         put lr lrecl; put vn nvars; put vl;
100        do i = 1 to nvars; var = compress(varname(d, i), '00'x); put var; end;
101        put vt;
102        do i = 1 to nvars; var = vartype(d, i); put var; end;
103        run;

LRECL= 12
VARNUMS= 1
VARLIST=
x
VARTYPE=
C
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

104        
105        ;*';*";*/;
106        %put E3969440A681A2408885998500000014;
E3969440A681A2408885998500000014
107        
14                                                         The SAS System                               09:53 Friday, April 20, 2018

108        ;*';*";*/;
109        data _null_; set work._head(obs=1 );put 'FMT_CATS=';
110        _tom = vformatn('x'n);put _tom;
111        run;

FMT_CATS=
$
NOTE: There were 1 observations read from the data set WORK._HEAD.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

112        
113        ;*';*";*/;
114        %put E3969440A681A2408885998500000015;
E3969440A681A2408885998500000015
115        
17                                                         The SAS System                               09:53 Friday, April 20, 2018

123        ;*';*";*/;
124        data _null_; e = exist('user.a');
125        te='TABLE_EXISTS='; put te e;run;

TABLE_EXISTS= 0
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

126        
127        
128        ;*';*";*/;
129        %put E3969440A681A2408885998500000016;
E3969440A681A2408885998500000016
130        
18                                                         The SAS System                               09:53 Friday, April 20, 2018

131        ;*';*";*/;
132        data _null_; e = exist('WORK.a');
133        te='TABLE_EXISTS='; put te e;run;

TABLE_EXISTS= 1
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

134        
135        
136        ;*';*";*/;
137        %put E3969440A681A2408885998500000017;
E3969440A681A2408885998500000017
138        
19                                                         The SAS System                               09:53 Friday, April 20, 2018

139        ;*';*";*/;
140        data _null_; e = exist('WORK.a');
141        te='TABLE_EXISTS='; put te e;run;

TABLE_EXISTS= 1
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

142        
143        
144        ;*';*";*/;
145        %put E3969440A681A2408885998500000018;
E3969440A681A2408885998500000018
146        
20                                                         The SAS System                               09:53 Friday, April 20, 2018

147        ods listing close;ods html5 (id=saspy_internal) file=_tomods1 options(bitmap_mode='inline') device=svg; ods graphics on /
147      !  outputfmt=png;
NOTE: Writing HTML5(SASPY_INTERNAL) Body file: _TOMODS1
148        ;*';*";*/;
149        proc print data=WORK.a(obs=5 );run;

NOTE: There were 1 observations read from the data set WORK.A.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds
      

150        
151        ;*';*";*/;ods html5 (id=saspy_internal) close;ods listing;
152        
153        %put E3969440A681A2408885998500000019;
E3969440A681A2408885998500000019
154        
21                                                         The SAS System                               09:53 Friday, April 20, 2018

155        ;*';*";*/;
156        data _null_; e = exist('WORK.a');
157        te='TABLE_EXISTS='; put te e;run;

TABLE_EXISTS= 1
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

158        
159        
160        ;*';*";*/;
161        %put E3969440A681A2408885998500000020;
E3969440A681A2408885998500000020
162        
22                                                         The SAS System                               09:53 Friday, April 20, 2018

163        ;*';*";*/;
164        data _null_; e = exist('WORK.a');
165        te='TABLE_EXISTS='; put te e;run;

TABLE_EXISTS= 1
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

166        
167        
168        ;*';*";*/;
169        %put E3969440A681A2408885998500000021;
E3969440A681A2408885998500000021
170        
23                                                         The SAS System                               09:53 Friday, April 20, 2018

171        ;*';*";*/;
172        proc sql;
172      !           create view sasdata2dataframe as select * from WORK.a;
NOTE: SQL view WORK.SASDATA2DATAFRAME has been defined.
172      !                                                                 quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      

173        data _null_; file LOG; d = open('sasdata2dataframe');
174        length var $256;
175        lrecl = attrn(d, 'LRECL'); nvars = attrn(d, 'NVARS');
176        lr='LRECL='; vn='VARNUMS='; vl='VARLIST='; vt='VARTYPE='; vf='VARFMT=';
177        put lr lrecl; put vn nvars; put vl;
178        do i = 1 to nvars; var = compress(varname(d, i), '00'x); put var; end;
179        put vt;
180        do i = 1 to nvars; var = vartype(d, i); put var; end;
181        run;

LRECL= 12
VARNUMS= 1
VARLIST=
x
VARTYPE=
C
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

182        
183        ;*';*";*/;
184        %put E3969440A681A2408885998500000023;
E3969440A681A2408885998500000023
185        
24                                                         The SAS System                               09:53 Friday, April 20, 2018

186        ;*';*";*/;
187        data _null_; set WORK.a(obs=1 );put 'FMT_CATS=';
188        _tom = vformatn('x'n);put _tom;
189        run;

FMT_CATS=
$
NOTE: There were 1 observations read from the data set WORK.A.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

190        
191        ;*';*";*/;
192        %put E3969440A681A2408885998500000024;
E3969440A681A2408885998500000024
193        
27                                                         The SAS System                               09:53 Friday, April 20, 2018

201        ;*';*";*/;
202        data _null_; e = exist('WORK.a');
203        te='TABLE_EXISTS='; put te e;run;

TABLE_EXISTS= 1
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

204        
205        
206        ;*';*";*/;
207        %put E3969440A681A2408885998500000025;
E3969440A681A2408885998500000025
208        
28                                                         The SAS System                               09:53 Friday, April 20, 2018

209        ;*';*";*/;
210        data _null_; e = exist('WORK.a');
211        te='TABLE_EXISTS='; put te e;run;

TABLE_EXISTS= 1
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

212        
213        
214        ;*';*";*/;
215        %put E3969440A681A2408885998500000026;
E3969440A681A2408885998500000026
216        
29                                                         The SAS System                               09:53 Friday, April 20, 2018

217        ;*';*";*/;
218        proc sql;
218      !           create view sasdata2dataframe as select * from WORK.a;
NOTE: SQL view WORK.SASDATA2DATAFRAME has been defined.
218      !                                                                 quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

219        data _null_; file LOG; d = open('sasdata2dataframe');
220        length var $256;
221        lrecl = attrn(d, 'LRECL'); nvars = attrn(d, 'NVARS');
222        lr='LRECL='; vn='VARNUMS='; vl='VARLIST='; vt='VARTYPE='; vf='VARFMT=';
223        put lr lrecl; put vn nvars; put vl;
224        do i = 1 to nvars; var = compress(varname(d, i), '00'x); put var; end;
225        put vt;
226        do i = 1 to nvars; var = vartype(d, i); put var; end;
227        run;

LRECL= 12
VARNUMS= 1
VARLIST=
x
VARTYPE=
C
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

228        
229        ;*';*";*/;
230        %put E3969440A681A2408885998500000028;
E3969440A681A2408885998500000028
231        
30                                                         The SAS System                               09:53 Friday, April 20, 2018

232        ;*';*";*/;
233        data _null_; set WORK.a(obs=1 );put 'FMT_CATS=';
234        _tom = vformatn('x'n);put _tom;
235        run;

FMT_CATS=
$
NOTE: There were 1 observations read from the data set WORK.A.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

236        
237        ;*';*";*/;
238        %put E3969440A681A2408885998500000029;
E3969440A681A2408885998500000029
239        
33                                                         The SAS System                               09:53 Friday, April 20, 2018

247        ;*';*";*/;
248        data _null_; e = exist('WORK.a');
249        te='TABLE_EXISTS='; put te e;run;

TABLE_EXISTS= 1
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      

250        
251        
252        ;*';*";*/;
253        %put E3969440A681A2408885998500000030;
E3969440A681A2408885998500000030
254        
34                                                         The SAS System                               09:53 Friday, April 20, 2018

255        ;*';*";*/;
256        data _null_; e = exist('WORK.a');
257        te='TABLE_EXISTS='; put te e;run;

TABLE_EXISTS= 1
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

258        
259        
260        ;*';*";*/;
261        %put E3969440A681A2408885998500000031;
E3969440A681A2408885998500000031
262        
35                                                         The SAS System                               09:53 Friday, April 20, 2018

263        ;*';*";*/;
264        proc sql;
264      !           create view sasdata2dataframe as select * from WORK.a;
NOTE: SQL view WORK.SASDATA2DATAFRAME has been defined.
264      !                                                                 quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      

265        data _null_; file LOG; d = open('sasdata2dataframe');
266        length var $256;
267        lrecl = attrn(d, 'LRECL'); nvars = attrn(d, 'NVARS');
268        lr='LRECL='; vn='VARNUMS='; vl='VARLIST='; vt='VARTYPE='; vf='VARFMT=';
269        put lr lrecl; put vn nvars; put vl;
270        do i = 1 to nvars; var = compress(varname(d, i), '00'x); put var; end;
271        put vt;
272        do i = 1 to nvars; var = vartype(d, i); put var; end;
273        run;

LRECL= 12
VARNUMS= 1
VARLIST=
x
VARTYPE=
C
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

274        
275        ;*';*";*/;
276        %put E3969440A681A2408885998500000033;
E3969440A681A2408885998500000033
277        
36                                                         The SAS System                               09:53 Friday, April 20, 2018

278        ;*';*";*/;
279        data _null_; set WORK.a(obs=1 );put 'FMT_CATS=';
280        _tom = vformatn('x'n);put _tom;
281        run;

FMT_CATS=
$
NOTE: There were 1 observations read from the data set WORK.A.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

282        
283        ;*';*";*/;
284        %put E3969440A681A2408885998500000034;
E3969440A681A2408885998500000034
285        
37                                                         The SAS System                               09:53 Friday, April 20, 2018

286        ;*';*";*/;
287        data sasdata2dataframe / view=sasdata2dataframe; set WORK.a;
288        format ;
289         run;

NOTE: DATA STEP view saved on file WORK.SASDATA2DATAFRAME.
NOTE: A stored DATA STEP view cannot run under a different operating system.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

290        
291        
292        ;*';*";*/;
293        %put E3969440A681A2408885998500000035;
E3969440A681A2408885998500000035
294        
38                                                         The SAS System                               09:53 Friday, April 20, 2018

295        filename _tomodsx 'C:\Users\sastpw\AppData\Local\Temp\tmpika24rgr\tomodsx' lrecl=1048576 recfm=v  encoding='utf-8';
296        proc export data=sasdata2dataframe outfile=_tomodsx dbms=csv replace;
296      !                                                                       run
297        ;

NOTE: View WORK.SASDATA2DATAFRAME.VIEW used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      
NOTE: View WORK.SASDATA2DATAFRAME.VIEW used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      
NOTE: There were 1 observations read from the data set WORK.A.
298         /**********************************************************************
299         *   PRODUCT:   SAS
300         *   VERSION:   9.4
301         *   CREATOR:   External File Interface
302         *   DATE:      20APR18
303         *   DESC:      Generated SAS Datastep Code
304         *   TEMPLATE SOURCE:  (None Specified.)
305         ***********************************************************************/
306            data _null_;
307            %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
308            %let _EFIREC_ = 0;     /* clear export record count macro variable */
309            file _TOMODSX delimiter=',' DSD DROPOVER ;
310            if _n_ = 1 then        /* write column names or labels */
311             do;
312               put
313                  "x"
314               ;
315             end;
316           set  SASDATA2DATAFRAME   end=EFIEOD;
317               format x $12. ;
318             do;
319               EFIOUT + 1;
320               put x $ ;
321               ;
322             end;
323            if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable */
324            if EFIEOD then call symputx('_EFIREC_',EFIOUT);
325            run;

NOTE: The file _TOMODSX is:
      Filename=C:\Users\sastpw\AppData\Local\Temp\tmpika24rgr\tomodsx,
      RECFM=V,LRECL=4194304,File Size (bytes)=0,
      Last Modified=20Apr2018:09:53:29,
      Create Time=20Apr2018:09:53:29

NOTE: 2 records were written to the file _TOMODSX.
      The minimum record length was 1.
      The maximum record length was 12.
NOTE: View WORK.SASDATA2DATAFRAME.VIEW used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      
NOTE: There were 1 observations read from the data set WORK.A.
NOTE: There were 1 observations read from the data set WORK.SASDATA2DATAFRAME.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      

1 records created in _TOMODSX from SASDATA2DATAFRAME.
  
  
NOTE: View WORK.SASDATA2DATAFRAME.VIEW used (Total process time):
      real time           0.03 seconds
      cpu time            0.04 seconds
      
NOTE: There were 1 observations read from the data set WORK.A.
NOTE: "_TOMODSX" file was successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):
      real time           0.08 seconds
      cpu time            0.07 seconds
      

326        
39                                                         The SAS System                               09:53 Friday, April 20, 2018

327        
328        %put E3969440A681A2408885998500000032;
E3969440A681A2408885998500000032
329        
40                                                         The SAS System                               09:53 Friday, April 20, 2018

330        ;*';*";*/;
331        data _null_; e = exist('WORK.a');
332        te='TABLE_EXISTS='; put te e;run;

TABLE_EXISTS= 1
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

333        
334        
335        ;*';*";*/;
336        %put E3969440A681A2408885998500000036;
E3969440A681A2408885998500000036
337        
41                                                         The SAS System                               09:53 Friday, April 20, 2018

338        ;*';*";*/;
339        data _null_; e = exist('WORK.a');
340        te='TABLE_EXISTS='; put te e;run;

TABLE_EXISTS= 1
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

341        
342        
343        ;*';*";*/;
344        %put E3969440A681A2408885998500000037;
E3969440A681A2408885998500000037
345        
42                                                         The SAS System                               09:53 Friday, April 20, 2018

346        ;*';*";*/;
347        proc sql;
347      !           create view sasdata2dataframe as select * from WORK.a;
NOTE: SQL view WORK.SASDATA2DATAFRAME has been defined.
347      !                                                                 quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

348        data _null_; file LOG; d = open('sasdata2dataframe');
349        length var $256;
350        lrecl = attrn(d, 'LRECL'); nvars = attrn(d, 'NVARS');
351        lr='LRECL='; vn='VARNUMS='; vl='VARLIST='; vt='VARTYPE='; vf='VARFMT=';
352        put lr lrecl; put vn nvars; put vl;
353        do i = 1 to nvars; var = compress(varname(d, i), '00'x); put var; end;
354        put vt;
355        do i = 1 to nvars; var = vartype(d, i); put var; end;
356        run;

LRECL= 12
VARNUMS= 1
VARLIST=
x
VARTYPE=
C
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

357        
358        ;*';*";*/;
359        %put E3969440A681A2408885998500000039;
E3969440A681A2408885998500000039
360        
43                                                         The SAS System                               09:53 Friday, April 20, 2018

361        ;*';*";*/;
362        data _null_; set WORK.a(obs=1 );put 'FMT_CATS=';
363        _tom = vformatn('x'n);put _tom;
364        run;

FMT_CATS=
$
NOTE: There were 1 observations read from the data set WORK.A.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

365        
366        ;*';*";*/;
367        %put E3969440A681A2408885998500000040;
E3969440A681A2408885998500000040
368        
44                                                         The SAS System                               09:53 Friday, April 20, 2018

369        ;*';*";*/;
370        data sasdata2dataframe / view=sasdata2dataframe; set WORK.a;
371        format ;
372         run;

NOTE: DATA STEP view saved on file WORK.SASDATA2DATAFRAME.
NOTE: A stored DATA STEP view cannot run under a different operating system.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

373        
374        
375        ;*';*";*/;
376        %put E3969440A681A2408885998500000041;
E3969440A681A2408885998500000041
377        
45                                                         The SAS System                               09:53 Friday, April 20, 2018

378        filename _tomodsx 'C:\Public\binary.csv' lrecl=1048576 recfm=v  encoding='utf-8';
379        proc export data=sasdata2dataframe outfile=_tomodsx dbms=csv replace;
379      !                                                                       run
380        ;

NOTE: View WORK.SASDATA2DATAFRAME.VIEW used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      
NOTE: View WORK.SASDATA2DATAFRAME.VIEW used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      
NOTE: There were 1 observations read from the data set WORK.A.
381         /**********************************************************************
382         *   PRODUCT:   SAS
383         *   VERSION:   9.4
384         *   CREATOR:   External File Interface
385         *   DATE:      20APR18
386         *   DESC:      Generated SAS Datastep Code
387         *   TEMPLATE SOURCE:  (None Specified.)
388         ***********************************************************************/
389            data _null_;
390            %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
391            %let _EFIREC_ = 0;     /* clear export record count macro variable */
392            file _TOMODSX delimiter=',' DSD DROPOVER ;
393            if _n_ = 1 then        /* write column names or labels */
394             do;
395               put
396                  "x"
397               ;
398             end;
399           set  SASDATA2DATAFRAME   end=EFIEOD;
400               format x $12. ;
401             do;
402               EFIOUT + 1;
403               put x $ ;
404               ;
405             end;
406            if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable */
407            if EFIEOD then call symputx('_EFIREC_',EFIOUT);
408            run;

NOTE: The file _TOMODSX is:
      Filename=C:\Public\binary.csv,
      RECFM=V,LRECL=4194304,File Size (bytes)=0,
      Last Modified=20Apr2018:09:53:42,
      Create Time=20Apr2018:09:49:41

NOTE: 2 records were written to the file _TOMODSX.
      The minimum record length was 1.
      The maximum record length was 12.
NOTE: View WORK.SASDATA2DATAFRAME.VIEW used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      
NOTE: There were 1 observations read from the data set WORK.A.
NOTE: There were 1 observations read from the data set WORK.SASDATA2DATAFRAME.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
      

1 records created in _TOMODSX from SASDATA2DATAFRAME.
  
  
NOTE: View WORK.SASDATA2DATAFRAME.VIEW used (Total process time):
      real time           0.02 seconds
      cpu time            0.01 seconds
      
NOTE: There were 1 observations read from the data set WORK.A.
NOTE: "_TOMODSX" file was successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):
      real time           0.04 seconds
      cpu time            0.06 seconds
      

409        
46                                                         The SAS System                               09:53 Friday, April 20, 2018

410        
411        %put E3969440A681A2408885998500000038;
E3969440A681A2408885998500000038
412        

In [ ]: