Today, I played with the new SAS Viya environment. This environment has been promoted as a cloud based environment by SAS that acts as a SAAS solution to analytics needs from an organisation. This implies that we only need an internet connection and a browser to access this environment.
How does it work. A small example might show you the working.
We may upload an Excel file to this environment with:
FILENAME REFFILE FILESRVC FOLDERPATH='/Users/tom.van.maanen@capgemini.com/My Folder' FILENAME='invoer.xlsx';
PROC IMPORT DATAFILE=REFFILE
DBMS=XLSX
OUT=WORK.NAMEN;
GETNAMES=YES;
RUN;
data test;
set namen;
run;
This imports a file (= invoer.xlsx) into the traditional SAS work library. The file was imported from a local computer into the cloud environment. This cloud environment is made visible in the Viya Cloud environment with:
We then uploaded this file into work.namen. It can be seen in the library:
We then start a CAS session. This stands for Cloud Analytic Service. Next code takes care of this. Subsequently, I assign the CAS session as a library.
cas mysession sessopts=(caslib=casuser timeout=1000 locale="en_US"); caslib _all_ list; caslib _all_ assign; proc casutil; list tables; run;
The result is that I can see libraries that are connected to the CAS session:
I then copy the work.names dataset into a CAS library with:
proc casutil;
load data = work.test outcaslib = "casuser"
casout = "mytest" promote ;
run;
It is now stored as dataset in the CAS library and it may be used in a session. We may write a script like:
data casuser.mytest2; set casuser.mytest end=eof; select; when (leeftijd > 50) klas = 'oud '; when (leeftijd <= 50) klas = 'jonkie '; otherwise klas = 'onbekend '; end; if eof then put _N_; run; proc print data = casuser.mytest2;run; PROC SGPLOT DATA = casuser.mytest2; VBAR klas; RUN;
which generates: