{"id":280356,"date":"2016-11-02T14:50:07","date_gmt":"2016-11-02T11:50:07","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=280356"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=280356","title":{"rendered":"\u041a\u0430\u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c Python \u0447\u0435\u0440\u0435\u0437 SAS?"},"content":{"rendered":"<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b \u0443\u0436\u0435 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0441 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0439, \u043a\u043e\u0433\u0434\u0430 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u043d\u0430 python (\u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0432\u0430\u0448\u0438\u043c\u0438 \u043a\u043e\u043b\u043b\u0435\u0433\u0430\u043c\u0438) \u0438 \u0432\u0430\u043c \u043d\u0430\u0434\u043e \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0437\u0430\u043f\u0443\u0441\u043a \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0439 \u043a\u043e\u0434 SAS. <\/p>\n<p>  \u041a\u0430\u043a \u0436\u0435 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c?<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/95b\/088\/f30\/95b088f30567499494d31082b69864a2.jpg\" \/><\/div>\n<p>  <a name=\"habracut\"><\/a><br \/>  \u0418\u0442\u0430\u043a, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c open-source \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0441 <a href=\"https:\/\/github.com\/sassoftware\/enlighten-integration\/tree\/master\/SAS_Base_OpenSrcIntegration\">github<\/a>. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c SASJavaExec.java \u0444\u0430\u0439\u043b \u0441\u0435\u0431\u0435 \u0438 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e \u0432 jar \u0444\u0430\u0439\u043b. \u0412\u0430\u0436\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442: \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e JDK 1.7_025, \u0442.\u043a. \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 JDK 1.8 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0430 \u0432 SAS \u043a\u043e\u0434\u0435.<\/p>\n<p>  <b>1.<\/b> \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u044b: java -jar SASJavaExec.jar<br \/>  <b>2.<\/b> \u041a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c \u0432 jar \u0444\u0430\u0439\u043b: jar cfm SASJavaExec.jar manifest.txt SASJavaExec$1.class SASJavaExec.class<\/p>\n<p>  \u0413\u0434\u0435 manifest.txt \u044d\u0442\u043e \u0444\u0430\u0439\u043b \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438: Main-Class: SASJavaExec. \u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c SASJavaExec.jar \u0444\u0430\u0439\u043b. <\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043d\u0443\u0436\u043d\u043e \u0435\u0433\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u042f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043d\u0430 Windows, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u0441\u0440\u0435\u0434\u044b \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e CLASSPATH.<\/p>\n<p>  \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/071\/535\/1ec\/0715351ec68848fdb327e232b5faeb3c.jpg\" \/><\/div>\n<p>  \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"http:\/\/support.sas.com\/documentation\/cdl\/en\/lrcon\/68089\/HTML\/default\/viewer.htm#n0swy2q7eouj2fn11g1o28q57v4u.htm\">\u0437\u0434\u0435\u0441\u044c<\/a>. <\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0432\u0441\u0435 \u0432\u044b\u0448\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0448\u0430\u0433\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c SAS.<\/p>\n<p>  \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0443\u0442\u0438:<\/p>\n<blockquote><p>\u041f\u0443\u0442\u044c \u043a \u0444\u0430\u0439\u043b\u0443 python: %let PYTHON_EXEC_COMMAND = C:\\Python27\\python.exe; <br \/>  \u041f\u0443\u0442\u044c \u043a \u0432\u0430\u0448\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u043d\u0430 python: <\/p><\/blockquote>\n<p>  <\/p>\n<pre><code>%let WORK_DIR = C:\\SAS\\T_Java\\Example;\t python_pgm = &quot;&WORK_DIR.\\digitsdata_svm.py&quot;;<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0438\u0448\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u043e\u0434 \u2014 Data set:<\/p>\n<pre><code>\/*** Part I: Python ***\/ data _null_;   length rtn_val 8;   *** Python program takes working directory as first argument;   python_pgm = &quot;&WORK_DIR.\\digitsdata_svm.py&quot;;   python_arg1 = &quot;&WORK_DIR&quot;;         python_call = cat('&quot;', trim(python_pgm), '&quot; &quot;', trim(python_arg1), '&quot;');    put python_pgm = ;   put python_arg1 =;   put python_call=;    declare javaobj j(&quot;SASJavaExec&quot;, &quot;&PYTHON_EXEC_COMMAND&quot;, python_call);    j.callIntMethod(&quot;executeProcess&quot;, rtn_val); run;<\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043d\u0430\u0448\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043b\u043e\u0433 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f:<\/p>\n<pre><code>python_pgm=C:\\SAS\\T_Java\\Example\\digitsdata_svm.py python_arg1=C:\\SAS\\T_Java\\Example python_call=&quot;C:\\SAS\\T_Java\\Example\\digitsdata_svm.py&quot; &quot;C:\\SAS\\T_Java\\Example&quot; 27, 2016 6:36:39 AM SASJavaExec executeProcess INFO: Executing [C:\\Python27\\python.exe, C:\\SAS\\T_Java\\Example\\digitsdata_svm.py, C:\\SAS\\T_Java\\Example] ... 27, 2016 6:36:39 AM SASJavaExec executeProcess INFO: Starting external process ...  27, 2016 6:36:39 AM SASJavaExec executeProcess INFO: External process exit value 0.<\/code><\/pre>\n<p>  \u0412\u0441\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 digitsdata_svm.py \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0430\u0441\u044c \u0438\u0437 SAS.<\/p>\n<p>  \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u0434\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u044b\u043b\u0430 \u0434\u043b\u044f \u0412\u0430\u0441 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439. <\/p>\n<p>  <b>P.S.<\/b> \u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u0430\u043c\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b SAS \u0431\u044b\u043b \u0442\u0430\u043a\u0436\u0435 \u0432\u0437\u044f\u0442 c github \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043a\u0430\u0437\u0430\u043b \u0432\u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438.<br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/314268\/\"> https:\/\/habrahabr.ru\/post\/314268\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b \u0443\u0436\u0435 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0441 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0439, \u043a\u043e\u0433\u0434\u0430 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u043d\u0430 python (\u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0432\u0430\u0448\u0438\u043c\u0438 \u043a\u043e\u043b\u043b\u0435\u0433\u0430\u043c\u0438) \u0438 \u0432\u0430\u043c \u043d\u0430\u0434\u043e \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0437\u0430\u043f\u0443\u0441\u043a \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0439 \u043a\u043e\u0434 SAS. <\/p>\n<p>  \u041a\u0430\u043a \u0436\u0435 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c?<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/95b\/088\/f30\/95b088f30567499494d31082b69864a2.jpg\" \/><\/div>\n<p>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-280356","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/280356","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=280356"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/280356\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=280356"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=280356"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=280356"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}