{"id":400,"date":"2014-08-13T18:30:53","date_gmt":"2014-08-13T17:30:53","guid":{"rendered":"http:\/\/www.sebcharrot.com\/blog\/?p=400"},"modified":"2014-08-13T18:30:53","modified_gmt":"2014-08-13T17:30:53","slug":"how-to-invoke-a-sas-macro-stored-in-a-catalog","status":"publish","type":"post","link":"http:\/\/www.sebcharrot.com\/blog\/how-to-invoke-a-sas-macro-stored-in-a-catalog\/","title":{"rendered":"How to invoke a SAS macro stored in a catalog"},"content":{"rendered":"<p>Having not done the Advanced Base SAS certification, this was a nightmare to work out. I\u2019m documenting it here for my own future use, and to help anyone else who found themselves in the same situation as me.<\/p>\n<h2>What situation was that?<\/h2>\n<p><a href=\"http:\/\/support.sas.com\/software\/products\/sna\/index.html\">SAS Social Network Analysis<\/a> can create networks from input data, and to do so it makes use of a pre-compiled \u201clink macro\u201d which is bundled with SNA. This link macro needs to be invoked from a base SAS program, but to do that, you need to tell SAS where to find it.<\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #999999;\"><em>Note \u2013 There were literally zero Google hits for the exact name of this link macro. In case you\u2019re curious, it\u2019s called <strong>% sfs_net_main_link_macros<\/strong>.<\/em><\/span><\/p>\n<p>Anyway I eventually found the location of these macros, in a catalog file.<\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #999999;\"><em>Note \u2013 Not easy to find, and not documented. If anyone is in the same situation as me, it was in my &lt;SASHome&gt;\\SASFoundation\\9.3\\snamva\\macros folder. The macros are compiled into the <strong>sasmacr.sasb7cat<\/strong> file.<\/em><\/span><\/p>\n<h2>So I have a catalog file, how do I invoke the macro held in it?<\/h2>\n<p>Once you know, it\u2019s very very simple.<\/p>\n<ol>\n<li>Copy the catalog file into your working directory<\/li>\n<li>Add a libname statement pointing to this working directory<\/li>\n<li>Use the <a href=\"http:\/\/support.sas.com\/documentation\/cdl\/en\/mcrolref\/61885\/HTML\/default\/viewer.htm#a000543553.htm\">SASMSTORE<\/a>\u00a0option<\/li>\n<\/ol>\n<p>In other words your code should have the following statements:<\/p>\n<pre style=\"padding-left: 30px;\">libname mylib \"D:\\mylocation\";\nOPTIONS MSTORED SASMSTORE=mylib;<\/pre>\n<p>This will make the next invocation of the macro succeed, since SAS now knows it&#8217;s in your libname directory.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Having not done the Advanced Base SAS certification, this was a nightmare to work out. I\u2019m documenting it here for my own future use, and to help anyone else who found themselves in the same situation as me. What situation was that? SAS Social Network Analysis can create networks from input data, and to do&hellip;&nbsp;<a href=\"http:\/\/www.sebcharrot.com\/blog\/how-to-invoke-a-sas-macro-stored-in-a-catalog\/\" class=\"\" rel=\"bookmark\">Read More &raquo;<span class=\"screen-reader-text\">How to invoke a SAS macro stored in a catalog<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":""},"categories":[23,24],"tags":[48,106,115,152,156,161],"_links":{"self":[{"href":"http:\/\/www.sebcharrot.com\/blog\/wp-json\/wp\/v2\/posts\/400"}],"collection":[{"href":"http:\/\/www.sebcharrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.sebcharrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.sebcharrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.sebcharrot.com\/blog\/wp-json\/wp\/v2\/comments?post=400"}],"version-history":[{"count":0,"href":"http:\/\/www.sebcharrot.com\/blog\/wp-json\/wp\/v2\/posts\/400\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.sebcharrot.com\/blog\/wp-json\/wp\/v2\/media?parent=400"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.sebcharrot.com\/blog\/wp-json\/wp\/v2\/categories?post=400"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.sebcharrot.com\/blog\/wp-json\/wp\/v2\/tags?post=400"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}