{"id":3506,"date":"2021-10-06T21:51:27","date_gmt":"2021-10-06T19:51:27","guid":{"rendered":"http:\/\/van-maanen.com\/?p=3506"},"modified":"2021-10-06T21:51:27","modified_gmt":"2021-10-06T19:51:27","slug":"using-the-sas-viya-environment","status":"publish","type":"post","link":"http:\/\/archief.van-maanen.com\/?p=3506","title":{"rendered":"Using the SAS Viya environment"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">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. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">How does it work. A small example might show you the working.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We may upload an Excel file to this environment with:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">FILENAME REFFILE FILESRVC FOLDERPATH='\/Users\/tom.van.maanen@capgemini.com\/My Folder' FILENAME='invoer.xlsx';<br>PROC IMPORT DATAFILE=REFFILE<br>DBMS=XLSX<br>OUT=WORK.NAMEN;<br>GETNAMES=YES;<br>RUN;<br>data test;<br>set namen;<br>run;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">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:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"http:\/\/van-maanen.com\/wp-content\/uploads\/2021\/10\/image-10-1024x220.png\" alt=\"\" class=\"wp-image-3507\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">We then uploaded this file into work.namen. It can be seen in the library:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"http:\/\/van-maanen.com\/wp-content\/uploads\/2021\/10\/image-1-1.png\" alt=\"\" class=\"wp-image-3507\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">cas mysession sessopts=(caslib=casuser timeout=1000 locale=\"en_US\");\ncaslib _<em>all<\/em>_ list;\ncaslib _<em>all<\/em>_ assign;\nproc casutil;\nlist tables;\nrun;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The result is that I can see libraries that are connected to the CAS session:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"http:\/\/van-maanen.com\/wp-content\/uploads\/2021\/10\/image-2-1.png\" alt=\"\" class=\"wp-image-3509\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">I then copy the work.names dataset into a CAS library with:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">proc casutil;<br>load data = work.test outcaslib = \"casuser\"<br>casout = \"mytest\" promote ;<br>run;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">It is now stored as dataset in the CAS library and it may be used in a session. We may write a script like:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">data casuser.mytest2;\nset casuser.mytest end=eof;\nselect;\nwhen (leeftijd &gt; 50) klas = 'oud ';\nwhen (leeftijd &lt;= 50) klas = 'jonkie ';\notherwise klas = 'onbekend ';\nend;\nif eof then put _<em>N<\/em>_;\nrun;\nproc print data = casuser.mytest2;run;\nPROC SGPLOT DATA = casuser.mytest2;\nVBAR klas;\nRUN;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">which generates:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"http:\/\/van-maanen.com\/wp-content\/uploads\/2021\/10\/image-3-1.png\" alt=\"\" class=\"wp-image-3512\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-3506","post","type-post","status-publish","format-standard","hentry","category-allgemein"],"_links":{"self":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts\/3506","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3506"}],"version-history":[{"count":0,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts\/3506\/revisions"}],"wp:attachment":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3506"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3506"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3506"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}