In [1]:
%load_ext saspy.sas_magic


Using SAS Config named: default

In [2]:
%lsmagic


Out[2]:
Available line magics:
%alias  %alias_magic  %autocall  %automagic  %autosave  %bookmark  %cat  %cd  %clear  %colors  %config  %connect_info  %cp  %debug  %dhist  %dirs  %doctest_mode  %ed  %edit  %env  %gui  %hist  %history  %install_default_config  %install_ext  %install_profiles  %killbgscripts  %ldir  %less  %lf  %lk  %ll  %load  %load_ext  %loadpy  %logoff  %logon  %logstart  %logstate  %logstop  %ls  %lsmagic  %lx  %macro  %magic  %man  %matplotlib  %mkdir  %more  %mv  %notebook  %page  %pastebin  %pdb  %pdef  %pdoc  %pfile  %pinfo  %pinfo2  %popd  %pprint  %precision  %profile  %prun  %psearch  %psource  %pushd  %pwd  %pycat  %pylab  %qtconsole  %quickref  %recall  %rehashx  %reload_ext  %rep  %rerun  %reset  %reset_selective  %rm  %rmdir  %run  %save  %sc  %set_env  %store  %sx  %system  %tb  %time  %timeit  %unalias  %unload_ext  %who  %who_ls  %whos  %xdel  %xmode

Available cell magics:
%%!  %%HTML  %%IML  %%OPTMODEL  %%SAS  %%SVG  %%bash  %%capture  %%debug  %%file  %%html  %%javascript  %%latex  %%perl  %%prun  %%pypy  %%python  %%python2  %%python3  %%ruby  %%script  %%sh  %%svg  %%sx  %%system  %%time  %%timeit  %%writefile

Automagic is ON, % prefix IS NOT needed for line magics.

In [3]:
%%SAS 
proc print data=sashelp.class(obs=3);
run;


Out[3]:
SAS Output

SAS Output

The SAS System

The PRINT Procedure

Data Set SASHELP.CLASS

Obs Name Sex Age Height Weight
1 Alfred M 14 69.0 112.5
2 Alice F 13 56.5 84.0
3 Barbara F 13 65.3 98.0

In [4]:
%%SAS 
data a;
    set sashelp.class;
run;


Out[4]:

18   ods listing close;ods html5 file=stdout options(bitmap_mode='inline') device=png; ods graphics on / outputfmt=png;
NOTE: Writing HTML5 Body file: STDOUT
19
20 data a;
21 set sashelp.class;
22 run;
NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: The data set WORK.A has 19 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds

23 ods html5 close;ods listing;

24

In [5]:
%%SAS smallLog
data b;
    set a;
run;


Out[5]:



In [6]:
%%SAS SmaLLlOG
data c;
    set b;
run;


Out[6]:



In [7]:
%%SAS 
data d;
    set c;
run;


Out[7]:

78   ods listing close;ods html5 file=stdout options(bitmap_mode='inline') device=png; ods graphics on / outputfmt=png;
NOTE: Writing HTML5 Body file: STDOUT
79
80 data d;
81 set c;
82 run;
NOTE: There were 19 observations read from the data set WORK.C.
NOTE: The data set WORK.D has 19 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds

83 ods html5 close;ods listing;

84

In [8]:
%%SAS options nosource
data e;
    set d;
run;


Out[8]:

NOTE: Writing HTML5 Body file: STDOUT
NOTE: There were 19 observations read from the data set WORK.D.
NOTE: The data set WORK.E has 19 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds


In [11]:
%%SAS option nonotes cpu=max
data f;
    set e;
run;


Out[11]:

176  ods listing close;ods html5 file=stdout options(bitmap_mode='inline') device=png; ods graphics on / outputfmt=png;
177
178 data f;
179 set e;
180 run;
181 ods html5 close;ods listing;

182

In [10]:
%%SAS option badoption foobar
data g;
    set f;
run;


Out[10]:

150  ods listing close;ods html5 file=stdout options(bitmap_mode='inline') device=png; ods graphics on / outputfmt=png;
NOTE: Writing HTML5 Body file: STDOUT
151
152 data g;
153 set f;
154 run;
NOTE: There were 19 observations read from the data set WORK.F.
NOTE: The data set WORK.G has 19 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds

155 ods html5 close;ods listing;

156

In [ ]: