{"id":2357,"date":"2008-11-14T14:15:06","date_gmt":"2008-11-14T14:15:06","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/2008\/11\/14\/interfacing-matlab-and-sas\/"},"modified":"2008-11-14T14:15:06","modified_gmt":"2008-11-14T14:15:06","slug":"interfacing-matlab-and-sas","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2008\/11\/14\/interfacing-matlab-and-sas\/","title":{"rendered":"Interfacing MATLAB and SAS"},"content":{"rendered":"<div xmlns:mwsh=\"https:\/\/www.mathworks.com\/namespace\/mcode\/v1\/syntaxhighlight.dtd\" class=\"content\">\r\n   <introduction>\r\n      <p>This morning, a customer wrote to ask me about the best way to interface MATLAB with SAS. Now, I've been using MATLAB for\r\n         about 14 years, but it's been about that long since I last touched SAS. And I've never tried to interface the two.\r\n      <\/p>\r\n   <\/introduction>\r\n   <p>What to do?<\/p>\r\n   <p>Whenever I'm faced with a challenge of this nature, my first stop is usually Google. (Isn't it everyone's?) So I Googled \"MATLAB\r\n      SAS\" and was very pleased to see that the first \"hit\" was for a <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/13069-the-twain-shall-meet--facilitating-data-exchange-between-sas-and-matlab\">white paper<\/a> by <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/17777\">Dimitri Shvorob<\/a> entitled \"The Twain Shall Meet: Facilitating Data Exchange Between SAS and Matlab.\"\r\n   <\/p>\r\n\r\n<img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/pick\/..\/images\/pick\/googlingmatlab_sas.png\" alt=\"null\" \/>\r\n      <\/p>\r\n   <p>We'll forgive Dimitri here for his improper capitalization of \"MATLAB\"; his paper provides a nice overview of how to use a\r\n      MySQL database as \"conduit\" to facilitate the interchange of data, and underscores the power of the File Exchange (and more\r\n      broadly, of Google, and of the Internet!) to find solutions to commonly faced problems. It's clear from Dimitri's paper that\r\n      he knows his way around SAS, and I'm pleased that he chose to share his knowledge on MATLAB Central. In fact, accompanying\r\n      that paper were two additional files of note: <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/15835-import-data-from-sas\">Import data from SAS<\/a> and <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/15834-export-data-to-sas\">Export data to SAS<\/a>. This suite of files is <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/911\">Brett<\/a>'s choice for this week's Pick of the Week.\r\n   <\/p>\r\n   <p>Let us know <a href=\"https:\/\/blogs.mathworks.com\/pick\/?p=2357#respond\">here<\/a> if you've solved \"interfacing problems\" of this nature--particularly ones you haven't (yet) shared on the File Exchange!\r\n   <\/p><script language=\"JavaScript\">\r\n<!--\r\n\r\n    function grabCode_e2e70378f72c4561a29d84f168b6326e() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='e2e70378f72c4561a29d84f168b6326e ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' e2e70378f72c4561a29d84f168b6326e';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        author = 'Brett Shoelson';\r\n        copyright = 'Copyright 2008 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add author and copyright lines at the bottom if specified.\r\n        if ((author.length > 0) || (copyright.length > 0)) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (author.length > 0) {\r\n                d.writeln('% _' + author + '_');\r\n            }\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n      \r\n      d.title = title + ' (MATLAB code)';\r\n      d.close();\r\n      }   \r\n      \r\n-->\r\n<\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_e2e70378f72c4561a29d84f168b6326e()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n            the MATLAB code \r\n            <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; 7.7<br><\/p>\r\n<\/div>\r\n<!--\r\ne2e70378f72c4561a29d84f168b6326e ##### SOURCE BEGIN #####\r\n%%\r\n% This morning, a customer wrote to ask me about the\r\n% best way to interface MATLAB with SAS. Now, I've been\r\n% using MATLAB for about 14 years, but it's been about\r\n% that long since I last touched SAS. And I've never\r\n% tried to interface the two.\r\n\r\n%%\r\n% What to do?\r\n%\r\n% Whenever I'm faced with a challenge of this nature,\r\n% my first stop is usually Google. (Isn't it\r\n% everyone's?) So I Googled \"MATLAB SAS\" and was very\r\n% pleased to see that the first \"hit\" was for a <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/13069-the-twain-shall-meet--facilitating-data-exchange-between-sas-and-matlab white paper> by <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/17777 Dimitri Shvorob> entitled \r\n% \"The Twain Shall Meet: Facilitating Data Exchange\r\n% Between SAS and Matlab.\"\r\n\r\n%% \r\n% We'll forgive Dimitri here for his improper capitalization of \"MATLAB\"; his paper\r\n% provides a nice overview of how to use a MySQL\r\n% database as \"conduit\" to facilitate the interchange\r\n% of data, and underscores the power of the File Exchange (and more broadly, of Google, and of the Internet!) to find solutions to commonly faced problems. It's clear from Dimitri's paper that he knows his way around SAS, and I'm pleased that he chose to share his knowledge on MATLAB Central. In fact, accompanying that paper were two additional\r\n% files of note: <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/15835-import-data-from-sas Import data from SAS> and\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/15834-export-data-to-sas Export data to SAS>. This suite of files is <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/911 Brett>'s choice for this week's Pick of the Week. \r\n\r\n%%\r\n% Let us know <https:\/\/blogs.mathworks.com\/pick\/?p=2357#respond\r\n% here> if you've solved \"interfacing problems\"\r\n% of this natureREPLACE_WITH_DASH_DASHparticularly ones you haven't (yet)\r\n% shared on the File Exchange!\r\n##### SOURCE END ##### e2e70378f72c4561a29d84f168b6326e\r\n-->","protected":false},"excerpt":{"rendered":"<p>\r\n   \r\n      This morning, a customer wrote to ask me about the best way to interface MATLAB with SAS. Now, I've been using MATLAB for\r\n         about 14 years, but it's been about that long... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2008\/11\/14\/interfacing-matlab-and-sas\/\">read more >><\/a><\/p>","protected":false},"author":34,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16],"tags":[23,19,22,20,21,18],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/2357"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/users\/34"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/comments?post=2357"}],"version-history":[{"count":0,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/2357\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=2357"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=2357"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=2357"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}